Jet
v1.3.3
|
2-D Vertex-centered vector grid structure. More...
#include <jet/vertex_centered_vector_grid2.h>
Classes | |
class | Builder |
A grid builder class that returns 2-D vertex-centered vector grid. More... | |
Public Member Functions | |
VertexCenteredVectorGrid2 () | |
Constructs zero-sized grid. More... | |
VertexCenteredVectorGrid2 (size_t resolutionX, size_t resolutionY, double gridSpacingX=1.0, double gridSpacingY=1.0, double originX=0.0, double originY=0.0, double initialValueU=0.0, double initialValueV=0.0) | |
VertexCenteredVectorGrid2 (const Size2 &resolution, const Vector2D &gridSpacing=Vector2D(1.0, 1.0), const Vector2D &origin=Vector2D(), const Vector2D &initialValue=Vector2D()) | |
VertexCenteredVectorGrid2 (const VertexCenteredVectorGrid2 &other) | |
Copy constructor. More... | |
Size2 | dataSize () const override |
Returns the actual data point size. More... | |
Vector2D | dataOrigin () const override |
void | swap (Grid2 *other) override |
Swaps the contents with the given other grid. More... | |
void | set (const VertexCenteredVectorGrid2 &other) |
Sets the contents with the given other grid. More... | |
VertexCenteredVectorGrid2 & | operator= (const VertexCenteredVectorGrid2 &other) |
Sets the contents with the given other grid. More... | |
void | fill (const Vector2D &value, ExecutionPolicy policy=ExecutionPolicy::kParallel) override |
Fills the grid with given value. More... | |
void | fill (const std::function< Vector2D(const Vector2D &)> &func, ExecutionPolicy policy=ExecutionPolicy::kParallel) override |
Fills the grid with given function. More... | |
std::shared_ptr< VectorGrid2 > | clone () const override |
Returns the copy of the grid instance. More... | |
![]() | |
CollocatedVectorGrid2 () | |
Constructs an empty grid. More... | |
virtual | ~CollocatedVectorGrid2 () |
Default destructor. More... | |
const Vector2D & | operator() (size_t i, size_t j) const |
Returns the grid data at given data point. More... | |
Vector2D & | operator() (size_t i, size_t j) |
Returns the grid data at given data point. More... | |
double | divergenceAtDataPoint (size_t i, size_t j) const |
Returns divergence at data point location. More... | |
double | curlAtDataPoint (size_t i, size_t j) const |
Returns curl at data point location. More... | |
VectorDataAccessor | dataAccessor () |
Returns the read-write data array accessor. More... | |
ConstVectorDataAccessor | constDataAccessor () const |
Returns the read-only data array accessor. More... | |
DataPositionFunc | dataPosition () const |
Returns the function that maps data point to its position. More... | |
void | forEachDataPointIndex (const std::function< void(size_t, size_t)> &func) const |
Invokes the given function func for each data point. More... | |
void | parallelForEachDataPointIndex (const std::function< void(size_t, size_t)> &func) const |
Invokes the given function func for each data point parallelly. More... | |
Vector2D | sample (const Vector2D &x) const override |
Returns sampled value at given position x . More... | |
double | divergence (const Vector2D &x) const override |
Returns divergence at given position x . More... | |
double | curl (const Vector2D &x) const override |
Returns curl at given position x . More... | |
std::function< Vector2D(const Vector2D &)> | sampler () const override |
Returns the sampler function. More... | |
![]() | |
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... | |
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... | |
![]() | |
VectorField2 () | |
Default constructor. More... | |
virtual | ~VectorField2 () |
Default destructor. More... | |
![]() | |
Field2 () | |
virtual | ~Field2 () |
![]() | |
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 Size2 & | resolution () const |
Returns the grid resolution. More... | |
const Vector2D & | origin () const |
Returns the grid origin. More... | |
const Vector2D & | gridSpacing () const |
Returns the grid spacing. More... | |
const BoundingBox2D & | boundingBox () 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... | |
![]() | |
Serializable ()=default | |
virtual | ~Serializable ()=default |
Static Public Member Functions | |
static Builder | builder () |
Returns builder fox VertexCenteredVectorGrid2. More... | |
Additional Inherited Members | |
![]() | |
typedef ArrayAccessor2< Vector2D > | VectorDataAccessor |
Read-write array accessor type. More... | |
typedef ConstArrayAccessor2< Vector2D > | ConstVectorDataAccessor |
Read-only array accessor type. More... | |
![]() | |
typedef std::function< Vector2D(size_t, size_t)> | DataPositionFunc |
Function type for mapping data index to actual position. More... | |
![]() | |
void | swapCollocatedVectorGrid (CollocatedVectorGrid2 *other) |
Swaps the data storage and predefined samplers with given grid. More... | |
void | setCollocatedVectorGrid (const CollocatedVectorGrid2 &other) |
Sets the data storage and predefined samplers with given grid. 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... | |
![]() | |
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... | |
2-D Vertex-centered vector grid structure.
This class represents 2-D vertex-centered vector grid which extends CollocatedVectorGrid2. As its name suggests, the class defines the data point at the grid vertices (corners). Thus, A x B grid resolution will have (A+1) x (B+1) data points.
jet::VertexCenteredVectorGrid2::VertexCenteredVectorGrid2 | ( | ) |
Constructs zero-sized grid.
jet::VertexCenteredVectorGrid2::VertexCenteredVectorGrid2 | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
double | gridSpacingX = 1.0 , |
||
double | gridSpacingY = 1.0 , |
||
double | originX = 0.0 , |
||
double | originY = 0.0 , |
||
double | initialValueU = 0.0 , |
||
double | initialValueV = 0.0 |
||
) |
Constructs a grid with given resolution, grid spacing, origin and initial value.
jet::VertexCenteredVectorGrid2::VertexCenteredVectorGrid2 | ( | const Size2 & | resolution, |
const Vector2D & | gridSpacing = Vector2D(1.0, 1.0) , |
||
const Vector2D & | origin = Vector2D() , |
||
const Vector2D & | initialValue = Vector2D() |
||
) |
Constructs a grid with given resolution, grid spacing, origin and initial value.
jet::VertexCenteredVectorGrid2::VertexCenteredVectorGrid2 | ( | const VertexCenteredVectorGrid2 & | other | ) |
Copy constructor.
|
static |
Returns builder fox VertexCenteredVectorGrid2.
|
overridevirtual |
Returns the copy of the grid instance.
Implements jet::VectorGrid2.
|
overridevirtual |
Returns data position for the grid point at (0, 0). Note that this is different from origin() since origin() returns the lower corner point of the bounding box.
Implements jet::CollocatedVectorGrid2.
|
overridevirtual |
Returns the actual data point size.
Implements jet::CollocatedVectorGrid2.
|
overridevirtual |
Fills the grid with given function.
Implements jet::VectorGrid2.
|
overridevirtual |
Fills the grid with given value.
Implements jet::VectorGrid2.
VertexCenteredVectorGrid2& jet::VertexCenteredVectorGrid2::operator= | ( | const VertexCenteredVectorGrid2 & | other | ) |
Sets the contents with the given other
grid.
void jet::VertexCenteredVectorGrid2::set | ( | const VertexCenteredVectorGrid2 & | other | ) |
Sets the contents with the given other
grid.
|
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::Grid2.