![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
Demonstrates k-space helper functions eliminating code duplication. More...
#include <cmath>#include <iostream>#include <openpfc/constants.hpp>#include <openpfc/core/world.hpp>#include <openpfc/fft/kspace.hpp>#include <vector>
Functions | |
| void | example_old_way () |
| void | example_new_way () |
| void | example_benefits () |
| void | example_higher_order_operators () |
| int | main () |
Demonstrates k-space helper functions eliminating code duplication.
This example shows the before-and-after comparison of using the new k-space helper functions. The same ~30 lines of k-space calculation code was duplicated across 4+ examples (04_diffusion_model.cpp, 12_cahn_hilliard.cpp, etc.), totaling 120+ lines of duplicated code.
The new helpers eliminate this duplication while maintaining identical computational results (zero-cost abstraction).