CubbyFlow::CellCenteredVectorGrid3 Class Referencefinal

3-D Cell-centered vector grid structure. More...

#include <Core/Grid/CellCenteredVectorGrid3.h>

Inheritance diagram for CubbyFlow::CellCenteredVectorGrid3:
CubbyFlow::CollocatedVectorGrid3 CubbyFlow::VectorGrid3 CubbyFlow::VectorField3 CubbyFlow::Grid3 CubbyFlow::Field3 CubbyFlow::Serializable

Classes

class  Builder
 Front-end to create CellCenteredVectorGrid3 objects step by step. More...
 

Public Member Functions

 CUBBYFLOW_GRID3_TYPE_NAME (CellCenteredVectorGrid3)
 
 CellCenteredVectorGrid3 ()
 Constructs zero-sized grid. More...
 
 CellCenteredVectorGrid3 (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 initialValueU=0.0, double initalValueV=0.0, double initalValueZ=0.0)
 
 CellCenteredVectorGrid3 (const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), const Vector3D &initalValue=Vector3D())
 
 CellCenteredVectorGrid3 (const CellCenteredVectorGrid3 &other)
 Copy constructor. More...
 
Size3 GetDataSize () const override
 Returns the actual data point size. More...
 
Vector3D GetDataOrigin () const override
 
std::shared_ptr< VectorGrid3Clone () const override
 Returns the copy of the grid instance. More...
 
void Swap (Grid3 *other) override
 Swaps the contents with the given other grid. More...
 
