CsProgram Struct ReferenceΒΆ

adc_cpp: pops::CsProgram Struct 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
pops::CsProgram Struct Reference

Fixed-capacity postfix program (POD device-copyable): len opcodes, arg read only by PushReg (register index). More...

#include <coupled_source_program.hpp>

+ Collaboration diagram for pops::CsProgram:

Public Member Functions

POPS_HD Real eval (const Real *reg) const
 Evaluate the program on the registers reg (loaded for the cell).
 

Public Attributes

int len = 0
 
int op [kCsMaxProg] = {}
 
int arg [kCsMaxProg] = {}
 

Detailed Description

Fixed-capacity postfix program (POD device-copyable): len opcodes, arg read only by PushReg (register index).

Capturable by value in a device kernel.

Member Function Documentation

◆ eval()

POPS_HD Real pops::CsProgram::eval ( const Real reg) const
inline

Evaluate the program on the registers reg (loaded for the cell).

LOCAL fixed-capacity stack, no heap -> POPS_HD device-callable. PRECONDITION: well-formed program (checked on the Python side); returns the final top, or Real(0) if the stack is empty.

DEFENSIVE stack bounds (program assumed well-formed on the Python side, but we never read out of bounds on device): a PushReg pushes only if sp < kCsMaxStack (bounded overflow); a binary (resp. unary) operator requires sp >= 2 (resp. >= 1) before popping, otherwise it is skipped (bounded underflow, no st[sp<0] access). In debug, an assert flags the ill-formed program.

+ Here is the caller graph for this function:

Member Data Documentation

◆ arg

int pops::CsProgram::arg[kCsMaxProg] = {}

◆ len

int pops::CsProgram::len = 0

◆ op

int pops::CsProgram::op[kCsMaxProg] = {}

The documentation for this struct was generated from the following file: