|
| template<typename Fn > |
| void | pfc::field::apply (RealField &field, const World &world, const FFT &fft, Fn &&fn) |
| | Apply a coordinate-space function over a real field (local inbox)
|
| |
| template<typename Fn > |
| void | pfc::field::apply_with_time (RealField &field, const World &world, const FFT &fft, double t, Fn &&fn) |
| | Apply a space-time function over a real field (local inbox)
|
| |
| template<typename Fn > |
| void | pfc::field::apply_inplace (RealField &field, const World &world, const FFT &fft, Fn &&fn) |
| | Apply a coordinate-space function in-place over a real field (local inbox)
|
| |
| template<typename Fn > |
| void | pfc::field::apply_inplace_with_time (RealField &field, const World &world, const FFT &fft, double t, Fn &&fn) |
| | Apply a space-time function in-place over a real field (local inbox)
|
| |
|
template<typename Fn > |
| void | pfc::field::apply_inplace (Model &model, std::string_view field_name, Fn &&fn) |
| | Model overload: apply in-place to a named field.
|
| |
|
template<typename Fn > |
| void | pfc::field::apply_inplace_with_time (Model &model, std::string_view field_name, double t, Fn &&fn) |
| | Model overload: apply in-place with time to a named field.
|
| |
| template<typename Fn > |
| void | pfc::field::apply (Model &model, std::string_view field_name, Fn &&fn) |
| | Apply a coordinate-space function to a named model field (local inbox)
|
| |
|
template<typename Fn > |
| void | pfc::field::apply_with_time (Model &model, std::string_view field_name, double t, Fn &&fn) |
| | Apply a space-time function to a named model field (local inbox)
|
| |
Functional, coordinate-space field operations (header-only)
This header provides zero-overhead, template-based helpers to apply user-defined functions over real-space fields using coordinate-space callbacks. It transparently respects the local MPI inbox via FFT layout and avoids boilerplate nested loops in initial/boundary conditions.
Core goals:
- Work in coordinate space: Fn(Real3) -> double, or Fn(Real3, t)
- Operate over the local inbox only (distributed-memory friendly)
- Header-only, zero-cost abstractions
- Backward compatible: usable directly with Model or raw components
Example:
using namespace pfc;
auto world = world::create(
GridSize({64,64,64}));
auto decomp = decomposition::create(world, 1);
auto fft = fft::create(
decomp);
std::vector<double>
u(fft.size_inbox());
pfc::field::apply(
u, world, fft, [](
const Real3&
x){
const double r2 = (
x[0]*
x[0]) + (
x[1]*
x[1]) + (
x[2]*
x[2]);
return std::exp(-
r2/2.0);
});
Grid dimensions (number of grid points per dimension)
Definition strong_types.hpp:176
Represents the global simulation domain (the "world").
Definition world.hpp:91