ScalarGrid.hpp
Go to the documentation of this file.
void SwapScalarGrid(ScalarGrid *other)
Swaps the data storage and predefined samplers with given grid.
virtual Vector< size_t, N > DataSize() const =0
Returns the size of the grid data.
std::enable_if_t< M==3, void > ParallelForEachDataPointIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Definition: ScalarGrid.hpp:197
std::enable_if_t< M==2, void > ParallelForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Definition: ScalarGrid.hpp:189
void ParallelForEachDataPointIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each data point in parallel.
void Resize(const Vector< size_t, N > &resolution, const Vector< double, N > &gridSpacing=Vector< double, N >::MakeConstant(1), const Vector< double, N > &origin=Vector< double, N >{}, double initialValue=0.0)
Resizes the grid using given parameters.
double Sample(const Vector< double, N > &x) const override
Returns the sampled value at given position x.
void SetData(const ConstArrayView1< double > &data) override
Sets the data from a continuous linear array.
Abstract base class for N-D scalar grid structure.
Definition: ScalarGrid.hpp:24
const double & operator()(const Vector< size_t, N > &idx) const
Returns the grid data at given data point.
double & operator()(size_t i, Indices... indices)
Returns the grid data at given data point.
Definition: ScalarGrid.hpp:105
double Laplacian(const Vector< double, N > &x) const override
Returns the Laplacian at given position x.
void GetData(Array1< double > &data) const override
Fetches the data into a continuous linear array.
void SetScalarGrid(const ScalarGrid &other)
Sets the data storage and predefined samplers with given grid.
std::shared_ptr< ScalarGrid3 > ScalarGrid3Ptr
Shared pointer for the ScalarGrid3 type.
Definition: ScalarGrid.hpp:269
virtual Vector< double, N > DataOrigin() const =0
Returns the origin of the grid data.
void Fill(double value, ExecutionPolicy policy=ExecutionPolicy::Parallel)
Fills the grid with given value.
ScalarGrid & operator=(const ScalarGrid &other)
Copy assignment operator.
std::function< double(const Vector< double, N > &)> Sampler() const override
Returns the sampler function.
Definition: Matrix.hpp:27
Vector< double, N > Gradient(const Vector< double, N > &x) const override
Returns the gradient vector at given position x.
GridDataPositionFunc< N > DataPosition() const
Returns the function that maps data point to its position.
double LaplacianAtDataPoint(const Vector< size_t, N > &idx) const
Returns the Laplacian at given data point.
Vector< double, N > GradientAtDataPoint(size_t i, Indices... indices) const
Returns the gradient vector at given data point.
Definition: ScalarGrid.hpp:116
Definition: pybind11Utils.hpp:20
Definition: Array-Impl.hpp:19
std::shared_ptr< ScalarGrid2 > ScalarGrid2Ptr
Shared pointer for the ScalarGrid2 type.
Definition: ScalarGrid.hpp:266
std::shared_ptr< ScalarGridBuilder3 > ScalarGridBuilder3Ptr
Shared pointer for the ScalarGridBuilder3 type.
Definition: ScalarGrid.hpp:311
Definition: Grid.hpp:23
void Deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the input buffer to the grid instance.
Abstract base class for N-D scalar grid builder.
Definition: ScalarGrid.hpp:273
void Serialize(std::vector< uint8_t > *buffer) const override
Serializes the grid instance to the output buffer.
std::shared_ptr< ScalarGridBuilder2 > ScalarGridBuilder2Ptr
Shared pointer for the ScalarGridBuilder2 type.
Definition: ScalarGrid.hpp:308
double LaplacianAtDataPoint(size_t i, Indices... indices) const
Returns the Laplacian at given data point.
Definition: ScalarGrid.hpp:128
Vector< double, N > GradientAtDataPoint(const Vector< size_t, N > &idx) const
Returns the gradient vector at given data point.
void ForEachDataPointIndex(const std::function< void(const Vector< size_t, N > &)> &func) const
Invokes the given function func for each data point.
const double & operator()(size_t i, Indices... indices) const
Returns the grid data at given data point.
Definition: ScalarGrid.hpp:98
std::enable_if_t< M==2, void > ForEachDataPointIndex(const std::function< void(size_t, size_t)> &func) const
Definition: ScalarGrid.hpp:161
virtual std::shared_ptr< ScalarGrid > Clone() const =0
Returns the copy of the grid instance.
std::enable_if_t< M==3, void > ForEachDataPointIndex(const std::function< void(size_t, size_t, size_t)> &func) const
Definition: ScalarGrid.hpp:169