include/pops/runtime/dynamic/dynamic_model.hpp File ReferenceΒΆ

adc_cpp: include/pops/runtime/dynamic/dynamic_model.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
dynamic_model.hpp File Reference

TYPE-ERASED model interface: runtime dispatch of a model (via vtable). More...

+ Include dependency graph for dynamic_model.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pops::IModel< NV >
 Hyperbolic model seen behind a virtual interface (runtime dispatch). More...
 
struct  pops::ModelAdapter< M >
 Adapts a STATIC model M into IModel<M::n_vars>. More...
 

Namespaces

namespace  pops
 

Functions

template<class M >
std::unique_ptr< IModel< M::n_vars > > pops::make_dynamic (M model={})
 Factory: wraps a static model in an owned IModel (unique_ptr).
 

Detailed Description

TYPE-ERASED model interface: runtime dispatch of a model (via vtable).

The production solver is TEMPLATE: CompositeModel<Hyperbolic, Source, Elliptic> is known at compile time, which allows inlining and GPU execution (Kokkos). But a model GENERATED at runtime (a DSL brick compiled to .so then loaded) has no type known at compile time. IModel<NV> provides the bridge: a virtual interface (flux + max_wave_speed) that any static model satisfies via ModelAdapter.

HOST / PROTOTYPING path only: virtual calls do NOT go into a GPU kernel and cost an indirect jump per cell. This is the COMPILED counterpart of pops.PythonFlux (one notch faster, without the GIL). GPU/MPI production stays on the template path. Do not use in the hot loop of high-performance cases.