ScalarGrid2.h
Go to the documentation of this file.
106 void Fill(const std::function<double(const Vector2D&)>& func, ExecutionPolicy policy = ExecutionPolicy::Parallel);
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the grid instance to the output buffer.
2-D read-only array accessor class.
Definition: ArrayAccessor2.h:261
void SetData(const std::vector< double > &data) override
Sets the data from a continuous linear array.
void ParallelForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each data point in parallel.
virtual Size2 GetDataSize() const =0
Returns the size of the grid data.
void ForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Invokes the given function func for each data point.
Abstract base class for 2-D scalar grid builder.
Definition: ScalarGrid2.h:182
std::function< double(const Vector2D &)> Sampler() const override
Returns the sampler function.
virtual std::shared_ptr< ScalarGrid2 > Clone() const =0
Returns the copy of the grid instance.
double LaplacianAtDataPoint(size_t i, size_t j) const
Returns the Laplacian at given data point.
void GetData(std::vector< double > *data) const override
Fetches the data into a continuous linear array.
double Sample(const Vector2D &x) const override
Returns the sampled value at given position x.
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 initialValue=0.0)
Resizes the grid using given parameters.
Vector2D GradientAtDataPoint(size_t i, size_t j) const
Returns the gradient vector at given data point.
Definition: pybind11Utils.h:24
std::shared_ptr< ScalarGrid2 > ScalarGrid2Ptr
Shared pointer for the ScalarGrid2 type.
Definition: ScalarGrid2.h:179
void SwapScalarGrid(ScalarGrid2 *other)
Swaps the data storage and predefined samplers with given grid.
virtual ScalarGrid2Ptr Build(const Size2 &resolution, const Vector2D &gridSpacing, const Vector2D &gridOrigin, double initialVal) const =0
Returns 2-D scalar grid with given parameters.
virtual Vector2D GetDataOrigin() const =0
Returns the origin of the grid data.
const double & operator()(size_t i, size_t j) const
Returns the grid data at given data point.
Vector2D Gradient(const Vector2D &x) const override
Returns the gradient vector at given position x.
double Laplacian(const Vector2D &x) const override
Returns the Laplacian at given position x.
DataPositionFunc GetDataPosition() const
Returns the function that maps data point to its position.
std::shared_ptr< ScalarGridBuilder2 > ScalarGridBuilder2Ptr
Shared pointer for the ScalarGridBuilder2 type.
Definition: ScalarGrid2.h:200
void Fill(double value, ExecutionPolicy policy=ExecutionPolicy::Parallel)
Fills the grid with given value.
ScalarDataAccessor GetDataAccessor()
Returns the read-write data array accessor.
void SetScalarGrid(const ScalarGrid2 &other)
Sets the data storage and predefined samplers with given grid.
2-D linear array sampler class.
Definition: ArraySamplers2.h:78
Abstract base class for 2-D scalar grid structure.
Definition: ScalarGrid2.h:21
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the input buffer to the grid instance.
std::function< Vector2D(size_t, size_t)> DataPositionFunc
Function type for mapping data index to actual position.
Definition: Grid2.h:34
ConstScalarDataAccessor GetConstDataAccessor() const
Returns the read-only data array accessor.