59inline void apply(RealField &field,
const World &world,
const FFT &fft,
Fn &&
fn) {
60 const auto inbox = pfc::fft::get_inbox(fft);
67 throw std::invalid_argument(
68 "field::apply: field size does not match FFT inbox size");
75 const pfc::Int3
idx{
i,
j,
k};
76 const auto x = pfc::world::to_coords(world,
idx);
96 const auto inbox = pfc::fft::get_inbox(fft);
102 throw std::invalid_argument(
103 "field::apply_with_time: field size does not match FFT inbox size");
110 const pfc::Int3
idx{
i,
j,
k};
111 const auto x = pfc::world::to_coords(world,
idx);
131template <
typename Fn>
134 const auto inbox = pfc::fft::get_inbox(fft);
140 throw std::invalid_argument(
141 "field::apply_inplace: field size does not match FFT inbox size");
148 const pfc::Int3
idx{
i,
j,
k};
149 const auto x = pfc::world::to_coords(world,
idx);
162template <
typename Fn>
164 const FFT &fft,
double t,
Fn &&
fn) {
165 const auto inbox = pfc::fft::get_inbox(fft);
171 throw std::invalid_argument(
172 "field::apply_inplace_with_time: field size does not match FFT inbox size");
179 const pfc::Int3
idx{
i,
j,
k};
180 const auto x = pfc::world::to_coords(world,
idx);
191template <
typename Fn>
200template <
typename Fn>
205 std::forward<Fn>(
fn));
213template <
typename Fn>
216 apply(
f,
model.get_world(),
model.get_fft(), std::forward<Fn>(
fn));
222template <
typename Fn>
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
Fast Fourier Transform interface for spectral methods.
Physics model abstraction for phase-field simulations.
void 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)
Definition operations.hpp:94
void 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)
Definition operations.hpp:132
void 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)
Definition operations.hpp:163
FFT class for distributed-memory parallel Fourier transforms.
Definition fft.hpp:248
Represents the global simulation domain (the "world").
Definition world.hpp:91
Common type aliases used throughout OpenPFC.
World class definition and unified interface.