N-D grid system data. More...
#include <Core/Grid/GridSystemData.hpp>
Public Member Functions | |
GridSystemData () | |
Constructs empty grid system. More... | |
GridSystemData (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &origin) | |
Constructs a grid system with given resolution, grid spacing and origin. More... | |
~GridSystemData () override=default | |
Default virtual destructor. More... | |
GridSystemData (const GridSystemData &other) | |
Copy constructor. More... | |
GridSystemData (GridSystemData &&other) noexcept | |
Move constructor. More... | |
GridSystemData & | operator= (const GridSystemData &other) |
Copy assignment operator. More... | |
GridSystemData & | operator= (GridSystemData &&other) noexcept |
Move assignment operator. More... | |
void | Resize (const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing, const Vector< double, N > &origin) |
Resizes the whole system with given resolution, grid spacing, and origin. More... | |
Vector< size_t, N > | Resolution () const |
Returns the resolution of the grid. More... | |
Vector< double, N > | GridSpacing () const |
Return the grid spacing. More... | |
Vector< double, N > | Origin () const |
Returns the origin of the grid. More... | |
BoundingBox< double, N > | GetBoundingBox () const |
Returns the bounding box of the grid. More... | |
size_t | AddScalarData (const std::shared_ptr< ScalarGridBuilder< N >> &builder, double initialVal=0.0) |
Adds a non-advectable scalar data grid by passing its builder and initial value. More... | |
size_t | AddVectorData (const std::shared_ptr< VectorGridBuilder< N >> &builder, const Vector< double, N > &initialVal=Vector< double, N >{}) |
Adds a non-advectable vector data grid by passing its builder and initial value. More... | |
size_t | AddAdvectableScalarData (const std::shared_ptr< ScalarGridBuilder< N >> &builder, double initialVal=0.0) |
Adds an advectable scalar data grid by passing its builder and initial value. More... | |
size_t | AddAdvectableVectorData (const std::shared_ptr< VectorGridBuilder< N >> &builder, const Vector< double, N > &initialVal=Vector< double, N >{}) |
Adds an advectable vector data grid by passing its builder and initial value. More... | |
const std::shared_ptr< FaceCenteredGrid< N > > & | Velocity () const |
Returns the velocity field. More... | |
size_t | VelocityIndex () const |
Returns the index of the velocity field. More... | |
const std::shared_ptr< ScalarGrid< N > > & | ScalarDataAt (size_t idx) const |
Returns the non-advectable scalar data at given index. More... | |
const std::shared_ptr< VectorGrid< N > > & | VectorDataAt (size_t idx) const |
Returns the non-advectable vector data at given index. More... | |
const std::shared_ptr< ScalarGrid< N > > & | AdvectableScalarDataAt (size_t idx) const |
Returns the advectable scalar data at given index. More... | |
const std::shared_ptr< VectorGrid< N > > & | AdvectableVectorDataAt (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 CubbyFlow::Serializable | |
Serializable ()=default | |
Default constructor. More... | |
Serializable (const Serializable &)=default | |
Default copy constructor. More... | |
Serializable (Serializable &&) noexcept=default | |
Default move constructor. More... | |
virtual | ~Serializable ()=default |
Default virtual destructor. More... | |
Serializable & | operator= (const Serializable &)=default |
Default copy assignment operator. More... | |
Serializable & | operator= (Serializable &&) noexcept=default |
Default move assignment operator. More... | |
Detailed Description
template<size_t N>
class CubbyFlow::GridSystemData< N >
N-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
◆ GridSystemData() [1/4]
CubbyFlow::GridSystemData< N >::GridSystemData | ( | ) |
Constructs empty grid system.
◆ GridSystemData() [2/4]
CubbyFlow::GridSystemData< N >::GridSystemData | ( | const Vector< size_t, N > & | resolution, |
const Vector< double, N > & | gridSpacing, | ||
const Vector< double, N > & | 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] resolution The resolution. [in] gridSpacing The grid spacing. [in] origin The origin.
◆ ~GridSystemData()
|
overridedefault |
Default virtual destructor.
◆ GridSystemData() [3/4]
CubbyFlow::GridSystemData< N >::GridSystemData | ( | const GridSystemData< N > & | other | ) |
Copy constructor.
◆ GridSystemData() [4/4]
|
noexcept |
Move constructor.
Member Function Documentation
◆ AddAdvectableScalarData()
size_t CubbyFlow::GridSystemData< N >::AddAdvectableScalarData | ( | const std::shared_ptr< ScalarGridBuilder< N >> & | 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] builder The grid builder. [in] initialVal The initial value.
- Returns
- Index of the data.
◆ AddAdvectableVectorData()
size_t CubbyFlow::GridSystemData< N >::AddAdvectableVectorData | ( | const std::shared_ptr< VectorGridBuilder< N >> & | builder, |
const Vector< double, N > & | initialVal = Vector< double, N >{} |
||
) |
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] builder The grid builder. [in] initialVal The initial value.
- Returns
- Index of the data.
◆ AddScalarData()
size_t CubbyFlow::GridSystemData< N >::AddScalarData | ( | const std::shared_ptr< ScalarGridBuilder< N >> & | 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] builder The grid builder. [in] initialVal The initial value.
- Returns
- Index of the data.
◆ AddVectorData()
size_t CubbyFlow::GridSystemData< N >::AddVectorData | ( | const std::shared_ptr< VectorGridBuilder< N >> & | builder, |
const Vector< double, N > & | initialVal = Vector< double, N >{} |
||
) |
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] builder The grid builder. [in] initialVal The initial value.
- Returns
- Index of the data.
◆ AdvectableScalarDataAt()
const std::shared_ptr<ScalarGrid<N> >& CubbyFlow::GridSystemData< N >::AdvectableScalarDataAt | ( | size_t | idx | ) | const |
Returns the advectable scalar data at given index.
◆ AdvectableVectorDataAt()
const std::shared_ptr<VectorGrid<N> >& CubbyFlow::GridSystemData< N >::AdvectableVectorDataAt | ( | size_t | idx | ) | const |
Returns the advectable vector data at given index.
◆ Deserialize()
|
overridevirtual |
Serialize the data from the given buffer.
Implements CubbyFlow::Serializable.
◆ GetBoundingBox()
BoundingBox<double, N> CubbyFlow::GridSystemData< N >::GetBoundingBox | ( | ) | const |
Returns the bounding box of the grid.
◆ GridSpacing()
Vector<double, N> CubbyFlow::GridSystemData< N >::GridSpacing | ( | ) | const |
Return the grid spacing.
◆ NumberOfAdvectableScalarData()
size_t CubbyFlow::GridSystemData< N >::NumberOfAdvectableScalarData | ( | ) | const |
Returns the number of advectable scalar data.
◆ NumberOfAdvectableVectorData()
size_t CubbyFlow::GridSystemData< N >::NumberOfAdvectableVectorData | ( | ) | const |
Returns the number of advectable vector data.
◆ NumberOfScalarData()
size_t CubbyFlow::GridSystemData< N >::NumberOfScalarData | ( | ) | const |
Returns the number of non-advectable scalar data.
◆ NumberOfVectorData()
size_t CubbyFlow::GridSystemData< N >::NumberOfVectorData | ( | ) | const |
Returns the number of non-advectable vector data.
◆ operator=() [1/2]
GridSystemData& CubbyFlow::GridSystemData< N >::operator= | ( | const GridSystemData< N > & | other | ) |
Copy assignment operator.
◆ operator=() [2/2]
|
noexcept |
Move assignment operator.
◆ Origin()
Vector<double, N> CubbyFlow::GridSystemData< N >::Origin | ( | ) | const |
Returns the origin of the grid.
◆ Resize()
void CubbyFlow::GridSystemData< N >::Resize | ( | const Vector< size_t, N > & | resolution, |
const Vector< double, N > & | gridSpacing, | ||
const Vector< double, N > & | 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] resolution The resolution. [in] gridSpacing The grid spacing. [in] origin The origin.
◆ Resolution()
Vector<size_t, N> CubbyFlow::GridSystemData< N >::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 std::shared_ptr<ScalarGrid<N> >& CubbyFlow::GridSystemData< N >::ScalarDataAt | ( | size_t | idx | ) | const |
Returns the non-advectable scalar data at given index.
◆ Serialize()
|
overridevirtual |
Serialize the data to the given buffer.
Implements CubbyFlow::Serializable.
◆ VectorDataAt()
const std::shared_ptr<VectorGrid<N> >& CubbyFlow::GridSystemData< N >::VectorDataAt | ( | size_t | idx | ) | const |
Returns the non-advectable vector data at given index.
◆ Velocity()
const std::shared_ptr<FaceCenteredGrid<N> >& CubbyFlow::GridSystemData< N >::Velocity | ( | ) | 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.
◆ VelocityIndex()
size_t CubbyFlow::GridSystemData< N >::VelocityIndex | ( | ) | 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.
The documentation for this class was generated from the following file:
- Core/Grid/GridSystemData.hpp