void Fill (const Vector3D &value, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
 Fills the grid with given value. More...
 
void Fill (const std::function< Vector3D(const Vector3D &)> &func, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
 Fills the grid with given function. More...
 
void Set (const CellCenteredVectorGrid3 &other)
 Sets the contents with the given other grid. More...
 
CellCenteredVectorGrid3operator= (const CellCenteredVectorGrid3 &other)
 Sets the contents with the given other gird. More...
 
- Public Member Functions inherited from CubbyFlow::CollocatedVectorGrid3
 CollocatedVectorGrid3 ()
 Constructs an empty grid. More...
 
virtual ~CollocatedVectorGrid3 ()
 Default destructor. More...
 
const Vector3Doperator() (size_t i, size_t j, size_t k) const
 Returns the grid data at given data point. More...
 
Vector3Doperator() (size_t i, size_t j, size_t k)
 Returns the grid data at given data point. More...
 
double DivergenceAtDataPoint (size_t i, size_t j, size_t k) const
 Returns divergence at data point location. More...
 
Vector3D CurlAtDataPoint (size_t i, size_t j, size_t k) const
 Returns curl at data point location. More...
 
VectorDataAccessor GetDataAccessor ()
 Returns the read-write data array accessor. More...
 
ConstVectorDataAccessor GetConstDataAccessor () const
 Returns the read-only data array accessor. More...
 
DataPositionFunc GetDataPosition () const
 Returns the function that maps data point to its position. More...
 
void ForEachDataPointIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each data point. More...
 
void ParallelForEachDataPointIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each data point in parallel. More...
 
Vector3D Sample (const Vector3D &x) const override
 Returns sampled value at given position x. More...
 
double Divergence (const Vector3D &x) const override
 Returns divergence at given position x. More...
 
Vector3D Curl (const Vector3D &x) const override
 Returns curl at given position x. More...
 
std::function< Vector3D(const Vector3D &)> Sampler () const override
 Returns the sampler function. More...
 
- Public Member Functions inherited from CubbyFlow::VectorGrid3
 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...
 
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...
 
- 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 Size3Resolution () const
 Returns the grid resolution. More...
 
const Vector3DOrigin () const
 Returns the grid origin. More...
 
const Vector3DGridSpacing () const
 Returns the grid spacing. More...
 
const BoundingBox3DBoundingBox () 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...
 

Static Public Member Functions

static Builder GetBuilder ()
 Returns the builder fox CellCenteredVectorGrid3. More...
 

Additional Inherited Members

- Public Types inherited from CubbyFlow::VectorGrid3
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...
 
- Protected Member Functions inherited from CubbyFlow::CollocatedVectorGrid3
void SwapCollocatedVectorGrid (CollocatedVectorGrid3 *other)
 Swaps the data storage and predefined samplers with given grid. More...
 
void SetCollocatedVectorGrid (const CollocatedVectorGrid3 &other)
 Sets the data storage and predefined samplers with given grid. More...
 
void GetData (std::vector< double > *data) const override
 Fetches the data into a continuous linear array. More...
 
void SetData (const std::vector< double > &data) override
 Sets the data from a continuous linear array. 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...
 

Detailed Description

3-D Cell-centered vector grid structure.

This class represents 3-D cell-centered vector grid which extends VectorGrid3. As its name suggests, the class defines the data point at the center of a grid cell. Thus, the dimension of data points are equal to the dimension of the cells.

Constructor & Destructor Documentation

◆ CellCenteredVectorGrid3() [1/4]

CubbyFlow::CellCenteredVectorGrid3::CellCenteredVectorGrid3 ( )

Constructs zero-sized grid.

◆ CellCenteredVectorGrid3() [2/4]

CubbyFlow::CellCenteredVectorGrid3::CellCenteredVectorGrid3 ( 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  initialValueU = 0.0,
double  initalValueV = 0.0,
double  initalValueZ = 0.0 
)

Constructs a grid with given resolution, grid spacing, origin and initial value.

◆ CellCenteredVectorGrid3() [3/4]

CubbyFlow::CellCenteredVectorGrid3::CellCenteredVectorGrid3 ( const Size3 resolution,
const Vector3D gridSpacing = Vector3D(1.0, 1.0, 1.0),
const Vector3D origin = Vector3D(),
const Vector3D initalValue = Vector3D() 
)

Constructs a grid with given resolution, grid spacing, origin and initial value.

◆ CellCenteredVectorGrid3() [4/4]

CubbyFlow::CellCenteredVectorGrid3::CellCenteredVectorGrid3 ( const CellCenteredVectorGrid3 other)

Copy constructor.

Member Function Documentation

◆ Clone()

std::shared_ptr<VectorGrid3> CubbyFlow::CellCenteredVectorGrid3::Clone ( ) const
overridevirtual

Returns the copy of the grid instance.

Implements CubbyFlow::VectorGrid3.

◆ CUBBYFLOW_GRID3_TYPE_NAME()

CubbyFlow::CellCenteredVectorGrid3::CUBBYFLOW_GRID3_TYPE_NAME ( CellCenteredVectorGrid3  )

◆ Fill() [1/2]

void CubbyFlow::CellCenteredVectorGrid3::Fill ( const Vector3D value,
ExecutionPolicy  policy = ExecutionPolicy::Parallel 
)
overridevirtual

Fills the grid with given value.

Implements CubbyFlow::VectorGrid3.

◆ Fill() [2/2]

void CubbyFlow::CellCenteredVectorGrid3::Fill ( const std::function< Vector3D(const Vector3D &)> &  func,
ExecutionPolicy  policy = ExecutionPolicy::Parallel 
)
overridevirtual

Fills the grid with given function.

Implements CubbyFlow::VectorGrid3.

◆ GetBuilder()

static Builder CubbyFlow::CellCenteredVectorGrid3::GetBuilder ( )
static

Returns the builder fox CellCenteredVectorGrid3.

◆ GetDataOrigin()

Vector3D CubbyFlow::CellCenteredVectorGrid3::GetDataOrigin ( ) const
overridevirtual

Returns data position for the grid point at (0, 0, 0). Note that this is different from origin() since origin() returns the lower corner point of the bounding box.

Implements CubbyFlow::CollocatedVectorGrid3.

◆ GetDataSize()

Size3 CubbyFlow::CellCenteredVectorGrid3::GetDataSize ( ) const
overridevirtual

Returns the actual data point size.

Implements CubbyFlow::CollocatedVectorGrid3.

◆ operator=()

CellCenteredVectorGrid3& CubbyFlow::CellCenteredVectorGrid3::operator= ( const CellCenteredVectorGrid3 other)

Sets the contents with the given other gird.

◆ Set()

void CubbyFlow::CellCenteredVectorGrid3::Set ( const CellCenteredVectorGrid3 other)

Sets the contents with the given other grid.

◆ Swap()

void CubbyFlow::CellCenteredVectorGrid3::Swap ( Grid3 other)
overridevirtual

Swaps the contents with the given other grid.

This function swaps the contents of the grid instance with the given grid object other only if other has the same type with this grid.

Implements CubbyFlow::Grid3.


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