CubbyFlow::GridSystemData2 Class Reference

2-D grid system data. More...

#include <Core/Grid/GridSystemData2.h>

Inheritance diagram for CubbyFlow::GridSystemData2:
CubbyFlow::Serializable

Public Member Functions

 GridSystemData2 ()
 Constructs empty grid system. More...
 
 GridSystemData2 (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin)
 Constructs a grid system with given resolution, grid spacing and origin. More...
 
 GridSystemData2 (const GridSystemData2 &other)
 Copy constructor. More...
 
virtual ~GridSystemData2 ()
 Destructor. More...
 
void Resize (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin)
 Resizes the whole system with given resolution, grid spacing, and origin. More...
 
Size2 GetResolution () const
 Returns the resolution of the grid. More...
 
Vector2D GetGridSpacing () const
 Return the grid spacing. More...
 
Vector2D GetOrigin () const
 Returns the origin of the grid. More...
 
BoundingBox2D GetBoundingBox () const
 Returns the bounding box of the grid. More...
 
size_t AddScalarData (const ScalarGridBuilder2Ptr &builder, double initialVal=0.0)
 Adds a non-advectable scalar data grid by passing its builder and initial value. More...
 
size_t AddVectorData (const VectorGridBuilder2Ptr &builder, const Vector2D &initialVal=Vector2D())
 Adds a non-advectable vector data grid by passing its builder and initial value. More...
 
size_t AddAdvectableScalarData (const ScalarGridBuilder2Ptr &builder, double initialVal=0.0)
 Adds an advectable scalar data grid by passing its builder and initial value. More...
 
size_t AddAdvectableVectorData (const VectorGridBuilder2Ptr &builder, const Vector2D &initialVal=Vector2D())
 Adds an advectable vector data grid by passing its builder and initial value. More...
 
const FaceCenteredGrid2PtrGetVelocity () const
 Returns the velocity field. More...
 
size_t GetVelocityIndex () const
 Returns the index of the velocity field. More...
 
const ScalarGrid2PtrGetScalarDataAt (size_t idx) const
 Returns the non-advectable scalar data at given index. More...
 
const VectorGrid2PtrGetVectorDataAt (size_t idx) const
 Returns the non-advectable vector data at given index. More...
 
const ScalarGrid2PtrGetAdvectableScalarDataAt (size_t idx) const
 Returns the advectable scalar data at given index. More...
 
const VectorGrid2PtrGetAdvectableVectorDataAt (size_t idx) const
 Returns the advectable vector data at given index. More...
 
size_t GetNumberOfScalarData () const
 Returns the number of non-advectable scalar data. More...
 
size_t GetNumberOfVectorData () const
 Returns the number of non-advectable vector data. More...
 
size_t GetNumberOfAdvectableScalarData () const
 Returns the number of advectable scalar data. More...
 
size_t GetNumberOfAdvectableVectorData () const
 Returns the number of advectable vector data. More...
 
void Serialize (std::vector< uint8_t > *buffer) const override
 Serialize the data to the given buffer. More...
 
void Deserialize (const std::vector< uint8_t > &buffer) override
 Serialize the data from the given buffer. More...
 

Detailed Description

2-D grid system data.

This class is the key data structure for storing grid system data. To represent a grid system for fluid simulation, velocity field is defined as a face-centered (MAC) grid by default. It can also have additional scalar or vector attributes by adding extra data layer.

Constructor & Destructor Documentation

◆ GridSystemData2() [1/3]

CubbyFlow::GridSystemData2::GridSystemData2 ( )

Constructs empty grid system.

◆ GridSystemData2() [2/3]

CubbyFlow::GridSystemData2::GridSystemData2 ( const Size2 resolution,
const Vector2D gridSpacing,
const Vector2D origin 
)

Constructs a grid system with given resolution, grid spacing and origin.

This constructor builds the entire grid layers within the system. Note, the resolution is the grid resolution, not the data size of each grid. Depending on the layout of the grid, the data point may lie on different part of the grid (vertex, cell-center, or face-center), thus can have different array size internally. The resolution of the grid means the grid cell resolution.

Parameters
[in]resolutionThe resolution.
[in]gridSpacingThe grid spacing.
[in]originThe origin.

◆ GridSystemData2() [3/3]

CubbyFlow::GridSystemData2::GridSystemData2 ( const GridSystemData2 other)

Copy constructor.

◆ ~GridSystemData2()

virtual CubbyFlow::GridSystemData2::~GridSystemData2 ( )
virtual

Destructor.

Member Function Documentation

◆ AddAdvectableScalarData()

size_t CubbyFlow::GridSystemData2::AddAdvectableScalarData ( const ScalarGridBuilder2Ptr builder,
double  initialVal = 0.0 
)

Adds an advectable scalar data grid by passing its builder and initial value.

This function adds a new scalar data grid. This layer is advectable, meaning that during the computation of fluid flow, this layer will follow the flow. For the future access of this layer, its index is returned.

Parameters
[in]builderThe grid builder.
[in]initialValThe initial value.
Returns
Index of the data.

◆ AddAdvectableVectorData()

size_t CubbyFlow::GridSystemData2::AddAdvectableVectorData ( const VectorGridBuilder2Ptr builder,
const Vector2D initialVal = Vector2D() 
)

Adds an advectable vector data grid by passing its builder and initial value.

