antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
Antioch::NASACurveFitBase< CoeffType > Class Template Reference

#include <nasa_curve_fit_base.h>

Inheritance diagram for Antioch::NASACurveFitBase< CoeffType >:
Antioch::NASA7CurveFit< CoeffType > Antioch::NASA9CurveFit< CoeffType > Antioch::CEACurveFit< CoeffType >

Public Member Functions

 NASACurveFitBase (const std::vector< CoeffType > &coeffs, const std::vector< CoeffType > &temp)
 
 ~NASACurveFitBase ()
 
unsigned int n_intervals () const
 The number of intervals for this NASA9 curve fit. More...
 
template<typename StateType >
Antioch::rebind< StateType,
unsigned int >::type 
interval (const StateType &T) const
 The interval the input temperature lies in. More...
 
const CoeffType * coefficients (const unsigned int interval) const
 The ordering/packing of the coefficients will depend on the subclass. More...
 
template<typename StateType >
Antioch::rebind< StateType,
unsigned int >::type 
interval (const StateType &T) const
 

Protected Member Functions

 NASACurveFitBase ()
 
void check_coeff_size () const
 
void check_temp_coeff_size_consistency () const
 

Protected Attributes

unsigned int _n_coeffs
 The number of coefficients in each interval. More...
 
std::vector< CoeffType > _coefficients
 The coefficient data. More...
 
std::vector< CoeffType > _temp
 The temperatures. More...
 

Detailed Description

template<typename CoeffType = double>
class Antioch::NASACurveFitBase< CoeffType >

Definition at line 42 of file nasa_curve_fit_base.h.

Constructor & Destructor Documentation

template<typename CoeffType >
Antioch::NASACurveFitBase< CoeffType >::NASACurveFitBase ( const std::vector< CoeffType > &  coeffs,
const std::vector< CoeffType > &  temp 
)
inline

Definition at line 97 of file nasa_curve_fit_base.h.

99  : _n_coeffs(0),
100  _coefficients(coeffs),
101  _temp(temp)
102  {}
std::vector< CoeffType > _temp
The temperatures.
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType = double>
Antioch::NASACurveFitBase< CoeffType >::~NASACurveFitBase ( )
inline

Definition at line 48 of file nasa_curve_fit_base.h.

48 {};
template<typename CoeffType = double>
Antioch::NASACurveFitBase< CoeffType >::NASACurveFitBase ( )
inlineprotected

Definition at line 70 of file nasa_curve_fit_base.h.

70 {};

Member Function Documentation

template<typename CoeffType >
void Antioch::NASACurveFitBase< CoeffType >::check_coeff_size ( ) const
inlineprotected

Definition at line 143 of file nasa_curve_fit_base.h.

References antioch_error_msg.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit(), and Antioch::NASA9CurveFit< CoeffType >::NASA9CurveFit().

144  {
145  if( this->_coefficients.size()%this->_n_coeffs != 0 )
146  {
147  std::stringstream ncs;
148  ncs << this->_n_coeffs;
149 
150  std::stringstream css;
151  css << this->_coefficients.size()%this->_n_coeffs;
152 
153  std::string msg = "ERROR: coeffs size must be a multiple of "+ncs.str()+"\n";
154  msg += " Found "+css.str()+"\n";
155  antioch_error_msg(msg);
156  }
157  }
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
void Antioch::NASACurveFitBase< CoeffType >::check_temp_coeff_size_consistency ( ) const
inlineprotected

Definition at line 161 of file nasa_curve_fit_base.h.

References antioch_error_msg.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit(), and Antioch::NASA9CurveFit< CoeffType >::NASA9CurveFit().

162  {
163  if( this->_temp.size() != this->_coefficients.size()/this->_n_coeffs + 1 )
164  {
165  std::stringstream tss;
166  tss << this->_temp.size();
167 
168  std::stringstream css;
169  css << this->_coefficients.size();
170 
171  std::stringstream cssd;
172  cssd << this->_n_coeffs*(this->_temp.size()-1);
173 
174  std::string msg = "ERROR: Inconsistency in temp and coeff size.\n";
175  msg += " Found temp size of "+tss.str()+"\n";
176  msg += " Found coeff size of "+css.str()+"\n";
177  msg += " Expected coeff size of "+cssd.str()+"\n";
178  antioch_error_msg(msg);
179  }
180  }
std::vector< CoeffType > _temp
The temperatures.
#define antioch_error_msg(errmsg)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType >
const CoeffType * Antioch::NASACurveFitBase< CoeffType >::coefficients ( const unsigned int  interval) const
inline

