native_loader Namespace ReferenceΒΆ

adc_cpp: pops::native_loader Namespace 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::native_loader Namespace Reference

Classes

struct  BlockMeta
 OPTIONAL metadata read by dlsym on a generated .so (names / roles / gamma). More...
 

Functions

template<class Impl >
std::vector< double > marshal_aux_halo (Impl *P, int naux)
 ADC-369: marshal the aux for a COMPILED block – the naux valid components (component-major, like copy_state) PLUS an APPEND-ONLY tail of 2*naux doubles: (type, value) per component, carrying the per-field halo policy that make_grid applies to that component's physical-face ghosts.
 
POPS_HD double limited_slope (double am, double ap, int recon)
 MUSCL limited slope of a cell from backward difference am and forward ap.
 
template<int NV>
std::vector< double > host_residual (const IModel< NV > &m, const std::vector< double > &U, const std::vector< double > &AUX, int n, double dx, int recon)
 Host residual R = -div F* + S(U, aux) (Rusanov, GLOBAL a_max like pops.PythonFlux, periodic) computed via an IModel: serves the DYNAMIC block (model loaded at runtime, virtual dispatch, off GPU).
 
std::vector< std::string > split (const std::string &s, char sep)
 Split s on sep (empty fields kept).
 
VariableSet parse_var_set (VariableKind kind, const std::string &names_csv, const std::string &roles_csv)
 Builds a VariableSet from the CSV names / roles (parallel to names; EMPTY roles = not provided -> VariableSet without roles, index fallback on the coupling side).
 
BlockMeta read_block_meta (pops::dynlib::handle h)
 Reads (by dlsym, all OPTIONAL) the metadata symbols of an already-open .so (h).
 
template<typename ImplT , int NV>
void push_dynamic (ImplT *P, const std::string &name, pops::dynlib::handle h, int substeps, std::vector< std::string > names, int recon)
 Builds a DYNAMIC block (IModel<NV> model loaded from the .so h) and adds it.
 
template<typename ImplT >
void add_dynamic_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, int substeps, const std::vector< std::string > &names, const std::string &recon)
 Body of System::add_dynamic_block. VERBATIM; self = the calling System, P = self->p_.get().
 
template<typename ImplT >
void add_compiled_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, const std::string &limiter, const std::string &riemann, const std::string &recon, const std::string &time, int substeps, const std::vector< std::string > &names, double pos_floor=0)
 Body of System::add_compiled_block. VERBATIM; self = the calling System, P = self->p_.get().
 
template<typename ImplT >
void add_native_block (System *self, ImplT *P, const std::string &name, const std::string &so_path, const std::string &limiter, const std::string &riemann, const std::string &recon, const std::string &time, double gamma, int substeps, bool evolve, int stride, double pos_floor=0)
 Body of System::add_native_block.
 

Function Documentation

◆ add_compiled_block()

template<typename ImplT >
void pops::native_loader::add_compiled_block ( System self,
ImplT *  P,
const std::string &  name,
const std::string &  so_path,
const std::string &  limiter,
const std::string &  riemann,
const std::string &  recon,
const std::string &  time,
int  substeps,
const std::vector< std::string > &  names,
double  pos_floor = 0 
)

Body of System::add_compiled_block. VERBATIM; self = the calling System, P = self->p_.get().

+ Here is the call graph for this function:

◆ add_dynamic_block()

template<typename ImplT >
void pops::native_loader::add_dynamic_block ( System self,
ImplT *  P,
const std::string &  name,
const std::string &  so_path,
int  substeps,
const std::vector< std::string > &  names,
const std::string &  recon 
)

Body of System::add_dynamic_block. VERBATIM; self = the calling System, P = self->p_.get().

+ Here is the call graph for this function:

◆ add_native_block()

template<typename ImplT >
void pops::native_loader::add_native_block ( System self,
ImplT *  P,
const std::string &  name,
const std::string &  so_path,
const std::string &  limiter,
const std::string &  riemann,
const std::string &  recon,
const std::string &  time,
double  gamma,
int  substeps,
bool  evolve,
int  stride,
double  pos_floor = 0 
)

