num::scalar_field_3d¶
Defined in header <fields/field3d.hpp>
class scalar_field_3d;
Scalar field on a uniform 3D grid: \(\phi_{ijk}\).
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) |
Construct a zero field on an nx x ny x nz grid with spacing dx and origin \((o_x, o_y, o_z)\). |
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) |
Construct a field from the values f(i, j, k). |
const grid_3d &grid() const |
Return the grid. |
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) |
Set every value: \(\phi_{ijk} \leftarrow v\). |
template <typename F> void fill(F &&f) |
Set the values from a function: \(\phi_{ijk} \leftarrow f(i, j, k)\). |
vec<real> &as_vec() |
Return the values as a vector, in grid 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 |
Interpolate the field trilinearly: \(\phi(x, y, z)\). |