SystemBlockStore Class ReferenceΒΆ

adc_cpp: pops::SystemBlockStore Class 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::SystemBlockStore Class Reference

ORDERED registry of the System blocks + state marshaling helpers. More...

#include <system_block_store.hpp>

+ Collaboration diagram for pops::SystemBlockStore:

Classes

struct  BlockState
 Compiled closures frozen at block add time (composite model + spatial scheme + time). More...
 

Public Types

using CellConvert = std::function< void(const double *in, double *out)>
 Type-erase of the POINTWISE (one cell) cons <-> prim conversion of a block: in/out are arrays of ncomp doubles.
 

Public Member Functions

BlockStatefind (const std::string &name)
 Reference to block name (for writing).
 
const BlockStatefind (const std::string &name) const
 Reference to block name (for reading).
 
int index (const std::string &name) const
 0-based index of block name (insertion order).
 
int size () const
 Number of registered blocks.
 
std::vector< std::string > names () const
 Block names, in insertion order (UNIQUE source: all add paths appear here).
 
std::vector< double > copy_comp0 (const MultiFab &mf) const
 Copies component 0 of fab(0) (density) in row-major (j slow, i fast).
 
std::vector< double > copy_state (const MultiFab &mf, int ncomp) const
 Copies the ncomp components of fab(0) in component-major layout (c slow, then j, then i).
 
void write_state (MultiFab &mf, int ncomp, const std::vector< double > &in)
 Writes the ncomp components into fab(0) from a component-major buffer (same layout as copy_state).
 

Public Attributes

std::vector< BlockStateblocks
 ORDERED registry of the blocks (UNIQUE source of truth).
 

Detailed Description

ORDERED registry of the System blocks + state marshaling helpers.

See contract above (OWNS BlockState + the vector; EXPOSES index/find + copy/write_state; DOES NOT OWN the domain/aux/Poisson).

Member Typedef Documentation

◆ CellConvert

using pops::SystemBlockStore::CellConvert = std::function<void(const double* in, double* out)>

Type-erase of the POINTWISE (one cell) cons <-> prim conversion of a block: in/out are arrays of ncomp doubles.

SAME type as System::CellConvert (identical std::function): assignment from set_block_conversion / native_loader stays a trivial move.

Member Function Documentation

◆ copy_comp0()

std::vector< double > pops::SystemBlockStore::copy_comp0 ( const MultiFab mf) const
inline

Copies component 0 of fab(0) (density) in row-major (j slow, i fast).

device_fence beforehand: the marshaling reads the host, so the device must have finished writing U.

+ Here is the call graph for this function:

◆ copy_state()

std::vector< double > pops::SystemBlockStore::copy_state ( const MultiFab mf,
int  ncomp 
) const
inline

Copies the ncomp components of fab(0) in component-major layout (c slow, then j, then i).

+ Here is the call graph for this function:

◆ find() [1/2]

BlockState & pops::SystemBlockStore::find ( const std::string &  name)
inline

Reference to block name (for writing).

Exceptions
std::runtime_error"System: bloc inconnu '...'".

◆ find() [2/2]

const BlockState & pops::SystemBlockStore::find ( const std::string &  name) const
inline

Reference to block name (for reading).

Exceptions
std::runtime_error"System: bloc inconnu '...'".

◆ index()

int pops::SystemBlockStore::index ( const std::string &  name) const
inline

0-based index of block name (insertion order).

Exceptions
std::runtime_errorif unknown.

◆ names()

std::vector< std::string > pops::SystemBlockStore::names ( ) const
inline

Block names, in insertion order (UNIQUE source: all add paths appear here).

◆ size()

int pops::SystemBlockStore::size ( ) const
inline

Number of registered blocks.

◆ write_state()

void pops::SystemBlockStore::write_state ( MultiFab mf,
int  ncomp,
const std::vector< double > &  in 
)
inline

Writes the ncomp components into fab(0) from a component-major buffer (same layout as copy_state).

Exceptions
std::runtime_error"System::set_state: taille != ncomp*n*n" if the size does not match ncomp*nx*ny (message unchanged).
+ Here is the call graph for this function:

Member Data Documentation

◆ blocks

std::vector<BlockState> pops::SystemBlockStore::blocks

ORDERED registry of the blocks (UNIQUE source of truth).

PUBLIC: Impl aliases it as sp for the already-extracted templates (SystemFieldSolver / SystemStepper / native_loader) that iterate owner_->sp.


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