68 : mpages(
std::move(g.mpages)),
69 mrows(
std::move(g.mrows)),
70 mcols(
std::move(g.mcols)),
71 data(
std::move(g.data)) {}
84 const base&
init = base())
88 data(cols * rows * pages,
init) {}
100 base&
operator()(
size_t page = 0,
size_t row = 0,
size_t col = 0) {
101 return data[col + row * mcols + page * mrows *
mcols];
116 size_t page = 0)
const {
117 return data[col + row * mcols + page * mrows *
mcols];
134 const GridPos& row = {0, {0, 1}},
135 const GridPos& col = {0, {0, 1}})
const {
136 const size_t pos[8] = {
137 col.
idx + 0 + (row.
idx + 0) * mcols + (page.idx + 0) * mrows *
mcols,
138 col.
idx + 1 + (row.
idx + 0) * mcols + (page.idx + 0) * mrows *
mcols,
139 col.
idx + 0 + (row.
idx + 1) * mcols + (page.idx + 0) * mrows *
mcols,
140 col.
idx + 1 + (row.
idx + 1) * mcols + (page.idx + 0) * mrows *
mcols,
141 col.
idx + 0 + (row.
idx + 0) * mcols + (page.idx + 1) * mrows *
mcols,
142 col.
idx + 1 + (row.
idx + 0) * mcols + (page.idx + 1) * mrows *
mcols,
143 col.
idx + 0 + (row.
idx + 1) * mcols + (page.idx + 1) * mrows *
mcols,
144 col.
idx + 1 + (row.
idx + 1) * mcols + (page.idx + 1) * mrows * mcols};
146 const Numeric w[8] = {page.fd[1] * row.
fd[1] * col.
fd[1],
147 page.fd[1] * row.
fd[1] * col.
fd[0],
148 page.fd[1] * row.
fd[0] * col.
fd[1],
149 page.fd[1] * row.
fd[0] * col.
fd[0],
150 page.fd[0] * row.
fd[1] * col.
fd[1],
151 page.fd[0] * row.
fd[1] * col.
fd[0],
152 page.fd[0] * row.
fd[0] * col.
fd[1],
153 page.fd[0] * row.
fd[0] * col.
fd[0]};
155 bool any_base =
false;
157 for (
size_t i = 0;
i < 8;
i++) {
160 out += w[
i] * data[pos[
i]];
162 out = w[
i] * data[pos[
i]];
180 template <
class base>
181 inline std::ostream& operator<<(std::ostream& os, const Field3D<base>& v) {
182 for (
size_t i = 0;
i < v.npages();
i++)
183 for (
size_t j = 0; j < v.nrows(); j++)
184 for (
size_t k = 0; k < v.ncols(); k++) os << v(
i, j, k) <<
'\n';
188 #endif // FIELD_HEADER
Field3D(Field3D &&g)
Construct a new Field3D object.
base & operator()(size_t page=0, size_t row=0, size_t col=0)
Access operator.
size_t nrows() const
Number of rows.
size_t ncols() const
Number of columns.
Creates a 3D field of a base unit.
cmplx FADDEEVA() w(cmplx z, double relerr)
Header file for interpolation.cc.
base operator()(const GridPos &page={0, {0, 1}}, const GridPos &row={0, {0, 1}}, const GridPos &col={0, {0, 1}}) const
Weighted access operator by GridPos.
Structure to store a grid position.
Field3D(const Field3D &g)=default
Construct a new Field3D object.
NUMERIC Numeric
The type to use for all floating point numbers.
size_t npages() const
Number of pages.
Workspace & init(Workspace &ws)
Field3D< base > & operator=(const Field3D &g)=default
Default assignment operator.
const base & operator()(size_t col=0, size_t row=0, size_t page=0) const
Access operator.
Field3D(size_t pages=0, size_t rows=0, size_t cols=0, const base &init=base())
Construct a new Field 3 D object.