OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::SpeciesRegistry Class Reference

#include <SpeciesRegistry.hpp>

Collaboration diagram for openswmm::SpeciesRegistry:

Public Member Functions

void clear ()
 Erase all species and reset the pollutant count.
 
int add (std::string name, SpeciesKind kind, std::string units)
 Append a uniquely named species across all kinds.
 
int find (std::string_view name) const
 Find the first byte-exact species name.
 
int count () const noexcept
 Count registered constituents of all kinds.
 
int pollutant_count () const noexcept
 Count registered entries marked POLLUTANT.
 
int transported_count () const noexcept
 Count mesh-transported constituent kinds.
 
const std::string & name (int i) const
 Borrow a species identifier.
 
SpeciesKind kind (int i) const
 Read a species category.
 
const std::string & units (int i) const
 Borrow a species unit label.
 
void truncate_to (int n)
 Drop registry entries from a specified index onward.
 

Member Function Documentation

◆ add()

int openswmm::SpeciesRegistry::add ( std::string name,
SpeciesKind kind,
std::string units )
inline

Append a uniquely named species across all kinds.

Does not enforce pollutant-first ordering. Independent vector appends may fail without rollback; caller keeps dependent arrays and registry blocks coherent.

Parameters
[in]nameOwned name moved into storage if accepted; exact-case collision detection.
[in]kindKind stored without enum or ordering validation.
[in]unitsOwned display/unit label moved verbatim; not parsed.
Returns
New registry index, or -1 on an exact-name collision with no mutation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void openswmm::SpeciesRegistry::clear ( )
inline

Erase all species and reset the pollutant count.

Retains vector capacities and invalidates borrowed species strings; does not update any external concentration arrays or ReactionData indexes.

◆ count()

int openswmm::SpeciesRegistry::count ( ) const
inlinenoexcept

Count registered constituents of all kinds.

Returns
Owned name vector length converted to int.
Here is the caller graph for this function:

◆ find()

int openswmm::SpeciesRegistry::find ( std::string_view name) const
inline

Find the first byte-exact species name.

Parameters
[in]nameBorrowed untrimmed name; case-sensitive and allocation-free lookup.
Returns
Registry index or -1; linear scan over all kinds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kind()

SpeciesKind openswmm::SpeciesRegistry::kind ( int i) const
inline

Read a species category.

Parameters
[in]iExisting registry index; unchecked.
Returns
Stored SpeciesKind value without normalization.
Here is the caller graph for this function:

◆ name()

const std::string & openswmm::SpeciesRegistry::name ( int i) const
inline

Borrow a species identifier.

Parameters
[in]iExisting registry index in [0,count()); unchecked.
Returns
Reference to owned string, invalidated by growth, truncation, clear or destruction.
Here is the caller graph for this function:

◆ pollutant_count()

int openswmm::SpeciesRegistry::pollutant_count ( ) const
inlinenoexcept

Count registered entries marked POLLUTANT.

Returns
Maintained pollutant-kind count; does not imply those entries occupy the first slots unless caller enforces ordering.
Here is the caller graph for this function:

◆ transported_count()

int openswmm::SpeciesRegistry::transported_count ( ) const
inlinenoexcept

Count mesh-transported constituent kinds.

This kind whitelist reports registry membership, not the active solver's supported configuration or allocated mesh dimensions.

Returns
Number of POLLUTANT, MSX_BULK, RESERVED_AGE and RESERVED_TEMPERATURE entries; excludes MSX_WALL and unknown kinds.

◆ truncate_to()

void openswmm::SpeciesRegistry::truncate_to ( int n)
inline

Drop registry entries from a specified index onward.

Shrinks all columns and recounts pollutant kinds. Preserves retained prefix values but invalidates erased strings/references; does not repair dependent species indexes or state arrays. Used when rebuilding reaction-species blocks.

Parameters
[in]nFirst removed index; negative treated as zero, values >=count() leave storage unchanged.
Here is the call graph for this function:

◆ units()

const std::string & openswmm::SpeciesRegistry::units ( int i) const
inline

Borrow a species unit label.

Parameters
[in]iExisting registry index; unchecked.
Returns
Reference to owned string, invalidated by registry vector mutation/destruction.
Here is the caller graph for this function:

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