Examples catalog¶
Executables are built when OpenPFC_BUILD_EXAMPLES=ON (default). Output directory is typically <build>/examples/ (exact path depends on the CMake generator and multi-config toolchains).
Prerequisites: Most examples need MPI and a working HeFFTe-linked OpenPFC build. Run with at least mpirun -n 1 unless the source states otherwise.
This page is for lookup and for choosing the next small executable to read. If you want a guided first run, use ../start_here_15_minutes.md. If you want the examples in a teaching sequence with more context, use ../tutorials/spectral_examples_sequence.md. The catalog below stays compact so it can answer “what is this target for?” without becoming another tutorial.
Curriculum (suggested order)¶
Use the first tier on your first day, then branch by topic. The names are numbered because the source files are intended to be read in roughly that order, not because every user must run every target.
flowchart LR
subgraph t1 [Tier 1 — core stack]
A[02_domain_decomposition]
B[03_parallel_fft]
C[05_simulator]
D[12_cahn_hilliard]
end
subgraph t2 [Tier 2 — App / I/O / IC]
E[10_ui_register_ic]
F[11_write_results]
G[14_custom_field_initializer]
end
subgraph t3 [Tier 3 — fields and space]
H[15_finite_difference_heat]
I[17_custom_coordinate_system]
J[18_sobel_edge_detection]
end
subgraph t4 [Tier 4 — stepping and tools]
K[19_explicit_stepper_fd]
L[20_explicit_stepper_spectral]
M[fft_backend_benchmark]
end
A --> B --> C --> D
D --> E
D --> F
E --> G
D --> H --> J
D --> I
H --> K
D --> L
C --> M
Tier |
Executables |
Focus |
|---|---|---|
1 — Core stack |
|
|
2 — Wiring |
|
Registration, writers, custom initial conditions |
3 — Fields and space |
|
Halos, coordinate interpretation, stencil-like field operations |
4 — Stepping and tools |
|
Explicit steppers, backend comparison, profiling |
Narrative companion: getting_started/01-basics/README.md. Ordered source examples: api_examples_walkthrough.md.
Full catalog¶
Executable |
Source |
What it demonstrates |
|---|---|---|
|
|
FFT backend benchmarking |
|
|
|
|
|
Distributed FFT (HeFFTe) |
|
|
Simple spectral diffusion |
|
|
|
|
|
Multi-index utilities |
|
|
Array helpers |
|
|
Discrete field types |
|
|
Higher-level FFT usage |
|
|
UI and field-modifier registration patterns |
|
|
Writing simulation results |
|
|
Cahn–Hilliard-style spectral workflow |
|
|
k-space helper functions |
|
|
MPI worker pattern |
|
|
MPI worker encapsulated in a class |
|
|
MPI timing |
|
|
Profiling and timer reporting |
|
|
Time-stepping utilities |
|
|
Results I/O variant |
|
|
Diffusion with a custom initial condition |
|
|
Standalone nlohmann JSON read; does not link OpenPFC |
|
|
|
|
|
Custom field initializer |
|
|
Finite-difference heat with separated halos; see |
|
|
Strongly typed domain inputs |
|
|
Custom coordinate setup |
|
|
Sobel-style field operations and edge detection |
|
|
Strong types with |
|
|
Explicit stepping with finite-difference operators |
|
|
Explicit stepping with spectral operators |
Sources not built by default¶
examples/01_hello_world/world.cpp is used as a tutorial source; the matching add_executable in examples/CMakeLists.txt is commented out. Other .cpp files may exist under examples/ without a CMake target—check examples/CMakeLists.txt for the authoritative list.
See also¶
quickstart.md— suggested order for the first runsgetting_started/01-basics/README.md— narrative tutorialapi_examples_walkthrough.md—docs/api/examples/in reading ordertutorials/README.md— VTK, HeFFTeplan_options, spectral sequence, and other guided workflows