CubbyFlow::CellCenteredVectorGrid2 Class Referencefinal

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

#include <Core/Grid/CellCenteredVectorGrid2.h>

Inheritance diagram for CubbyFlow::CellCenteredVectorGrid2:
CubbyFlow::CollocatedVectorGrid2 CubbyFlow::VectorGrid2 CubbyFlow::VectorField2 CubbyFlow::Grid2 CubbyFlow::Field2 CubbyFlow::Serializable

Classes

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

Public Member Functions

 CUBBYFLOW_GRID2_TYPE_NAME (CellCenteredVectorGrid2)
 
 CellCenteredVectorGrid2 ()
 Constructs zero-sized grid. More...
 
 CellCenteredVectorGrid2 (size_t resolutionX, size_t resolutionY, double gridSpacingX=1.0, double gridSpacingY=1.0, double originX=0.0, double originY=0.0, double initialValueU=0.0, double initalValueV=0.0)
 
 CellCenteredVectorGrid2 (const Size2 &resolution, const Vector2D &gridSpacing=Vector2D(1.0, 1.0), const Vector2D &origin=Vector2D(), const Vector2D &initalValue=Vector2D())
 
 CellCenteredVectorGrid2 (const CellCenteredVectorGrid2 &other)
 Copy constructor. More...
 
Size2 GetDataSize () const override
 Returns the actual data point size. More...
 
Vector2D GetDataOrigin () const override
 
std::shared_ptr< VectorGrid2Clone () const override
 Returns the copy of the grid instance. More...
 
void Swap (Grid2 *other) override
 Swaps the contents with the given other grid. More...
 
void Fill (const Vector2D &value, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
 Fills the grid with given value. More...
 
void Fill (const std::function< Vector2D(const Vector2D &)> &func, ExecutionPolicy policy=ExecutionPolicy::Parallel) override
 Fills the grid with given function. More...
 
void Set (const CellCenteredVectorGrid2 &other)
 Sets the contents with the given other grid. More...
 
CellCenteredVectorGrid2operator= (const CellCenteredVectorGrid2 &other)
 Sets the contents with the given other gird. More...
 
- Public Member Functions inherited from CubbyFlow::CollocatedVectorGrid2
 CollocatedVectorGrid2 ()
 Constructs an empty grid. More...
 
virtual ~CollocatedVectorGrid2 ()
 Default destructor. More...
 
const Vector2Doperator() (size_t i, size_t j) const
 Returns the grid data at given data point. More...
 
Vector2Doperator() (size_t i, size_t j)
 Returns the grid data at given data point. More...
 
double DivergenceAtDataPoint (size_t i, size_t j) const
 Returns divergence at data point location. More...
 
double CurlAtDataPoint (size_t i, size_t j) 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)> &func) const
 Invokes the given function func for each data point. More...
 
void ParallelForEachDataPointIndex (const std::function< void(size_t, size_t)> &func) const
 Invokes the given function func for each data point in parallel. More...
 
Vector2D Sample (const Vector2D &x) const override
 Returns sampled value at given position x. More...
 
double Divergence (const Vector2D &x) const override
 Returns divergence at given position x. More...
 
double Curl (const Vector2D &x) const override
 Returns curl at given position x. More...
 
std::function< Vector2D(const Vector2D &)> Sampler () const override
 Returns the sampler function. More...
 
- Public Member Functions inherited from CubbyFlow::VectorGrid2
 VectorGrid2 ()
 Constructs an empty grid. More...
 
virtual ~VectorGrid2 ()
 Default destructor. More...
 
void Clear ()
 Clears the contents of the grid. More...
 
void Resize (size_t resolutionX, size_t resolutionY, double gridSpacingX=1.0, double gridSpacingY=1.0, double originX=0.0, double originY=0.0, double initialValueX=0.0, double initialValueY=0.0)
 Resizes the grid using given parameters. More...
 
void Resize (const Size2 &resolution, const Vector2D &gridSpacing=Vector2D(1, 1), const Vector2D &origin=Vector2D(), const Vector2D &initialValue=Vector2D())
 Resizes the grid using given parameters. More...
 
void Resize (double gridSpacingX, double gridSpacingY, double originX, double originY)
 Resizes the grid using given parameters. More...
 
