include/pops/coupling/source/coupled_source_program.hpp File ReferenceΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
Generic COUPLED SOURCE interpreter: postfix bytecode evaluated on device (P5 phase 1). More...
#include <pops/core/foundation/types.hpp>#include <pops/mesh/storage/fab2d.hpp>#include <cassert>#include <cmath>
Include dependency graph for coupled_source_program.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | pops::CsProgram |
| Fixed-capacity postfix program (POD device-copyable): len opcodes, arg read only by PushReg (register index). More... | |
| struct | pops::CoupledSourceKernel |
| Device functor applying ONE coupled source over a box: captures the PODs by VALUE (input/output Array4, programs, constants) -> device-clean. More... | |
| struct | pops::CoupledFreqKernel |
Namespaces | |
| namespace | pops |
Enumerations | |
| enum class | pops::CsOp : int { pops::PushReg = 0 , pops::Add = 1 , pops::Sub = 2 , pops::Mul = 3 , pops::Div = 4 , pops::Neg = 5 , pops::Pow = 6 , pops::Sqrt = 7 } |
| Opcodes of the postfix stack machine. More... | |
Variables | |
| constexpr int | pops::kCsMaxReg = 32 |
| constexpr int | pops::kCsMaxStack = 32 |
| constexpr int | pops::kCsMaxProg = 256 |
| constexpr int | pops::kCsMaxTerms = 16 |
Detailed Description
Generic COUPLED SOURCE interpreter: postfix bytecode evaluated on device (P5 phase 1).
For an ARBITRARY coupling described on the Python side (pops.dsl.CoupledSource), we want NEITHER to generate one .so per coupling, NOR one Python callback per cell. So we transport the symbolic expression as postfix (stack) BYTECODE to evaluate inside the SAME for_each_cell device kernel as the named couplings. The bytecode (CsProgram) is a FIXED-CAPACITY POD: capturable by value in a device kernel (like an Array4); the evaluator (CoupledSourceKernel) is a NAMED FUNCTOR (no extended lambda) -> device-clean. Per-cell registers: r[0..n_in-1] = input fields, r[n_in..] = constants. Output writes are ADDITIVE (forward-Euler split). The capacities (kCsMaxReg, kCsMaxStack, kCsMaxProg, kCsMaxTerms) bound the stack/registers; an overflow raises an error on the Python side BEFORE the device.
Generated by