Skip to content

num::scalar_field_3d

Defined in header <fields/field3d.hpp>

class scalar_field_3d;

scalar values stored on a uniform Cartesian grid.

Members

member description
scalar_field_3d(int nx, int ny, int nz, float dx, float ox = 0.0f, float oy = 0.0f, float oz = 0.0f) Allocate a zero-filled field with optional physical origin.
template <typename F> scalar_field_3d(int nx, int ny, int nz, float dx, F &&f, float ox = 0.0f, float oy = 0.0f, float oz = 0.0f) Sample f(i,j,k) at every grid node during construction.
const grid_3d &grid() const Return the field geometry.
int nx() const
int ny() const
int nz() const
float dx() const
float ox() const
float oy() const
float oz() const
real &operator()(int i, int j, int k)
real operator()(int i, int j, int k) const
void set(int i, int j, int k, double v)
void fill(double v) Fill every node with a constant value.
template <typename F> void fill(F &&f) Fill every node with f(i, j, k).
vec<real> &as_vec() Access the contiguous values in grid flattening order.
const vec<real> &as_vec() const
real *data()
const real *data() const
idx size() const
float sample(float x, float y, float z) const Trilinearly interpolate the field at physical coordinates.