Abstract base class for 3-D vector grid structure. More...
#include <Core/Grid/VectorGrid3.h>
Public Types | |
using | VectorDataAccessor = ArrayAccessor3< Vector3D > |
Read-write array accessor type. More... | |
using | ConstVectorDataAccessor = ConstArrayAccessor3< Vector3D > |
Read-only array accessor type. More... | |
Public Types inherited from CubbyFlow::Grid3 | |
using | DataPositionFunc = std::function< Vector3D(size_t, size_t, size_t)> |
Function type for mapping data index to actual position. More... | |
Public Member Functions | |
VectorGrid3 () | |
Constructs an empty grid. More... | |
virtual | ~VectorGrid3 () |
Default destructor. More... | |
void | Clear () |
Clears the contents of the grid. More... | |
void | Resize (size_t resolutionX, size_t resolutionY, size_t resolutionZ, double gridSpacingX=1.0, double gridSpacingY=1.0, double gridSpacingZ=1.0, double originX=0.0, double originY=0.0, double originZ=0.0, double initialValueX=0.0, double initialValueY=0.0, double initialValueZ=0.0) |
Resizes the grid using given parameters. More... | |
void | Resize (const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1, 1, 1), const Vector3D &origin=Vector3D(), const Vector3D &initialValue=Vector3D()) |
Resizes the grid using given parameters. More... | |
void | Resize (double gridSpacingX, double gridSpacingY, double gridSpacingZ, double originX, double originY, double originZ) |
Resizes the grid using given parameters. More... | |
void | Resize (const Vector3D &gridSpacing, const Vector3D &origin) |
Resizes the grid using given parameters. More... | |
virtual void | Fill (const Vector3D &value, ExecutionPolicy policy=ExecutionPolicy::Parallel)=0 |
Fills the grid with given value. More... | |
virtual void | Fill (const std::function< Vector3D(const Vector3D &)> &func, ExecutionPolicy policy=ExecutionPolicy::Parallel)=0 |
Fills the grid with given position-to-value mapping function. More... | |
virtual std::shared_ptr< VectorGrid3 > | Clone () const =0 |
Returns the copy of the grid instance. More... | |
void | Serialize (std::vector< uint8_t > *buffer) const override |
Serializes the grid instance to the output buffer. More... | |
void | Deserialize (const std::vector< uint8_t > &buffer) override |
Deserializes the input buffer to the grid instance. More... | |
Public Member Functions inherited from CubbyFlow::VectorField3 | |
VectorField3 () | |
Default constructor. More... | |
virtual | ~VectorField3 () |
Default destructor. More... | |
virtual Vector3D | Sample (const Vector3D &x) const =0 |
Returns sampled value at given position x . More... | |
virtual double | Divergence (const Vector3D &x) const |
Returns divergence at given position x . More... | |
virtual Vector3D | Curl (const Vector3D &x) const |
Returns curl at given position x . More... | |
virtual std::function< Vector3D(const Vector3D &)> | Sampler () const |
Returns sampler function object. More... | |
Public Member Functions inherited from CubbyFlow::Field3 | |
Field3 () | |
virtual | ~Field3 () |
Public Member Functions inherited from CubbyFlow::Grid3 | |
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... | |
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 | |
virtual void | OnResize (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin, const Vector3D &initialValue)=0 |
Invoked when the resizing happens. More... | |
Protected Member Functions inherited from CubbyFlow::Grid3 | |
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 vector grid structure.
Member Typedef Documentation
◆ ConstVectorDataAccessor
Read-only array accessor type.
◆ VectorDataAccessor
Read-write array accessor type.
Constructor & Destructor Documentation
◆ VectorGrid3()
CubbyFlow::VectorGrid3::VectorGrid3 | ( | ) |
Constructs an empty grid.
◆ ~VectorGrid3()
|
virtual |
Default destructor.
Member Function Documentation
◆ Clear()
void CubbyFlow::VectorGrid3::Clear | ( | ) |
Clears the contents of the grid.
◆ Clone()
|
pure virtual |
Returns the copy of the grid instance.
Implemented in CubbyFlow::FaceCenteredGrid3, CubbyFlow::VertexCenteredVectorGrid3, and CubbyFlow::CellCenteredVectorGrid3.
◆ Deserialize()
|
overridevirtual |
Deserializes the input buffer to the grid instance.
Implements CubbyFlow::Grid3.
◆ Fill() [1/2]
|
pure virtual |
Fills the grid with given value.
Implemented in CubbyFlow::FaceCenteredGrid3, CubbyFlow::VertexCenteredVectorGrid3, and CubbyFlow::CellCenteredVectorGrid3.
◆ Fill() [2/2]
|
pure virtual |
Fills the grid with given position-to-value mapping function.
Implemented in CubbyFlow::FaceCenteredGrid3, CubbyFlow::VertexCenteredVectorGrid3, and CubbyFlow::CellCenteredVectorGrid3.
◆ OnResize()
|
protectedpure virtual |
Invoked when the resizing happens.
This callback function is called when the grid gets resized. The overriding class should allocate the internal storage based on its data layout scheme.
Implemented in CubbyFlow::FaceCenteredGrid3.
◆ Resize() [1/4]
void CubbyFlow::VectorGrid3::Resize | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
size_t | resolutionZ, | ||
double | gridSpacingX = 1.0 , |
||
double | gridSpacingY = 1.0 , |
||
double | gridSpacingZ = 1.0 , |
||
double | originX = 0.0 , |
||
double | originY = 0.0 , |
||
double | originZ = 0.0 , |
||
double | initialValueX = 0.0 , |
||
double | initialValueY = 0.0 , |
||
double | initialValueZ = 0.0 |
||
) |
Resizes the grid using given parameters.
◆ Resize() [2/4]
void CubbyFlow::VectorGrid3::Resize | ( | const Size3 & | resolution, |
const Vector3D & | gridSpacing = Vector3D(1, 1, 1) , |
||
const Vector3D & | origin = Vector3D() , |
||
const Vector3D & | initialValue = Vector3D() |
||
) |
Resizes the grid using given parameters.
◆ Resize() [3/4]
void CubbyFlow::VectorGrid3::Resize | ( | double | gridSpacingX, |
double | gridSpacingY, | ||
double | gridSpacingZ, | ||
double | originX, | ||
double | originY, | ||
double | originZ | ||
) |
Resizes the grid using given parameters.
◆ Resize() [4/4]
Resizes the grid using given parameters.
◆ Serialize()
|
overridevirtual |
Serializes the grid instance to the output buffer.
Implements CubbyFlow::Grid3.
The documentation for this class was generated from the following file:
- Core/Grid/VectorGrid3.h