Jet
v1.3.3
|
Abstract base class for 2-D cartesian grid structure. More...
#include <jet/grid2.h>
Public Types | |
typedef std::function< Vector2D(size_t, size_t)> | DataPositionFunc |
Function type for mapping data index to actual position. More... | |
Public Member Functions | |
Grid2 () | |
Constructs an empty grid. More... | |
virtual | ~Grid2 () |
Default destructor. More... | |
virtual std::string | typeName () const =0 |
Returns the type name of derived grid. More... | |
const Size2 & | resolution () const |
Returns the grid resolution. More... | |
const Vector2D & | origin () const |
Returns the grid origin. More... | |
const Vector2D & | gridSpacing () const |
Returns the grid spacing. More... | |
const BoundingBox2D & | boundingBox () const |
Returns the bounding box of the grid. More... | |
DataPositionFunc | cellCenterPosition () const |
Returns the function that maps grid index to the cell-center position. More... | |
void | forEachCellIndex (const std::function< void(size_t, size_t)> &func) const |
Invokes the given function func for each grid cell. More... | |
void | parallelForEachCellIndex (const std::function< void(size_t, size_t)> &func) const |
Invokes the given function func for each grid cell parallelly. More... | |
bool | hasSameShape (const Grid2 &other) const |
Returns true if resolution, grid-spacing and origin are same. More... | |
virtual void | swap (Grid2 *other)=0 |
Swaps the data with other grid. More... | |
![]() | |
Serializable ()=default | |
virtual | ~Serializable ()=default |
virtual void | serialize (std::vector< uint8_t > *buffer) const =0 |
Serializes this instance into the flat buffer. More... | |
virtual void | deserialize (const std::vector< uint8_t > &buffer)=0 |
Deserializes this instance from the flat buffer. More... | |
Protected Member Functions | |
void | setSizeParameters (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin) |
void | swapGrid (Grid2 *other) |
Swaps the size parameters with given grid other . More... | |
void | setGrid (const Grid2 &other) |
Sets the size parameters with given grid other . More... | |
virtual void | getData (std::vector< double > *data) const =0 |
Fetches the data into a continuous linear array. More... | |
virtual void | setData (const std::vector< double > &data)=0 |
Sets the data from a continuous linear array. More... | |
Abstract base class for 2-D cartesian grid structure.
This class represents 2-D cartesian grid structure. This class is an abstract base class and does not store any data. The class only stores the shape of the grid. The grid structure is axis-aligned and can have different grid spacing per axis.
typedef std::function<Vector2D(size_t, size_t)> jet::Grid2::DataPositionFunc |
Function type for mapping data index to actual position.
jet::Grid2::Grid2 | ( | ) |
Constructs an empty grid.
|
virtual |
Default destructor.
const BoundingBox2D& jet::Grid2::boundingBox | ( | ) | const |
Returns the bounding box of the grid.
DataPositionFunc jet::Grid2::cellCenterPosition | ( | ) | const |
Returns the function that maps grid index to the cell-center position.
void jet::Grid2::forEachCellIndex | ( | const std::function< void(size_t, size_t)> & | func | ) | const |
Invokes the given function func
for each grid cell.
This function invokes the given function object func
for each grid cell in serial manner. The input parameters are i and j indices of a grid cell. The order of execution is i-first, j-last.
|
protectedpure virtual |
Fetches the data into a continuous linear array.
Implemented in jet::FaceCenteredGrid2, jet::ScalarGrid2, and jet::CollocatedVectorGrid2.
const Vector2D& jet::Grid2::gridSpacing | ( | ) | const |
Returns the grid spacing.
bool jet::Grid2::hasSameShape | ( | const Grid2 & | other | ) | const |
Returns true if resolution, grid-spacing and origin are same.
const Vector2D& jet::Grid2::origin | ( | ) | const |
Returns the grid origin.
void jet::Grid2::parallelForEachCellIndex | ( | const std::function< void(size_t, size_t)> & | func | ) | const |
Invokes the given function func
for each grid cell parallelly.
This function invokes the given function object func
for each grid cell in parallel manner. The input parameters are i and j indices of a grid cell. The order of execution can be arbitrary since it's multi-threaded.
const Size2& jet::Grid2::resolution | ( | ) | const |
Returns the grid resolution.
|
protectedpure virtual |
Sets the data from a continuous linear array.
Implemented in jet::FaceCenteredGrid2, jet::ScalarGrid2, and jet::CollocatedVectorGrid2.
|
protected |
Sets the size parameters with given grid other
.
|
protected |
Sets the size parameters including the resolution, grid spacing, and origin.
|
pure virtual |
Swaps the data with other grid.
Implemented in jet::VertexCenteredScalarGrid2, jet::CellCenteredVectorGrid2, jet::VertexCenteredVectorGrid2, jet::CellCenteredScalarGrid2, and jet::FaceCenteredGrid2.
|
protected |
Swaps the size parameters with given grid other
.
|
pure virtual |
Returns the type name of derived grid.