![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
Example: Custom field initialization patterns. More...

Classes | |
| struct | my_project::VortexPattern |
| Lamb-Oseen vortex pattern. More... | |
| struct | my_project::GaussianBump |
| 3D Gaussian bump More... | |
| struct | my_project::CheckerboardPattern |
| 3D checkerboard pattern More... | |
Namespaces | |
| namespace | my_project |
Functions | |
| double | evaluate_vortex (const my_project::VortexPattern &pattern, const Real3 &pos) |
| Evaluate vortex pattern at given position. | |
| double | evaluate_gaussian (const my_project::GaussianBump &pattern, const Real3 &pos) |
| Evaluate Gaussian bump at given position. | |
| double | evaluate_checkerboard (const my_project::CheckerboardPattern &pattern, const Real3 &pos) |
| Evaluate checkerboard at given position. | |
| void | example_vortex_pattern () |
| void | example_gaussian_bump () |
| void | example_checkerboard () |
| int | main () |
Variables | |
| constexpr double | M_PI = 3.14159265358979323846 |
Example: Custom field initialization patterns.
This example demonstrates how to create custom field initialization patterns using simple structs and evaluation functions. We show three physical patterns:
Instead of inheritance hierarchies, we use simple structs with public data. This follows OpenPFC's "structs + free functions" philosophy.
For full integration with DiscreteField/World APIs using ADL, see:
This simplified example focuses on the pattern concept itself.
| double evaluate_checkerboard | ( | const my_project::CheckerboardPattern & | pattern, |
| const Real3 & | pos | ||
| ) |
Evaluate checkerboard at given position.
| pattern | The checkerboard configuration |
| pos | Physical position to evaluate at |
| double evaluate_gaussian | ( | const my_project::GaussianBump & | pattern, |
| const Real3 & | pos | ||
| ) |
| double evaluate_vortex | ( | const my_project::VortexPattern & | pattern, |
| const Real3 & | pos | ||
| ) |
Evaluate vortex pattern at given position.
| pattern | The vortex configuration |
| pos | Physical position to evaluate at |