Jet  v1.3.3
Public Types | Public Member Functions | Protected Member Functions | List of all members
jet::Grid3 Class Referenceabstract

Abstract base class for 3-D cartesian grid structure. More...

#include <jet/grid3.h>

Inheritance diagram for jet::Grid3:
jet::Serializable jet::ScalarGrid3 jet::VectorGrid3 jet::CellCenteredScalarGrid3 jet::VertexCenteredScalarGrid3 jet::CollocatedVectorGrid3 jet::FaceCenteredGrid3 jet::CellCenteredVectorGrid3 jet::VertexCenteredVectorGrid3

Public Types

typedef std::function< Vector3D(size_t, size_t, size_t)> DataPositionFunc
 Function type for mapping data index to actual position. More...
 

Public Member Functions

 Grid3 ()
 Constructs an empty grid. More...
 
virtual ~Grid3 ()
 Default destructor. More...
 
virtual std::string typeName () const =0
 Returns the type name of derived grid. More...
 
const Size3resolution () const
 Returns the grid resolution. More...
 
const Vector3Dorigin () const
 Returns the grid origin. More...
 
const Vector3DgridSpacing () const
 Returns the grid spacing. More...
 
const BoundingBox3DboundingBox () 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, size_t)> &func) const
 Invokes the given function func for each grid cell. More...
 
void parallelForEachCellIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each grid cell parallelly. More...
 
virtual void serialize (std::vector< uint8_t > *buffer) const =0
 Serializes the grid instance to the output buffer. More...
 
virtual void deserialize (const std::vector< uint8_t > &buffer)=0
 Deserializes the input buffer to the grid instance. More...
 
bool hasSameShape (const Grid3 &other) const
 Returns true if resolution, grid-spacing and origin are same. More...
 
virtual void swap (Grid3 *other)=0
 Swaps the data with other grid. More...
 
- Public Member Functions inherited from jet::Serializable
 Serializable ()=default
 
virtual ~Serializable ()=default
 

Protected Member Functions

void setSizeParameters (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin)
 
void swapGrid (Grid3 *other)
 Swaps the size parameters with given grid other. More...
 
void setGrid (const Grid3 &other)
 Sets the size parameters with given grid other. More...
 
virtual void getData (std::vector< double > *data) const =0
 Fetches the data into a continuous linear array. More...
 
virtual void setData (const std::vector< double > &data)=0
 Sets the data from a continuous linear array. More...
 

Detailed Description

Abstract base class for 3-D cartesian grid structure.

This class represents 3-D cartesian grid structure. This class is an abstract base class and does not store any data. The class only stores the shape of the grid. The grid structure is axis-aligned and can have different grid spacing per axis.

Member Typedef Documentation

◆ DataPositionFunc

typedef std::function<Vector3D(size_t, size_t, size_t)> jet::Grid3::DataPositionFunc

Function type for mapping data index to actual position.

Constructor & Destructor Documentation

◆ Grid3()

jet::Grid3::Grid3 ( )

Constructs an empty grid.

◆ ~Grid3()

virtual jet::Grid3::~Grid3 ( )
virtual

Default destructor.

Member Function Documentation

◆ boundingBox()

const BoundingBox3D& jet::Grid3::boundingBox ( ) const

Returns the bounding box of the grid.

◆ cellCenterPosition()

DataPositionFunc jet::Grid3::cellCenterPosition ( ) const

Returns the function that maps grid index to the cell-center position.

◆ deserialize()

virtual void jet::Grid3::deserialize ( const std::vector< uint8_t > &  buffer)
pure virtual

Deserializes the input buffer to the grid instance.

Implements jet::Serializable.

Implemented in jet::ScalarGrid3, and jet::VectorGrid3.

◆ forEachCellIndex()

void jet::Grid3::forEachCellIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each grid cell.

This function invokes the given function object func for each grid cell in serial manner. The input parameters are i, j, and k indices of a grid cell. The order of execution is i-first, j-next, k-last.

◆ getData()

virtual void jet::Grid3::getData ( std::vector< double > *  data) const
protectedpure virtual

Fetches the data into a continuous linear array.

Implemented in jet::FaceCenteredGrid3, jet::ScalarGrid3, and jet::CollocatedVectorGrid3.

◆ gridSpacing()

const Vector3D& jet::Grid3::gridSpacing ( ) const

Returns the grid spacing.

◆ hasSameShape()

bool jet::Grid3::hasSameShape ( const Grid3 other) const

Returns true if resolution, grid-spacing and origin are same.

◆ origin()

const Vector3D& jet::Grid3::origin ( ) const

Returns the grid origin.

◆ parallelForEachCellIndex()

void jet::Grid3::parallelForEachCellIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each grid cell parallelly.

This function invokes the given function object func for each grid cell in parallel manner. The input parameters are i, j, and k indices of a grid cell. The order of execution can be arbitrary since it's multi-threaded.

◆ resolution()

const Size3& jet::Grid3::resolution ( ) const

Returns the grid resolution.

◆ serialize()

virtual void jet::Grid3::serialize ( std::vector< uint8_t > *  buffer) const
pure virtual

Serializes the grid instance to the output buffer.

Implements jet::Serializable.

Implemented in jet::ScalarGrid3, and jet::VectorGrid3.

◆ setData()

virtual void jet::Grid3::setData ( const std::vector< double > &  data)
protectedpure virtual

Sets the data from a continuous linear array.

Implemented in jet::FaceCenteredGrid3, jet::ScalarGrid3, and jet::CollocatedVectorGrid3.

◆ setGrid()

void jet::Grid3::setGrid ( const Grid3 other)
protected

Sets the size parameters with given grid other.

◆ setSizeParameters()

void jet::Grid3::setSizeParameters ( const Size3 resolution,
const Vector3D gridSpacing,
const Vector3D origin 
)
protected

Sets the size parameters including the resolution, grid spacing, and origin.

◆ swap()

virtual void jet::Grid3::swap ( Grid3 other)
pure virtual

◆ swapGrid()

void jet::Grid3::swapGrid ( Grid3 other)
protected

Swaps the size parameters with given grid other.

◆ typeName()

virtual std::string jet::Grid3::typeName ( ) const
pure virtual

Returns the type name of derived grid.


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