Jet
v1.3.3
|
2-D grid system data. More...
#include <jet/grid_system_data2.h>
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 FaceCenteredGrid2Ptr & | velocity () const |
Returns the velocity field. More... | |
size_t | velocityIndex () const |
Returns the index of the velocity field. More... | |
const ScalarGrid2Ptr & | scalarDataAt (size_t idx) const |
Returns the non-advectable scalar data at given index. More... | |
const VectorGrid2Ptr & | vectorDataAt (size_t idx) const |
Returns the non-advectable vector data at given index. More... | |
const ScalarGrid2Ptr & | advectableScalarDataAt (size_t idx) const |
Returns the advectable scalar data at given index. More... | |
const VectorGrid2Ptr & | 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... | |
![]() | |
Serializable ()=default | |
virtual | ~Serializable ()=default |
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.
jet::GridSystemData2::GridSystemData2 | ( | ) |
Constructs empty grid system.
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.
[in] | resolution | The resolution. |
[in] | gridSpacing | The grid spacing. |
[in] | origin | The origin. |
jet::GridSystemData2::GridSystemData2 | ( | const GridSystemData2 & | other | ) |
Copy constructor.
|
virtual |
Destructor.
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.
[in] | builder | The grid builder. |
[in] | initialVal | The initial value. |
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.
[in] | builder | The grid builder. |
[in] | initialVal | The initial value. |
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.
[in] | builder | The grid builder. |
[in] | initialVal | The initial value. |
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.
[in] | builder | The grid builder. |
[in] | initialVal | The initial value. |
const ScalarGrid2Ptr& jet::GridSystemData2::advectableScalarDataAt | ( | size_t | idx | ) | const |
Returns the advectable scalar data at given index.
const VectorGrid2Ptr& jet::GridSystemData2::advectableVectorDataAt | ( | size_t | idx | ) | const |
Returns the advectable vector data at given index.
BoundingBox2D jet::GridSystemData2::boundingBox | ( | ) | const |
Returns the bounding box of the grid.
|
overridevirtual |
Serialize the data from the given buffer.
Implements jet::Serializable.
Vector2D jet::GridSystemData2::gridSpacing | ( | ) | const |
Return the grid spacing.
size_t jet::GridSystemData2::numberOfAdvectableScalarData | ( | ) | const |
Returns the number of advectable scalar data.
size_t jet::GridSystemData2::numberOfAdvectableVectorData | ( | ) | const |
Returns the number of advectable vector data.
size_t jet::GridSystemData2::numberOfScalarData | ( | ) | const |
Returns the number of non-advectable scalar data.
size_t jet::GridSystemData2::numberOfVectorData | ( | ) | const |
Returns the number of non-advectable vector data.
Vector2D jet::GridSystemData2::origin | ( | ) | const |
Returns the origin of the grid.
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.
[in] | resolution | The resolution. |
[in] | gridSpacing | The grid spacing. |
[in] | origin | The origin. |
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.
const ScalarGrid2Ptr& jet::GridSystemData2::scalarDataAt | ( | size_t | idx | ) | const |
Returns the non-advectable scalar data at given index.
|
overridevirtual |
Serialize the data to the given buffer.
Implements jet::Serializable.
const VectorGrid2Ptr& jet::GridSystemData2::vectorDataAt | ( | size_t | idx | ) | const |
Returns the non-advectable vector data at given index.
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.
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.