CellularAutomata
Loading...
Searching...
No Matches
CellularAutomata::State< T > Class Template Reference

2D buffered matrices More...

#include <common.hpp>

Public Member Functions

 State (const unsigned int height, const unsigned int width, stateFunc< T > fn, Device device)
 Initalizes a state.
 
 ~State ()
 Frees dynamically allocated memory.
 
void copyTo (State< T > *to)
 Copy the own current state buffer to another current state buffer across devices.
 
void swap ()
 Swaps the current- and next state buffer.
 
void print ()
 Prints the current state buffer.
 

Public Attributes

T * curr
 Current 2D Matrix buffer.
 
T * next
 Next 2D Matrix buffer.
 
const unsigned int height
 Height of 2D Matrix.
 
const unsigned int width
 Width of 2D Matrix.
 
const Device device
 Computational device.
 

Detailed Description

template<typename T>
class CellularAutomata::State< T >

2D buffered matrices

Template Parameters
Ttype

Constructor & Destructor Documentation

◆ State()

template<typename T >
CellularAutomata::State< T >::State ( const unsigned int  height,
const unsigned int  width,
stateFunc< T >  fn,
Device  device 
)

Initalizes a state.

Parameters
heightheight of the grid world
widthwidth of the grid world
fnfunction to fill the current state buffer. May be 'nullptr'
devicecomputational device
Exceptions
DeviceNotAvailable

Member Function Documentation

◆ copyTo()

template<typename T >
void CellularAutomata::State< T >::copyTo ( State< T > *  to)

Copy the own current state buffer to another current state buffer across devices.

Parameters
toother state
Exceptions
ShapesUnequal

The documentation for this class was generated from the following files: