Jet  v1.3.3
Public Member Functions | List of all members
jet::GridSystemData2 Class Reference

2-D grid system data. More...

#include <jet/grid_system_data2.h>

Inheritance diagram for jet::GridSystemData2:
jet::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 resolution () const
 Returns the resolution of the grid. More...
 
Vector2D gridSpacing () const
 Return the grid spacing. More...
 
Vector2D origin () const
 Returns the origin of the grid. More...
 
BoundingBox2D boundingBox () 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 FaceCenteredGrid2Ptrvelocity () const
 Returns the velocity field. More...
 
size_t velocityIndex () const
 Returns the index of the velocity field. More...
 
const ScalarGrid2PtrscalarDataAt (size_t idx) const
 Returns the non-advectable scalar data at given index. More...
 
const VectorGrid2PtrvectorDataAt (size_t idx) const
 Returns the non-advectable vector data at given index. More...
 
const ScalarGrid2PtradvectableScalarDataAt (size_t idx) const
 Returns the advectable scalar data at given index. More...
 
const VectorGrid2PtradvectableVectorDataAt (size_t idx) const
 Returns the advectable vector data at given index. More...
 
size_t numberOfScalarData () const
 Returns the number of non-advectable scalar data. More...
 
size_t numberOfVectorData () const
 Returns the number of non-advectable vector data. More...
 
size_t numberOfAdvectableScalarData () const
 Returns the number of advectable scalar data. More...
 
size_t numberOfAdvectableVectorData () 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...
 
- Public Member Functions inherited from jet::Serializable
 Serializable ()=default
 
virtual ~Serializable ()=default
 

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]

jet::GridSystemData2::GridSystemData2 ( )

Constructs empty grid system.

◆ GridSystemData2() [2/3]

jet::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]

jet::GridSystemData2::GridSystemData2 ( const GridSystemData2 other)

Copy constructor.

◆ ~GridSystemData2()

virtual jet::GridSystemData2::~GridSystemData2 ( )
virtual

Destructor.

Member Function Documentation

◆ addAdvectableScalarData()

size_t jet::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 jet::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 jet::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 jet::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.

◆ advectableScalarDataAt()

const ScalarGrid2Ptr& jet::GridSystemData2::advectableScalarDataAt ( size_t  idx) const

Returns the advectable scalar data at given index.

◆ advectableVectorDataAt()

const VectorGrid2Ptr& jet::GridSystemData2::advectableVectorDataAt ( size_t  idx) const

Returns the advectable vector data at given index.

◆ boundingBox()

BoundingBox2D jet::GridSystemData2::boundingBox ( ) const

Returns the bounding box of the grid.

◆ deserialize()

void jet::GridSystemData2::deserialize ( const std::vector< uint8_t > &  buffer)
overridevirtual

Serialize the data from the given buffer.

Implements jet::Serializable.

◆ gridSpacing()

Vector2D jet::GridSystemData2::gridSpacing ( ) const

Return the grid spacing.

◆ numberOfAdvectableScalarData()

size_t jet::GridSystemData2::numberOfAdvectableScalarData ( ) const

Returns the number of advectable scalar data.

◆ numberOfAdvectableVectorData()

size_t jet::GridSystemData2::numberOfAdvectableVectorData ( ) const

Returns the number of advectable vector data.

◆ numberOfScalarData()

size_t jet::GridSystemData2::numberOfScalarData ( ) const

Returns the number of non-advectable scalar data.

◆ numberOfVectorData()

size_t jet::GridSystemData2::numberOfVectorData ( ) const

Returns the number of non-advectable vector data.

◆ origin()

Vector2D jet::GridSystemData2::origin ( ) const

Returns the origin of the grid.

◆ resize()

void jet::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.

◆ resolution()

Size2 jet::GridSystemData2::resolution ( ) 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.

◆ scalarDataAt()

const ScalarGrid2Ptr& jet::GridSystemData2::scalarDataAt ( size_t  idx) const

Returns the non-advectable scalar data at given index.

◆ serialize()

void jet::GridSystemData2::serialize ( std::vector< uint8_t > *  buffer) const
overridevirtual

Serialize the data to the given buffer.

Implements jet::Serializable.

◆ vectorDataAt()

const VectorGrid2Ptr& jet::GridSystemData2::vectorDataAt ( size_t  idx) const

Returns the non-advectable vector data at given index.

◆ velocity()

const FaceCenteredGrid2Ptr& jet::GridSystemData2::velocity ( ) const

Returns the velocity field.

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

Returns
Pointer to the velocity field.

◆ velocityIndex()

size_t jet::GridSystemData2::velocityIndex ( ) const

Returns the index of the velocity field.

This class has velocify 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.

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