CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
SpeciesInput Class Reference

#include <species_input.h>

Public Member Functions

template<class T >
std::optional< T > get (const std::string &field) const
 
template<class T >
T get_or (const std::string &field, T fallback) const
 
bool get_flag (const std::string &field, bool fallback) const
 
int get_l_max (const std::string &field) const
 
template<class T >
T require (const std::string &field) const
 

Detailed Description

Per-instance read wrapper over FileContent for dot-syntax species input. Prefixes every key with "<instance_name>." before delegating to the underlying FileContent. Successful reads mark the fully-qualified key as read so unread_parameters() remains accurate.

Member Function Documentation

◆ get()

template<class T >
std::optional< T > SpeciesInput::get ( const std::string &  field) const
inline

Typed accessor: the value if "<instance>.<field>" is present (marking it read), or std::nullopt if absent. Delegates to FileContent::get<T>.

◆ get_or()

template<class T >
T SpeciesInput::get_or ( const std::string &  field,
T  fallback 
) const
inline

Read-with-default: get<T>(field) if present, else fallback.

◆ get_flag()

bool SpeciesInput::get_flag ( const std::string &  field,
bool  fallback 
) const
inline

Yes/no flag on the repo's convention: the value must begin with 'y'/'Y' or 'n'/'N', absent falls back to fallback, and anything else is REJECTED – same rule input_module.cpp applies to its own yes/no keys. Rejecting rather than reading an unrecognised value as "no" is the point: these flags select physics, and a typo that silently turns one off is not something a run reports. Structural (decidable from the text, not from a value a sampler varies), hence severe.

◆ get_l_max()

int SpeciesInput::get_l_max ( const std::string &  field) const
inline

The l_max of a Boltzmann hierarchy set per instance (#137): the value of <instance>.<field>, at least 4 like the precision defaults l_max_ncdm and l_max_dr, or -1 when absent, meaning that default. Structural, hence severe.

◆ require()

template<class T >
T SpeciesInput::require ( const std::string &  field) const
inline

Required accessor: throws std::invalid_argument if the field is absent.


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