void Resize (const Vector2D &gridSpacing, const Vector2D &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::VectorField2
 VectorField2 ()
 Default constructor. More...
 
virtual ~VectorField2 ()
 Default destructor. More...
 
- Public Member Functions inherited from CubbyFlow::Field2
 Field2 ()
 
virtual ~Field2 ()
 
- Public Member Functions inherited from CubbyFlow::Grid2
 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 Size2Resolution () const
 Returns the grid resolution. More...
 
const Vector2DOrigin () const
 Returns the grid origin. More...
 
const Vector2DGridSpacing () const
 Returns the grid spacing. More...
 
const BoundingBox2DBoundingBox () 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 in parallel. More...
 
bool HasSameShape (const Grid2 &other) const
 Returns true if resolution, grid-spacing and origin are same. More...
 

Static Public Member Functions

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

Additional Inherited Members

- Public Types inherited from CubbyFlow::VectorGrid2
using VectorDataAccessor = ArrayAccessor2< Vector2D >
 Read-write array accessor type. More...
 
using ConstVectorDataAccessor = ConstArrayAccessor2< Vector2D >
 Read-only array accessor type. More...
 
- Public Types inherited from CubbyFlow::Grid2
using DataPositionFunc = std::function< Vector2D(size_t, size_t)>
 Function type for mapping data index to actual position. More...
 
- Protected Member Functions inherited from CubbyFlow::CollocatedVectorGrid2
void SwapCollocatedVectorGrid (CollocatedVectorGrid2 *other)
 Swaps the data storage and predefined samplers with given grid. More...
 
void SetCollocatedVectorGrid (const CollocatedVectorGrid2 &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::Grid2
void SetSizeParameters (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin)
 Sets the size parameters including the resolution, grid spacing, and origin. More...
 
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...
 

Detailed Description

2-D Cell-centered vector grid structure.

This class represents 2-D cell-centered vector grid which extends VectorGrid2. 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

◆ CellCenteredVectorGrid2() [1/4]

CubbyFlow::CellCenteredVectorGrid2::CellCenteredVectorGrid2 ( )

Constructs zero-sized grid.

◆ CellCenteredVectorGrid2() [2/4]

CubbyFlow::CellCenteredVectorGrid2::CellCenteredVectorGrid2 ( size_t  resolutionX,
size_t  resolutionY,
double  gridSpacingX = 1.0,
double  gridSpacingY = 1.0,
double  originX = 0.0,
double  originY = 0.0,
double  initialValueU = 0.0,
double  initalValueV = 0.0 
)

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

◆ CellCenteredVectorGrid2() [3/4]

CubbyFlow::CellCenteredVectorGrid2::CellCenteredVectorGrid2 ( const Size2 resolution,
const Vector2D gridSpacing = Vector2D(1.0, 1.0),
const Vector2D origin = Vector2D(),
const Vector2D initalValue = Vector2D() 
)

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

◆ CellCenteredVectorGrid2() [4/4]

CubbyFlow::CellCenteredVectorGrid2::CellCenteredVectorGrid2 ( const CellCenteredVectorGrid2 other)

Copy constructor.

Member Function Documentation

◆ Clone()

std::shared_ptr<VectorGrid2> CubbyFlow::CellCenteredVectorGrid2::Clone ( ) const
overridevirtual

Returns the copy of the grid instance.

Implements CubbyFlow::VectorGrid2.

◆ CUBBYFLOW_GRID2_TYPE_NAME()

CubbyFlow::CellCenteredVectorGrid2::CUBBYFLOW_GRID2_TYPE_NAME ( CellCenteredVectorGrid2  )

◆ Fill() [1/2]

void CubbyFlow::CellCenteredVectorGrid2::Fill ( const Vector2D value,
ExecutionPolicy  policy = ExecutionPolicy::Parallel 
)
overridevirtual

Fills the grid with given value.

Implements CubbyFlow::VectorGrid2.

◆ Fill() [2/2]

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

Fills the grid with given function.

Implements CubbyFlow::VectorGrid2.

◆ GetBuilder()

static Builder CubbyFlow::CellCenteredVectorGrid2::GetBuilder ( )
static

Returns the builder fox CellCenteredVectorGrid2.

◆ GetDataOrigin()

Vector2D CubbyFlow::CellCenteredVectorGrid2::GetDataOrigin ( ) const
overridevirtual

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

Implements CubbyFlow::CollocatedVectorGrid2.

◆ GetDataSize()

Size2 CubbyFlow::CellCenteredVectorGrid2::GetDataSize ( ) const
overridevirtual

Returns the actual data point size.

Implements CubbyFlow::CollocatedVectorGrid2.

◆ operator=()

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

Sets the contents with the given other gird.

◆ Set()

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

Sets the contents with the given other grid.

◆ Swap()

void CubbyFlow::CellCenteredVectorGrid2::Swap ( Grid2 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::Grid2.


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