VariableSet Struct ReferenceΒΆ

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

A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; absent -> Custom), and user_roles (optional string labels parallel to names, for components whose role is OUTSIDE the canonical enum). More...

#include <variables.hpp>

+ Collaboration diagram for pops::VariableSet:

Public Member Functions

int index_of (VariableRole role) const
 Index of the component carrying role (first occurrence), -1 if absent.
 
int index_of (const std::string &role) const
 Index of the component carrying role addressed BY NAME: a canonical role name (role_from_name) first, else a user-defined role label (user_roles).
 
Variable at (int i) const
 Full descriptor of component i (Custom role if not provided).
 

Public Attributes

VariableKind kind
 
std::vector< std::string > names
 
int size
 
std::vector< VariableRoleroles {}
 parallel to names; empty = roles not provided
 
std::vector< std::string > user_roles {}
 parallel to names; per-component user-defined role label (Custom role); empty entry = canonical role
 

Detailed Description

A model's variable set: kind (cons/prim), names, size, canonical roles (optional, parallel to names; absent -> Custom), and user_roles (optional string labels parallel to names, for components whose role is OUTSIDE the canonical enum).

Existing calls {kind, names, size} and {kind, names, size, roles} stay valid (user_roles empty). index_of(role) gives the index of the component carrying that role (-1 if absent).

Member Function Documentation

◆ at()

Variable pops::VariableSet::at ( int  i) const
inline

Full descriptor of component i (Custom role if not provided).

◆ index_of() [1/2]

int pops::VariableSet::index_of ( const std::string &  role) const
inline

Index of the component carrying role addressed BY NAME: a canonical role name (role_from_name) first, else a user-defined role label (user_roles).

-1 if absent. Resolving a user label by string removes the first-occurrence ambiguity of several Custom components. An EMPTY role is never a valid target (it would otherwise match the empty user_roles slot of a canonical component on a mixed block) and returns -1.

+ Here is the call graph for this function:

◆ index_of() [2/2]

int pops::VariableSet::index_of ( VariableRole  role) const
inline

Index of the component carrying role (first occurrence), -1 if absent.

+ Here is the caller graph for this function:

Member Data Documentation

◆ kind

VariableKind pops::VariableSet::kind

◆ names

std::vector<std::string> pops::VariableSet::names

◆ roles

std::vector<VariableRole> pops::VariableSet::roles {}

parallel to names; empty = roles not provided

◆ size

int pops::VariableSet::size

◆ user_roles

std::vector<std::string> pops::VariableSet::user_roles {}

parallel to names; per-component user-defined role label (Custom role); empty entry = canonical role


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