Jet  v1.3.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
jet::FaceCenteredGrid3 Class Referencefinal

3-D face-centered (a.k.a MAC or staggered) grid. More...

#include <jet/face_centered_grid3.h>

Inheritance diagram for jet::FaceCenteredGrid3:
jet::VectorGrid3 jet::VectorField3 jet::Grid3 jet::Field3 jet::Serializable

Classes

class  Builder
 Front-end to create CellCenteredScalarGrid3 objects step by step. More...
 

Public Types

typedef ArrayAccessor3< double > ScalarDataAccessor
 Read-write scalar data accessor type. More...
 
typedef ConstArrayAccessor3< double > ConstScalarDataAccessor
 Read-only scalar data accessor type. More...
 
- Public Types inherited from jet::VectorGrid3
typedef ArrayAccessor3< Vector3DVectorDataAccessor
 Read-write array accessor type. More...
 
typedef ConstArrayAccessor3< Vector3DConstVectorDataAccessor
 Read-only array accessor type. More...
 
- Public Types inherited from jet::Grid3
typedef std::function< Vector3D(size_t, size_t, size_t)> DataPositionFunc
 Function type for mapping data index to actual position. More...
 

Public Member Functions

 FaceCenteredGrid3 ()
 Constructs empty grid. More...
 
 FaceCenteredGrid3 (size_t resolutionX, size_t resolutionY, size_t resolutionZ, double gridSpacingX=1.0, double gridSpacingY=1.0, double gridSpacingZ=1.0, double originX=0.0, double originY=0.0, double originZ=0.0, double initialValueU=0.0, double initialValueV=0.0, double initialValueW=0.0)
 Resizes the grid using given parameters. More...
 
 FaceCenteredGrid3 (const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1.0, 1.0, 1.0), const Vector3D &origin=Vector3D(), const Vector3D &initialValue=Vector3D())
 Resizes the grid using given parameters. More...
 
 FaceCenteredGrid3 (const FaceCenteredGrid3 &other)
 Copy constructor. More...
 
void swap (Grid3 *other) override
 Swaps the contents with the given other grid. More...
 
void set (const FaceCenteredGrid3 &other)
 Sets the contents with the given other grid. More...
 
FaceCenteredGrid3operator= (const FaceCenteredGrid3 &other)
 Sets the contents with the given other grid. More...
 
double & u (size_t i, size_t j, size_t k)
 Returns u-value at given data point. More...
 
const double & u (size_t i, size_t j, size_t k) const
 Returns u-value at given data point. More...
 
double & v (size_t i, size_t j, size_t k)
 Returns v-value at given data point. More...
 
const double & v (size_t i, size_t j, size_t k) const
 Returns v-value at given data point. More...
 
double & w (size_t i, size_t j, size_t k)
 Returns w-value at given data point. More...
 
const double & w (size_t i, size_t j, size_t k) const
 Returns w-value at given data point. More...
 
Vector3D valueAtCellCenter (size_t i, size_t j, size_t k) const
 Returns interpolated value at cell center. More...
 
double divergenceAtCellCenter (size_t i, size_t j, size_t k) const
 Returns divergence at cell-center location. More...
 
Vector3D curlAtCellCenter (size_t i, size_t j, size_t k) const
 Returns curl at cell-center location. More...
 
ScalarDataAccessor uAccessor ()
 Returns u data accessor. More...
 
ConstScalarDataAccessor uConstAccessor () const
 Returns read-only u data accessor. More...
 
ScalarDataAccessor vAccessor ()
 Returns v data accessor. More...
 
ConstScalarDataAccessor vConstAccessor () const
 Returns read-only v data accessor. More...
 
ScalarDataAccessor wAccessor ()
 Returns w data accessor. More...
 
ConstScalarDataAccessor wConstAccessor () const
 Returns read-only w data accessor. More...
 
DataPositionFunc uPosition () const
 Returns function object that maps u data point to its actual position. More...
 
DataPositionFunc vPosition () const
 Returns function object that maps v data point to its actual position. More...
 
DataPositionFunc wPosition () const
 Returns function object that maps w data point to its actual position. More...
 
Size3 uSize () const
 Returns data size of the u component. More...
 
Size3 vSize () const
 Returns data size of the v component. More...
 
Size3 wSize () const
 Returns data size of the w component. More...
 
Vector3D uOrigin () const
 Returns u-data position for the grid point at (0, 0, 0). More...
 
Vector3D vOrigin () const
 Returns v-data position for the grid point at (0, 0, 0). More...
 
