rizer.cantera_ext
C++ Cantera 1-D plasma extension (custom Domain1D models and solvers)
Loading...
Searching...
No Matches
rizer::PropertyTable Class Reference

#include <PropertyTable.h>

Public Member Functions

 PropertyTable ()=default
 PropertyTable (std::vector< double > T, std::vector< double > values)
 Construct from parallel T (non-decreasing, [K]) and value arrays.
bool empty () const
 True for a default-constructed (empty) table; eval() returns 0.0.
bool covers (double x) const
 Whether eval() interpolates at x rather than holding an end value.
double first () const
 First abscissa of a non-empty table, in the table's own units.
double last () const
 Last abscissa of a non-empty table, in the table's own units.
double eval (double T) const
 Linearly interpolated value at T; clamped to the table endpoints.

Static Public Member Functions

static PropertyTable constant (double value)
 A two-point constant table returning value for any T.
static PropertyTable fromTableOrScalar (const std::vector< double > &x, const std::vector< double > &v, const char *name="property table")
 Build a table from a grid/value pair, a single scalar, or neither.

Detailed Description

Definition at line 59 of file PropertyTable.h.

Constructor & Destructor Documentation

◆ PropertyTable() [1/2]

rizer::PropertyTable::PropertyTable ( )
default

◆ PropertyTable() [2/2]

rizer::PropertyTable::PropertyTable ( std::vector< double > T,
std::vector< double > values )
inline

Construct from parallel T (non-decreasing, [K]) and value arrays.

A repeated knot is allowed and encodes a step; a decreasing one is an error, since eval() brackets with std::upper_bound.

Parameters
TTemperature knots [K], non-decreasing
valuesProperty value at each knot, same units as eval()'s return
Exceptions
std::invalid_argumentif sizes differ or fewer than 2 points.

Definition at line 70 of file PropertyTable.h.

Member Function Documentation

◆ constant()

PropertyTable rizer::PropertyTable::constant ( double value)
inlinestatic

A two-point constant table returning value for any T.

Convenience factory used to set P_rad = 0 when radiation is disabled.

Parameters
valueConstant value to return for any T, same units as eval()'s return

Definition at line 105 of file PropertyTable.h.

◆ covers()

bool rizer::PropertyTable::covers ( double x) const
inline

Whether eval() interpolates at x rather than holding an end value.

Parameters
xAbscissa to test, in the table's own units
Returns
True if x lies in [first(), last()]; false for an empty table

Definition at line 156 of file PropertyTable.h.

◆ empty()

bool rizer::PropertyTable::empty ( ) const
inline

True for a default-constructed (empty) table; eval() returns 0.0.

Definition at line 151 of file PropertyTable.h.

◆ eval()

double rizer::PropertyTable::eval ( double T) const
inline

Linearly interpolated value at T; clamped to the table endpoints.

Safe to call with T below or above the tabulated range, never NaN.

Parameters
TTemperature [K] to evaluate the table at

Definition at line 170 of file PropertyTable.h.

◆ first()

double rizer::PropertyTable::first ( ) const
inline

First abscissa of a non-empty table, in the table's own units.

Definition at line 162 of file PropertyTable.h.

◆ fromTableOrScalar()

PropertyTable rizer::PropertyTable::fromTableOrScalar ( const std::vector< double > & x,
const std::vector< double > & v,
const char * name = "property table" )
inlinestatic

Build a table from a grid/value pair, a single scalar, or neither.

A mismatched pair is an ERROR, not a third shape. Returning the empty table for it would hand the caller a property that evaluates to 0.0 everywhere – a silently different physical problem rather than a failure – so an off-by-one in the caller's own profile arrays would surface as a solver bug much later, if at all.

Parameters
xGrid points (independent variable), non-decreasing, or empty
vValues at x, or a single scalar value, or empty
nameCaller-facing name of the pair, used in the exception
Returns
A real table if x/v are >= 2 matching points, a constant table if v has exactly one value and x at most one, or an empty table (eval() -> 0) if both are empty, which is how "this property is not configured" is spelled.
Exceptions
std::invalid_argumentif the pair is neither of those shapes.

Definition at line 126 of file PropertyTable.h.

◆ last()

double rizer::PropertyTable::last ( ) const
inline

Last abscissa of a non-empty table, in the table's own units.

Definition at line 165 of file PropertyTable.h.


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