This function adds a new vector data grid. This layer is advectable, meaning that during the computation of fluid flow, this layer will follow the flow. For the future access of this layer, its index is returned.

Parameters
[in]builderThe grid builder.
[in]initialValThe initial value.
Returns
Index of the data.

◆ AddScalarData()

size_t CubbyFlow::GridSystemData2::AddScalarData ( const ScalarGridBuilder2Ptr builder,
double  initialVal = 0.0 
)

Adds a non-advectable scalar data grid by passing its builder and initial value.

This function adds a new scalar data grid. This layer is not advectable, meaning that during the computation of fluid flow, this layer won't follow the flow. For the future access of this layer, its index is returned.

Parameters
[in]builderThe grid builder.
[in]initialValThe initial value.
Returns
Index of the data.

◆ AddVectorData()

size_t CubbyFlow::GridSystemData2::AddVectorData ( const VectorGridBuilder2Ptr builder,
const Vector2D initialVal = Vector2D() 
)

Adds a non-advectable vector data grid by passing its builder and initial value.

This function adds a new vector data grid. This layer is not advectable, meaning that during the computation of fluid flow, this layer won't follow the flow. For the future access of this layer, its index is returned.

Parameters
[in]builderThe grid builder.
[in]initialValThe initial value.
Returns
Index of the data.

◆ Deserialize()

void CubbyFlow::GridSystemData2::Deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Serialize the data from the given buffer.

Implements CubbyFlow::Serializable.

◆ GetAdvectableScalarDataAt()

const ScalarGrid2Ptr& CubbyFlow::GridSystemData2::GetAdvectableScalarDataAt ( size_t  idx) const

Returns the advectable scalar data at given index.

◆ GetAdvectableVectorDataAt()

const VectorGrid2Ptr& CubbyFlow::GridSystemData2::GetAdvectableVectorDataAt ( size_t  idx) const

Returns the advectable vector data at given index.

◆ GetBoundingBox()

BoundingBox2D CubbyFlow::GridSystemData2::GetBoundingBox ( ) const

Returns the bounding box of the grid.

◆ GetGridSpacing()

Vector2D CubbyFlow::GridSystemData2::GetGridSpacing ( ) const

Return the grid spacing.

◆ GetNumberOfAdvectableScalarData()

size_t CubbyFlow::GridSystemData2::GetNumberOfAdvectableScalarData ( ) const

Returns the number of advectable scalar data.

◆ GetNumberOfAdvectableVectorData()

size_t CubbyFlow::GridSystemData2::GetNumberOfAdvectableVectorData ( ) const

Returns the number of advectable vector data.

◆ GetNumberOfScalarData()

size_t CubbyFlow::GridSystemData2::GetNumberOfScalarData ( ) const

Returns the number of non-advectable scalar data.

◆ GetNumberOfVectorData()

size_t CubbyFlow::GridSystemData2::GetNumberOfVectorData ( ) const

Returns the number of non-advectable vector data.

◆ GetOrigin()

Vector2D CubbyFlow::GridSystemData2::GetOrigin ( ) const

Returns the origin of the grid.

◆ GetResolution()

Size2 CubbyFlow::GridSystemData2::GetResolution ( ) const

Returns the resolution of the grid.

This function resizes the entire grid layers within the system. Note, the resolution is the grid resolution, not the data size of each grid. Depending on the layout of the grid, the data point may lie on different part of the grid (vertex, cell-center, or face-center), thus can have different array size internally. The resolution of the grid means the grid cell resolution.

Returns
Grid cell resolution.

◆ GetScalarDataAt()

const ScalarGrid2Ptr& CubbyFlow::GridSystemData2::GetScalarDataAt ( size_t  idx) const

Returns the non-advectable scalar data at given index.

◆ GetVectorDataAt()

const VectorGrid2Ptr& CubbyFlow::GridSystemData2::GetVectorDataAt ( size_t  idx) const

Returns the non-advectable vector data at given index.

◆ GetVelocity()

const FaceCenteredGrid2Ptr& CubbyFlow::GridSystemData2::GetVelocity ( ) const

Returns the velocity field.

This class has velocity field by default, and it is part of the advectable vector data list.

Returns
Pointer to the velocity field.

◆ GetVelocityIndex()

size_t CubbyFlow::GridSystemData2::GetVelocityIndex ( ) const

Returns the index of the velocity field.

This class has velocity field by default, and it is part of the advectable vector data list. This function returns the index of the velocity field from the list.

Returns
Index of the velocity field.

◆ Resize()

void CubbyFlow::GridSystemData2::Resize ( const Size2 resolution,
const Vector2D gridSpacing,
const Vector2D origin 
)

Resizes the whole system with given resolution, grid spacing, and origin.

This function resizes the entire grid layers within the system. Note, the resolution is the grid resolution, not the data size of each grid. Depending on the layout of the grid, the data point may lie on different part of the grid (vertex, cell-center, or face-center), thus can have different array size internally. The resolution of the grid means the grid cell resolution.

Parameters
[in]resolutionThe resolution.
[in]gridSpacingThe grid spacing.
[in]originThe origin.

◆ Serialize()

void CubbyFlow::GridSystemData2::Serialize ( std::vector< uint8_t > *  buffer) const
overridevirtual

Serialize the data to the given buffer.

Implements CubbyFlow::Serializable.


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