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

Abstract base class for 2-D vector grid structure. More...

#include <jet/vector_grid2.h>

Inheritance diagram for jet::VectorGrid2:
jet::VectorField2 jet::Grid2 jet::Field2 jet::Serializable jet::CollocatedVectorGrid2 jet::FaceCenteredGrid2 jet::CellCenteredVectorGrid2 jet::VertexCenteredVectorGrid2

Public Types

typedef ArrayAccessor2< Vector2DVectorDataAccessor
 Read-write array accessor type. More...
 
typedef ConstArrayAccessor2< Vector2DConstVectorDataAccessor
 Read-only array accessor type. More...
 
- Public Types inherited from jet::Grid2
typedef std::function< Vector2D(size_t, size_t)> DataPositionFunc
 Function type for mapping data index to actual position. More...
 

Public Member Functions

 VectorGrid2 ()
 Constructs an empty grid. More...
 
virtual ~VectorGrid2 ()
 Default destructor. More...
 
void clear ()
 Clears the contents of the grid. More...
 
void resize (size_t resolutionX, size_t resolutionY, double gridSpacingX=1.0, double gridSpacingY=1.0, double originX=0.0, double originY=0.0, double initialValueX=0.0, double initialValueY=0.0)
 Resizes the grid using given parameters. More...
 
void resize (const Size2 &resolution, const Vector2D &gridSpacing=Vector2D(1, 1), const Vector2D &origin=Vector2D(), const Vector2D &initialValue=Vector2D())
 Resizes the grid using given parameters. More...
 
void resize (double gridSpacingX, double gridSpacingY, double originX, double originY)
 Resizes the grid using given parameters. More...
 
void resize (const Vector2D &gridSpacing, const Vector2D &origin)
 Resizes the grid using given parameters. More...
 
virtual void fill (const Vector2D &value, ExecutionPolicy policy=ExecutionPolicy::kParallel)=0
 Fills the grid with given value. More...
 
virtual void fill (const std::function< Vector2D(const Vector2D &)> &func, ExecutionPolicy policy=ExecutionPolicy::kParallel)=0
 Fills the grid with given position-to-value mapping function. More...
 
virtual std::shared_ptr< VectorGrid2clone () const =0
 Returns the copy of the grid instance. 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::VectorField2
 VectorField2 ()
 Default constructor. More...
 
virtual ~VectorField2 ()
 Default destructor. More...
 
virtual Vector2D sample (const Vector2D &x) const =0
 Returns sampled value at given position x. More...
 
virtual double divergence (const Vector2D &x) const
 Returns divergence at given position x. More...
 
virtual double curl (const Vector2D &x) const
 Returns curl at given position x. More...
 
virtual std::function< Vector2D(const Vector2D &)> sampler () const
 Returns sampler function object. More...
 
- Public Member Functions inherited from jet::Field2
 Field2 ()
 
virtual ~Field2 ()
 
- Public Member Functions inherited from jet::Grid2
 Grid2 ()
 Constructs an empty grid. More...
 
virtual ~Grid2 ()
 Default destructor. More...
 
virtual std::string typeName () const =0
 Returns the type name of derived grid. More...
 
const Size2resolution () const
 Returns the grid resolution. More...
 
const Vector2Dorigin () const
 Returns the grid origin. More...
 
const Vector2DgridSpacing () const
 Returns the grid spacing. More...
 
const BoundingBox2DboundingBox () 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)> &func) const
 Invokes the given function func for each grid cell. More...
 
void parallelForEachCellIndex (const std::function< void(size_t, size_t)> &func) const
 Invokes the given function func for each grid cell parallelly. More...
 
bool hasSameShape (const Grid2 &other) const
 Returns true if resolution, grid-spacing and origin are same. More...
 
virtual void swap (Grid2 *other)=0
 Swaps the data with other grid. More...
 
- Public Member Functions inherited from jet::Serializable
 Serializable ()=default
 
virtual ~Serializable ()=default
 

Protected Member Functions

virtual void onResize (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin, const Vector2D &initialValue)=0
 Invoked when the resizing happens. More...
 
- Protected Member Functions inherited from jet::Grid2
void setSizeParameters (const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &origin)
 
void swapGrid (Grid2 *other)
 Swaps the size parameters with given grid other. More...
 
void setGrid (const Grid2 &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 2-D vector grid structure.

Member Typedef Documentation

◆ ConstVectorDataAccessor

Read-only array accessor type.

◆ VectorDataAccessor

Read-write array accessor type.

Constructor & Destructor Documentation

◆ VectorGrid2()

jet::VectorGrid2::VectorGrid2 ( )

Constructs an empty grid.

◆ ~VectorGrid2()

virtual jet::VectorGrid2::~VectorGrid2 ( )
virtual

Default destructor.

Member Function Documentation

◆ clear()

void jet::VectorGrid2::clear ( )

Clears the contents of the grid.

◆ clone()

virtual std::shared_ptr<VectorGrid2> jet::VectorGrid2::clone ( ) const
pure virtual

Returns the copy of the grid instance.

Implemented in jet::FaceCenteredGrid2, jet::CellCenteredVectorGrid2, and jet::VertexCenteredVectorGrid2.

◆ deserialize()

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

Deserializes the input buffer to the grid instance.

Implements jet::Serializable.

◆ fill() [1/2]

virtual void jet::VectorGrid2::fill ( const std::function< Vector2D(const Vector2D &)> &  func,
ExecutionPolicy  policy = ExecutionPolicy::kParallel 
)
pure virtual

Fills the grid with given position-to-value mapping function.

Implemented in jet::FaceCenteredGrid2, jet::CellCenteredVectorGrid2, and jet::VertexCenteredVectorGrid2.

◆ fill() [2/2]

virtual void jet::VectorGrid2::fill ( const Vector2D value,
ExecutionPolicy  policy = ExecutionPolicy::kParallel 
)
pure virtual

Fills the grid with given value.

Implemented in jet::FaceCenteredGrid2, jet::CellCenteredVectorGrid2, and jet::VertexCenteredVectorGrid2.

◆ onResize()

virtual void jet::VectorGrid2::onResize ( const Size2 resolution,
const Vector2D gridSpacing,
const Vector2D origin,
const Vector2D initialValue 
)
protectedpure virtual

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.

Implemented in jet::FaceCenteredGrid2.

◆ resize() [1/4]

void jet::VectorGrid2::resize ( const Size2 resolution,
const Vector2D gridSpacing = Vector2D(1, 1),
const Vector2D origin = Vector2D(),
const Vector2D initialValue = Vector2D() 
)

Resizes the grid using given parameters.

◆ resize() [2/4]

void jet::VectorGrid2::resize ( const Vector2D gridSpacing,
const Vector2D origin 
)

Resizes the grid using given parameters.

◆ resize() [3/4]

void jet::VectorGrid2::resize ( double  gridSpacingX,
double  gridSpacingY,
double  originX,
double  originY 
)

Resizes the grid using given parameters.

◆ resize() [4/4]

void jet::VectorGrid2::resize ( size_t  resolutionX,
size_t  resolutionY,
double  gridSpacingX = 1.0,
double  gridSpacingY = 1.0,
double  originX = 0.0,
double  originY = 0.0,
double  initialValueX = 0.0,
double  initialValueY = 0.0 
)

Resizes the grid using given parameters.

◆ serialize()

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

Serializes the grid instance to the output buffer.

Implements jet::Serializable.


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