Body of System::add_native_block.

VERBATIM; self = the calling System (and the this marshaled to the native loader), P = self->p_.get().

+ Here is the call graph for this function:

◆ host_residual()

template<int NV>
std::vector< double > pops::native_loader::host_residual ( const IModel< NV > &  m,
const std::vector< double > &  U,
const std::vector< double > &  AUX,
int  n,
double  dx,
int  recon 
)

Host residual R = -div F* + S(U, aux) (Rusanov, GLOBAL a_max like pops.PythonFlux, periodic) computed via an IModel: serves the DYNAMIC block (model loaded at runtime, virtual dispatch, off GPU).

recon = MUSCL reconstruction order of the face states on the conservative variables (cf. limited_slope). The flux AND the source receive the per-cell aux (phi, grad phi): a coupled model (ExB transport, force) works, not only Euler. AUX is the system aux (>= 3 comp phi/grad_x/grad_y, component-major; empty => zero). U and the return in component-major layout (c*n*n + j*n + i).

+ Here is the call graph for this function:

◆ limited_slope()

POPS_HD double pops::native_loader::limited_slope ( double  am,
double  ap,
int  recon 
)
inline

MUSCL limited slope of a cell from backward difference am and forward ap.

POPS_HD (device-callable, without std::). recon: 0 = order 1 (zero slope), 1 = minmod (TVD), 2 = van Leer. Pointwise building block of the host residual host_residual; host counterpart of the compiled limiter (reconstruction.hpp).

+ Here is the caller graph for this function:

◆ marshal_aux_halo()

template<class Impl >
std::vector< double > pops::native_loader::marshal_aux_halo ( Impl *  P,
int  naux 
)
inline

ADC-369: marshal the aux for a COMPILED block – the naux valid components (component-major, like copy_state) PLUS an APPEND-ONLY tail of 2*naux doubles: (type, value) per component, carrying the per-field halo policy that make_grid applies to that component's physical-face ghosts.

The tail is all-zero (no override) by default -> the .so applies the shared aux BC, bit-identical. The tail offset (naux*nn) matches make_grid's read (it is told the same naux). The header signature (abi_key) bumps when this contract changes, so an old .so is never mixed with a tail-carrying array.

+ Here is the caller graph for this function:

◆ parse_var_set()

VariableSet pops::native_loader::parse_var_set ( VariableKind  kind,
const std::string &  names_csv,
const std::string &  roles_csv 
)
inline

Builds a VariableSet from the CSV names / roles (parallel to names; EMPTY roles = not provided -> VariableSet without roles, index fallback on the coupling side).

names_csv empty -> empty set.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_dynamic()

template<typename ImplT , int NV>
void pops::native_loader::push_dynamic ( ImplT *  P,
const std::string &  name,
pops::dynlib::handle  h,
int  substeps,
std::vector< std::string >  names,
int  recon 
)

Builds a DYNAMIC block (IModel<NV> model loaded from the .so h) and adds it.

The shared_ptr owns the model: it calls pops_destroy_model then closes the .so on destruction. VERBATIM from the old Impl::push_dynamic; ImplT is System::Impl (instantiated on the system.cpp side).

+ Here is the call graph for this function:

◆ read_block_meta()

BlockMeta pops::native_loader::read_block_meta ( pops::dynlib::handle  h)
inline

Reads (by dlsym, all OPTIONAL) the metadata symbols of an already-open .so (h).

Returns deserialized names+roles and gamma if present. Absent symbols leave the fields empty / has_gamma=false: the caller then decides the fallback. String format: "cons_csv|prim_csv".

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ split()

std::vector< std::string > pops::native_loader::split ( const std::string &  s,
char  sep 
)
inline

Split s on sep (empty fields kept).

Parsing block for the TEXT metadata transported by the .so ABI (names / roles in CSV).

+ Here is the caller graph for this function: