Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
input.h File Reference

Lookup of real-valued input parameters. More...

#include <algorithm>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <vector>
#include <toml.hpp>
#include "common_typedef.h"

Go to the source code of this file.

Classes

struct  InputError
 An invalid or missing input value. The message names the key and the offending value; the caller adds the input file name. More...
 

Functions

template<typename T >
InputError unknown_option (const std::unordered_map< std::string, T > &options, const std::string &key, const std::string &value)
 Error for a value not among the accepted options, listing them.
 
rtype as_real (const toml::value &v, const std::string &key)
 
double as_double (const toml::value &v, const std::string &key)
 Double-precision lookups, for inputs of the chemistry (double in every build).
 
double find_double (const toml::value &v, const std::string &key)
 
double find_double_or (const toml::value &v, const std::string &key, const double fallback)
 
rtype find_real (const toml::value &v, const std::string &key)
 
rtype find_real (const toml::value &v, const std::string &table, const std::string &key)
 
rtype find_real_or (const toml::value &v, const std::string &key, const rtype fallback)
 
rtype find_real_or (const toml::value &v, const std::string &table, const std::string &key, const rtype fallback)
 
std::vector< rtype > find_real_vector (const toml::value &v, const std::string &key)
 
std::vector< rtype > find_real_vector (const toml::value &v, const std::string &table, const std::string &key)
 

Detailed Description

Lookup of real-valued input parameters.

Author
Matthew Bonanni (mbona.nosp@m.nni0.nosp@m.01@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2026-10-02

Function Documentation

◆ as_double()

double as_double ( const toml::value &  v,
const std::string &  key 
)
inline

Double-precision lookups, for inputs of the chemistry (double in every build).

◆ as_real()

rtype as_real ( const toml::value &  v,
const std::string &  key 
)
inline

TOML distinguishes integers from floats, so cfl = 1 is not a float and toml::find_or<double> silently falls back to its default for it. These helpers accept either and reject anything else.

◆ find_double()

double find_double ( const toml::value &  v,
const std::string &  key 
)
inline

◆ find_double_or()

double find_double_or ( const toml::value &  v,
const std::string &  key,
const double  fallback 
)
inline

◆ find_real() [1/2]

rtype find_real ( const toml::value &  v,
const std::string &  key 
)
inline

◆ find_real() [2/2]

rtype find_real ( const toml::value &  v,
const std::string &  table,
const std::string &  key 
)
inline

◆ find_real_or() [1/2]

rtype find_real_or ( const toml::value &  v,
const std::string &  key,
const rtype  fallback 
)
inline

◆ find_real_or() [2/2]

rtype find_real_or ( const toml::value &  v,
const std::string &  table,
const std::string &  key,
const rtype  fallback 
)
inline

◆ find_real_vector() [1/2]

std::vector< rtype > find_real_vector ( const toml::value &  v,
const std::string &  key 
)
inline

◆ find_real_vector() [2/2]

std::vector< rtype > find_real_vector ( const toml::value &  v,
const std::string &  table,
const std::string &  key 
)
inline

◆ unknown_option()

template<typename T >
InputError unknown_option ( const std::unordered_map< std::string, T > &  options,
const std::string &  key,
const std::string &  value 
)

Error for a value not among the accepted options, listing them.