The ordering/packing of the coefficients will depend on the subclass.

Returns
a pointer to the coefficients in the interval specified.

Definition at line 133 of file nasa_curve_fit_base.h.

References antioch_assert_less, and antioch_assert_less_equal.

Referenced by AntiochTesting::NASA7XMLParsingTest< long double >::check_curve_fits(), and AntiochTesting::NASA9XMLParsingTest< long double >::test_supplied_species().

134  {
137 
139  }
#define antioch_assert_less(expr1, expr2)
#define antioch_assert_less_equal(expr1, expr2)
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
unsigned int n_intervals() const
The number of intervals for this NASA9 curve fit.
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.
template<typename CoeffType = double>
template<typename StateType >
Antioch::rebind<StateType, unsigned int>::type Antioch::NASACurveFitBase< CoeffType >::interval ( const StateType &  T) const

The interval the input temperature lies in.

Returns
which curve fit interval the input temperature lies in.
template<typename CoeffType = double>
template<typename StateType >
Antioch::rebind<StateType, unsigned int>::type Antioch::NASACurveFitBase< CoeffType >::interval ( const StateType &  T) const
inline

Definition at line 113 of file nasa_curve_fit_base.h.

References Antioch::constant_clone(), Antioch::if_else(), and Antioch::zero_clone().

114  {
115  typedef typename
117  UIntType interval;
118  Antioch::zero_clone(interval, T);
119 
120  for(unsigned int i = 1; i < _temp.size(); ++i)
121  {
122  interval = Antioch::if_else
123  (T > _temp[i-1] && T < _temp[i],
124  Antioch::constant_clone(interval, i-1),
125  interval );
126  }
127 
128  return interval;
129  }
std::vector< CoeffType > _temp
The temperatures.
Antioch::rebind< StateType, unsigned int >::type interval(const StateType &T) const
The interval the input temperature lies in.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
Definition: eigen_utils.h:181
enable_if_c< is_eigen< T1 >::value &&is_eigen< T2 >::value, typename state_type< T1 >::type >::type if_else(const Condition &condition, const T1 &if_true, const T2 &if_false)
Definition: eigen_utils.h:250
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType >
unsigned int Antioch::NASACurveFitBase< CoeffType >::n_intervals ( ) const
inline

The number of intervals for this NASA9 curve fit.

Definition at line 106 of file nasa_curve_fit_base.h.

Referenced by AntiochTesting::NASA7XMLParsingTest< long double >::check_curve_fits(), and AntiochTesting::NASA9XMLParsingTest< long double >::test_supplied_species().

107  { return _coefficients.size() / _n_coeffs; }
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.

Member Data Documentation

template<typename CoeffType = double>
std::vector<CoeffType> Antioch::NASACurveFitBase< CoeffType >::_coefficients
protected

The coefficient data.

The coeffcients are packed in linear ordering. That is, a0-a9 for the first interval, a0-a9 for the second interval, and so on.

Definition at line 85 of file nasa_curve_fit_base.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit().

template<typename CoeffType = double>
unsigned int Antioch::NASACurveFitBase< CoeffType >::_n_coeffs
protected
template<typename CoeffType = double>
std::vector<CoeffType> Antioch::NASACurveFitBase< CoeffType >::_temp
protected

The temperatures.

The temperature defining the intervals

Definition at line 91 of file nasa_curve_fit_base.h.

Referenced by Antioch::CEACurveFit< CoeffType >::CEACurveFit(), and Antioch::NASA7CurveFit< CoeffType >::NASA7CurveFit().


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

Generated on Thu Jul 7 2016 11:09:49 for antioch-0.4.0 by  doxygen 1.8.8