Vector3D wOrigin () const
 Returns w-data position for the grid point at (0, 0, 0). More...
 
void fill (const Vector3D &value, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
 Fills the grid with given value. More...
 
void fill (const std::function< Vector3D(const Vector3D &)> &func, ExecutionPolicy policy=ExecutionPolicy::kParallel) override
 Fills the grid with given function. More...
 
std::shared_ptr< VectorGrid3clone () const override
 Returns the copy of the grid instance. More...
 
void forEachUIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each u-data point. More...
 
void parallelForEachUIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each u-data point parallelly. More...
 
void forEachVIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each v-data point. More...
 
void parallelForEachVIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each v-data point parallelly. More...
 
void forEachWIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each w-data point. More...
 
void parallelForEachWIndex (const std::function< void(size_t, size_t, size_t)> &func) const
 Invokes the given function func for each w-data point parallelly. More...
 
Vector3D sample (const Vector3D &x) const override
 Returns sampled value at given position x. More...
 
double divergence (const Vector3D &x) const override
 Returns divergence at given position x. More...
 
Vector3D curl (const Vector3D &x) const override
 Returns curl at given position x. More...
 
std::function< Vector3D(const Vector3D &)> sampler () const override
 Returns the sampler function. More...
 
- Public Member Functions inherited from jet::VectorGrid3
 VectorGrid3 ()
 Constructs an empty grid. More...
 
virtual ~VectorGrid3 ()
 Default destructor. More...
 
void clear ()
 Clears the contents of the grid. More...
 
void resize (size_t resolutionX, size_t resolutionY, size_t resolutionZ, double gridSpacingX=1.0, double gridSpacingY=1.0, double gridSpacingZ=1.0, double originX=0.0, double originY=0.0, double originZ=0.0, double initialValueX=0.0, double initialValueY=0.0, double initialValueZ=0.0)
 Resizes the grid using given parameters. More...
 
void resize (const Size3 &resolution, const Vector3D &gridSpacing=Vector3D(1, 1, 1), const Vector3D &origin=Vector3D(), const Vector3D &initialValue=Vector3D())
 Resizes the grid using given parameters. More...
 
void resize (double gridSpacingX, double gridSpacingY, double gridSpacingZ, double originX, double originY, double originZ)
 Resizes the grid using given parameters. More...
 
void resize (const Vector3D &gridSpacing, const Vector3D &origin)
 Resizes the grid using given parameters. More...
 
void serialize (std::vector< uint8_t > *buffer) const override
 Serializes the grid instance to the output buffer. More...
 
void deserialize (const std::vector< uint8_t > &buffer) override
 Deserializes the input buffer to the grid instance. More...
 
- Public Member Functions inherited from jet::VectorField3
 VectorField3 ()
 Default constructor. More...
 
virtual ~VectorField3 ()
 Default destructor. More...
 
- Public Member Functions inherited from jet::Field3
 Field3 ()
 
virtual ~Field3 ()
 
- Public Member Functions inherited from jet::Grid3
 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...
 
bool hasSameShape (const Grid3 &other) const
 Returns true if resolution, grid-spacing and origin are same. More...
 
- Public Member Functions inherited from jet::Serializable
 Serializable ()=default
 
virtual ~Serializable ()=default
 

Static Public Member Functions

static Builder builder ()
 Returns builder fox FaceCenteredGrid3. More...
 

Protected Member Functions

void onResize (const Size3 &resolution, const Vector3D &gridSpacing, const Vector3D &origin, const Vector3D &initialValue) final
 Invoked when the resizing happens. More...
 
void getData (std::vector< double > *data) const override
 Fetches the data into a continuous linear array. More...
 
void setData (const std::vector< double > &data) override
 Sets the data from a continuous linear array. More...
 
- Protected Member Functions inherited from jet::Grid3
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...
 

Detailed Description

3-D face-centered (a.k.a MAC or staggered) grid.

This class implements face-centered grid which is also known as marker-and-cell (MAC) or staggered grid. This vector grid stores each vector component at face center. Thus, u, v, and w components are not collocated.

Member Typedef Documentation

◆ ConstScalarDataAccessor

Read-only scalar data accessor type.

◆ ScalarDataAccessor

Read-write scalar data accessor type.

Constructor & Destructor Documentation

◆ FaceCenteredGrid3() [1/4]

jet::FaceCenteredGrid3::FaceCenteredGrid3 ( )

Constructs empty grid.

◆ FaceCenteredGrid3() [2/4]

jet::FaceCenteredGrid3::FaceCenteredGrid3 ( size_t  resolutionX,
size_t  resolutionY,
size_t  resolutionZ,
double  gridSpacingX = 1.0,
double  gridSpacingY = 1.0,
double  gridSpacingZ = 1.0,
double  originX = 0.0,
double  originY = 0.0,
double  originZ = 0.0,
double  initialValueU = 0.0,
double  initialValueV = 0.0,
double  initialValueW = 0.0 
)

Resizes the grid using given parameters.

◆ FaceCenteredGrid3() [3/4]

jet::FaceCenteredGrid3::FaceCenteredGrid3 ( const Size3 resolution,
const Vector3D gridSpacing = Vector3D(1.0, 1.0, 1.0),
const Vector3D origin = Vector3D(),
const Vector3D initialValue = Vector3D() 
)

Resizes the grid using given parameters.

◆ FaceCenteredGrid3() [4/4]

jet::FaceCenteredGrid3::FaceCenteredGrid3 ( const FaceCenteredGrid3 other)

Copy constructor.

Member Function Documentation

◆ builder()

static Builder jet::FaceCenteredGrid3::builder ( )
static

Returns builder fox FaceCenteredGrid3.

◆ clone()

std::shared_ptr<VectorGrid3> jet::FaceCenteredGrid3::clone ( ) const
overridevirtual

Returns the copy of the grid instance.

Implements jet::VectorGrid3.

◆ curl()

Vector3D jet::FaceCenteredGrid3::curl ( const Vector3D x) const
overridevirtual

Returns curl at given position x.

Reimplemented from jet::VectorField3.

◆ curlAtCellCenter()

Vector3D jet::FaceCenteredGrid3::curlAtCellCenter ( size_t  i,
size_t  j,
size_t  k 
) const

Returns curl at cell-center location.

◆ divergence()

double jet::FaceCenteredGrid3::divergence ( const Vector3D x) const
overridevirtual

Returns divergence at given position x.

Reimplemented from jet::VectorField3.

◆ divergenceAtCellCenter()

double jet::FaceCenteredGrid3::divergenceAtCellCenter ( size_t  i,
size_t  j,
size_t  k 
) const

Returns divergence at cell-center location.

◆ fill() [1/2]

void jet::FaceCenteredGrid3::fill ( const std::function< Vector3D(const Vector3D &)> &  func,
ExecutionPolicy  policy = ExecutionPolicy::kParallel 
)
overridevirtual

Fills the grid with given function.

Implements jet::VectorGrid3.

◆ fill() [2/2]

void jet::FaceCenteredGrid3::fill ( const Vector3D value,
ExecutionPolicy  policy = ExecutionPolicy::kParallel 
)
overridevirtual

Fills the grid with given value.

Implements jet::VectorGrid3.

◆ forEachUIndex()

void jet::FaceCenteredGrid3::forEachUIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each u-data point.

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

◆ forEachVIndex()

void jet::FaceCenteredGrid3::forEachVIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each v-data point.

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

◆ forEachWIndex()

void jet::FaceCenteredGrid3::forEachWIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each w-data point.

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

◆ getData()

void jet::FaceCenteredGrid3::getData ( std::vector< double > *  data) const
overrideprotectedvirtual

Fetches the data into a continuous linear array.

Implements jet::Grid3.

◆ onResize()

void jet::FaceCenteredGrid3::onResize ( const Size3 resolution,
const Vector3D gridSpacing,
const Vector3D origin,
const Vector3D initialValue 
)
finalprotectedvirtual

Invoked when the resizing happens.

This callback function is called when the grid gets resized. The overriding class should allocate the internal storage based on its data layout scheme.

Implements jet::VectorGrid3.

◆ operator=()

FaceCenteredGrid3& jet::FaceCenteredGrid3::operator= ( const FaceCenteredGrid3 other)

Sets the contents with the given other grid.

◆ parallelForEachUIndex()

void jet::FaceCenteredGrid3::parallelForEachUIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each u-data point parallelly.

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

◆ parallelForEachVIndex()

void jet::FaceCenteredGrid3::parallelForEachVIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each v-data point parallelly.

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

◆ parallelForEachWIndex()

void jet::FaceCenteredGrid3::parallelForEachWIndex ( const std::function< void(size_t, size_t, size_t)> &  func) const

Invokes the given function func for each w-data point parallelly.

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

◆ sample()

Vector3D jet::FaceCenteredGrid3::sample ( const Vector3D x) const
overridevirtual

Returns sampled value at given position x.

Implements jet::VectorField3.

◆ sampler()

std::function<Vector3D(const Vector3D&)> jet::FaceCenteredGrid3::sampler ( ) const
overridevirtual

Returns the sampler function.

This function returns the data sampler function object. The sampling function is linear.

Reimplemented from jet::VectorField3.

◆ set()

void jet::FaceCenteredGrid3::set ( const FaceCenteredGrid3 other)

Sets the contents with the given other grid.

◆ setData()

void jet::FaceCenteredGrid3::setData ( const std::vector< double > &  data)
overrideprotectedvirtual

Sets the data from a continuous linear array.

Implements jet::Grid3.

◆ swap()

void jet::FaceCenteredGrid3::swap ( Grid3 other)
overridevirtual

Swaps the contents with the given other grid.

This function swaps the contents of the grid instance with the given grid object other only if other has the same type with this grid.

Implements jet::Grid3.

◆ u() [1/2]

double& jet::FaceCenteredGrid3::u ( size_t  i,
size_t  j,
size_t  k 
)

Returns u-value at given data point.

◆ u() [2/2]

const double& jet::FaceCenteredGrid3::u ( size_t  i,
size_t  j,
size_t  k 
) const

Returns u-value at given data point.

◆ uAccessor()

ScalarDataAccessor jet::FaceCenteredGrid3::uAccessor ( )

Returns u data accessor.

◆ uConstAccessor()

ConstScalarDataAccessor jet::FaceCenteredGrid3::uConstAccessor ( ) const

Returns read-only u data accessor.

◆ uOrigin()

Vector3D jet::FaceCenteredGrid3::uOrigin ( ) const

Returns u-data position for the grid point at (0, 0, 0).

Note that this is different from origin() since origin() returns the lower corner point of the bounding box.

◆ uPosition()

DataPositionFunc jet::FaceCenteredGrid3::uPosition ( ) const

Returns function object that maps u data point to its actual position.

◆ uSize()

Size3 jet::FaceCenteredGrid3::uSize ( ) const

Returns data size of the u component.

◆ v() [1/2]

double& jet::FaceCenteredGrid3::v ( size_t  i,
size_t  j,
size_t  k 
)

Returns v-value at given data point.

◆ v() [2/2]

const double& jet::FaceCenteredGrid3::v ( size_t  i,
size_t  j,
size_t  k 
) const

Returns v-value at given data point.

◆ vAccessor()

ScalarDataAccessor jet::FaceCenteredGrid3::vAccessor ( )

Returns v data accessor.

◆ valueAtCellCenter()

Vector3D jet::FaceCenteredGrid3::valueAtCellCenter ( size_t  i,
size_t  j,
size_t  k 
) const

Returns interpolated value at cell center.

◆ vConstAccessor()

ConstScalarDataAccessor jet::FaceCenteredGrid3::vConstAccessor ( ) const

Returns read-only v data accessor.

◆ vOrigin()

Vector3D jet::FaceCenteredGrid3::vOrigin ( ) const

Returns v-data position for the grid point at (0, 0, 0).

Note that this is different from origin() since origin() returns the lower corner point of the bounding box.

◆ vPosition()

DataPositionFunc jet::FaceCenteredGrid3::vPosition ( ) const

Returns function object that maps v data point to its actual position.

◆ vSize()

Size3 jet::FaceCenteredGrid3::vSize ( ) const

Returns data size of the v component.

◆ w() [1/2]

double& jet::FaceCenteredGrid3::w ( size_t  i,
size_t  j,
size_t  k 
)

Returns w-value at given data point.

◆ w() [2/2]

const double& jet::FaceCenteredGrid3::w ( size_t  i,
size_t  j,
size_t  k 
) const

Returns w-value at given data point.

◆ wAccessor()

ScalarDataAccessor jet::FaceCenteredGrid3::wAccessor ( )

Returns w data accessor.

◆ wConstAccessor()

ConstScalarDataAccessor jet::FaceCenteredGrid3::wConstAccessor ( ) const

Returns read-only w data accessor.

◆ wOrigin()

Vector3D jet::FaceCenteredGrid3::wOrigin ( ) const

Returns w-data position for the grid point at (0, 0, 0).

Note that this is different from origin() since origin() returns the lower corner point of the bounding box.

◆ wPosition()

DataPositionFunc jet::FaceCenteredGrid3::wPosition ( ) const

Returns function object that maps w data point to its actual position.

◆ wSize()

Size3 jet::FaceCenteredGrid3::wSize ( ) const

Returns data size of the w component.


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