OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
Functional

initialization (multiple overloads)

pfc::DiscreteField<double, 3> field({64, 64, 64}, {0,0,0},
{0.0,0.0,0.0}, {1.0,1.0,1.0});
// 3D function: f(x, y, z)
field.apply([](double x, double y, double z) {
return std::sin(x) * std::cos(y);
});
// 2D function (for 2D fields): f(x, y)
pfc::DiscreteField<double, 2> field2d({64, 64}, {0,0},
{0.0,0.0}, {1.0,1.0});
field2d.apply([](double x, double y) {
return std::exp(-(x*x + y*y)/100.0);
});
// 1D function: f(x) - uses first coordinate only
field.apply([](double x) {
return std::tanh(x - 32.0);
});
// N-D function: f(std::array<double, D>)
field.apply([](std::array<double, 3> coords) {
return coords[0] + 2.0*coords[1] + 3.0*coords[2];
});
Represents the global simulation domain (the "world").
Definition world.hpp:91