fields (for FFT operations)
using Complex = std::complex<double>;
{64, 64, 33},
{0, 0, 0},
{0.0, 0.0, 0.0},
{1.0, 1.0, 1.0}
);
kspace_field.apply([](double kx, double ky, double kz) {
double k2 = kx*kx + ky*ky + kz*kz;
return Complex(std::exp(-k2/10.0), 0.0);
});
Represents the global simulation domain (the "world").
Definition world.hpp:91
Performance Considerations:
- Direct data access via get_data() for maximum performance
- apply() has iterator overhead but ensures coordinate correctness
- Nearest-neighbor interpolation is O(1)
- Coordinate transformations are cheap (simple arithmetic)
Memory Layout:
- Underlying storage is std::vector<T> (contiguous, cache-friendly)
- Row-major order (last index varies fastest)
- Compatible with MPI subdomain data
Common Use Cases:
- Initial condition setup with coordinate-space functions
- Post-processing and analysis with interpolation
- Coordinate-aware field manipulation
- Testing and validation (analytical comparisons)
- Note
- Geometry (origin, discretization, bounds) is immutable after construction
-
Only nearest-neighbor interpolation supported (no linear/cubic)
-
For MPI subdomains, use offset parameter to specify global position
- Warning
- interpolate() returns reference - ensure coordinate is in bounds! Use inbounds() first if uncertain
- See also
- Array<T,D> for underlying storage
-
MultiIndex<D> for index iteration
-
world.hpp for coordinate system abstraction
-
Model::get_real_field() for integration with simulation fields