Abstract base class for 3-D cartesian grid structure. More...
#include <Core/Grid/Grid3.h>
Public Types | |
using | DataPositionFunc = std::function< Vector3D(size_t, size_t, size_t)> |
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 in parallel. 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... | |
Protected Member Functions | |
void | SetSizeParameters (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin) |
Sets the size parameters including the resolution, grid spacing, and origin. More... | |
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... | |
Detailed Description
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.
Member Typedef Documentation
◆ DataPositionFunc
using CubbyFlow::Grid3::DataPositionFunc = std::function<Vector3D(size_t, size_t, size_t)> |
Function type for mapping data index to actual position.
Constructor & Destructor Documentation
◆ Grid3()
CubbyFlow::Grid3::Grid3 | ( | ) |
Constructs an empty grid.
◆ ~Grid3()
|
virtual |
Default destructor.
Member Function Documentation
◆ BoundingBox()
const BoundingBox3D& CubbyFlow::Grid3::BoundingBox | ( | ) | const |
Returns the bounding box of the grid.
◆ CellCenterPosition()
DataPositionFunc CubbyFlow::Grid3::CellCenterPosition | ( | ) | const |
Returns the function that maps grid index to the cell-center position.
◆ Deserialize()
|
pure virtual |
Deserializes the input buffer to the grid instance.
Implements CubbyFlow::Serializable.
Implemented in CubbyFlow::ScalarGrid3, and CubbyFlow::VectorGrid3.
◆ ForEachCellIndex()
void CubbyFlow::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 and j indices of a grid cell. The order of execution is i-first, j-next, k-last.
◆ GetData()
|
protectedpure virtual |
Fetches the data into a continuous linear array.
Implemented in CubbyFlow::FaceCenteredGrid3, CubbyFlow::ScalarGrid3, and CubbyFlow::CollocatedVectorGrid3.
◆ GridSpacing()
const Vector3D& CubbyFlow::Grid3::GridSpacing | ( | ) | const |
Returns the grid spacing.
◆ HasSameShape()
bool CubbyFlow::Grid3::HasSameShape | ( | const Grid3 & | other | ) | const |
Returns true if resolution, grid-spacing and origin are same.
◆ Origin()
const Vector3D& CubbyFlow::Grid3::Origin | ( | ) | const |
Returns the grid origin.
◆ ParallelForEachCellIndex()
void CubbyFlow::Grid3::ParallelForEachCellIndex | ( | const std::function< void(size_t, size_t, size_t)> & | func | ) | const |
Invokes the given function func
for each grid cell in parallel.
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.
◆ Resolution()
const Size3& CubbyFlow::Grid3::Resolution | ( | ) | const |
Returns the grid resolution.
◆ Serialize()
|
pure virtual |
Serializes the grid instance to the output buffer.
Implements CubbyFlow::Serializable.
Implemented in CubbyFlow::ScalarGrid3, and CubbyFlow::VectorGrid3.
◆ SetData()
|
protectedpure virtual |
Sets the data from a continuous linear array.
Implemented in CubbyFlow::FaceCenteredGrid3, CubbyFlow::ScalarGrid3, and CubbyFlow::CollocatedVectorGrid3.
◆ SetGrid()
|
protected |
Sets the size parameters with given grid other
.
◆ SetSizeParameters()
|
protected |
Sets the size parameters including the resolution, grid spacing, and origin.
◆ Swap()
|
pure virtual |
Swaps the data with other grid.
Implemented in CubbyFlow::CellCenteredScalarGrid3, CubbyFlow::CellCenteredVectorGrid3, CubbyFlow::VertexCenteredScalarGrid3, CubbyFlow::VertexCenteredVectorGrid3, and CubbyFlow::FaceCenteredGrid3.
◆ SwapGrid()
|
protected |
Swaps the size parameters with given grid other
.
◆ TypeName()
|
pure virtual |
Returns the type name of derived grid.
The documentation for this class was generated from the following file:
- Core/Grid/Grid3.h