Jet
v1.3.3
|
Abstract base class for 3-D cartesian grid structure. More...
#include <jet/grid3.h>
Public Types | |
typedef std::function< Vector3D(size_t, size_t, size_t)> | DataPositionFunc |
Function type for mapping data index to actual position. More... | |
Public Member Functions | |
Grid3 () | |
Constructs an empty grid. More... | |
virtual | ~Grid3 () |
Default destructor. More... | |
virtual std::string | typeName () const =0 |
Returns the type name of derived grid. More... | |
const Size3 & | resolution () const |
Returns the grid resolution. More... | |
const Vector3D & | origin () const |
Returns the grid origin. More... | |
const Vector3D & | gridSpacing () const |
Returns the grid spacing. More... | |
const BoundingBox3D & | 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, size_t)> &func) const |
Invokes the given function func for each grid cell. More... | |
void | parallelForEachCellIndex (const std::function< void(size_t, size_t, size_t)> &func) const |
Invokes the given function func for each grid cell parallelly. More... | |
virtual void | serialize (std::vector< uint8_t > *buffer) const =0 |
Serializes the grid instance to the output buffer. More... | |
virtual void | deserialize (const std::vector< uint8_t > &buffer)=0 |
Deserializes the input buffer to the grid instance. More... | |
bool | hasSameShape (const Grid3 &other) const |
Returns true if resolution, grid-spacing and origin are same. More... | |
virtual void | swap (Grid3 *other)=0 |
Swaps the data with other grid. More... | |
![]() | |
Serializable ()=default | |
virtual | ~Serializable ()=default |
Protected Member Functions | |
void | setSizeParameters (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin) |
void | swapGrid (Grid3 *other) |
Swaps the size parameters with given grid other . More... | |
void | setGrid (const Grid3 &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 3-D cartesian grid structure.
This class represents 3-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<Vector3D(size_t, size_t, size_t)> jet::Grid3::DataPositionFunc |
Function type for mapping data index to actual position.
jet::Grid3::Grid3 | ( | ) |
Constructs an empty grid.
|
virtual |
Default destructor.
const BoundingBox3D& jet::Grid3::boundingBox | ( | ) | const |
Returns the bounding box of the grid.
DataPositionFunc jet::Grid3::cellCenterPosition | ( | ) | const |
Returns the function that maps grid index to the cell-center position.
|
pure virtual |
Deserializes the input buffer to the grid instance.
Implements jet::Serializable.
Implemented in jet::ScalarGrid3, and jet::VectorGrid3.
void jet::Grid3::forEachCellIndex | ( | const std::function< void(size_t, 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, j, and k indices of a grid cell. The order of execution is i-first, j-next, k-last.
|
protectedpure virtual |
Fetches the data into a continuous linear array.
Implemented in jet::FaceCenteredGrid3, jet::ScalarGrid3, and jet::CollocatedVectorGrid3.
const Vector3D& jet::Grid3::gridSpacing | ( | ) | const |
Returns the grid spacing.
bool jet::Grid3::hasSameShape | ( | const Grid3 & | other | ) | const |
Returns true if resolution, grid-spacing and origin are same.
const Vector3D& jet::Grid3::origin | ( | ) | const |
Returns the grid origin.
void jet::Grid3::parallelForEachCellIndex | ( | const std::function< void(size_t, 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, j, and k indices of a grid cell. The order of execution can be arbitrary since it's multi-threaded.
const Size3& jet::Grid3::resolution | ( | ) | const |
Returns the grid resolution.
|
pure virtual |
Serializes the grid instance to the output buffer.
Implements jet::Serializable.
Implemented in jet::ScalarGrid3, and jet::VectorGrid3.
|
protectedpure virtual |
Sets the data from a continuous linear array.
Implemented in jet::FaceCenteredGrid3, jet::ScalarGrid3, and jet::CollocatedVectorGrid3.
|
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::CellCenteredVectorGrid3, jet::VertexCenteredScalarGrid3, jet::CellCenteredScalarGrid3, jet::VertexCenteredVectorGrid3, and jet::FaceCenteredGrid3.
|
protected |
Swaps the size parameters with given grid other
.
|
pure virtual |
Returns the type name of derived grid.