27 #ifndef ANTIOCH_NASA_CURVE_FIT_BASE_H
28 #define ANTIOCH_NASA_CURVE_FIT_BASE_H
41 template<
typename CoeffType=
double>
46 NASACurveFitBase(
const std::vector<CoeffType>& coeffs,
const std::vector<CoeffType>& temp );
58 template <
typename StateType>
95 template<
typename CoeffType>
98 const std::vector<CoeffType>& temp )
100 _coefficients(coeffs),
104 template<
typename CoeffType>
107 {
return _coefficients.size() / _n_coeffs; }
109 template<
typename CoeffType>
110 template<
typename StateType>
120 for(
unsigned int i = 1; i < _temp.size(); ++i)
123 (T > _temp[i-1] && T < _temp[i],
131 template<
typename CoeffType>
138 return &_coefficients[_n_coeffs*interval];
141 template<
typename CoeffType>
145 if( this->_coefficients.size()%this->_n_coeffs != 0 )
147 std::stringstream ncs;
148 ncs << this->_n_coeffs;
150 std::stringstream css;
151 css << this->_coefficients.size()%this->_n_coeffs;
153 std::string msg =
"ERROR: coeffs size must be a multiple of "+ncs.str()+
"\n";
154 msg +=
" Found "+css.str()+
"\n";
159 template<
typename CoeffType>
163 if( this->_temp.size() != this->_coefficients.size()/this->_n_coeffs + 1 )
165 std::stringstream tss;
166 tss << this->_temp.size();
168 std::stringstream css;
169 css << this->_coefficients.size();
171 std::stringstream cssd;
172 cssd << this->_n_coeffs*(this->_temp.size()-1);
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";
184 #endif // ANTIOCH_NASA_CURVE_FIT_BASE_H
const CoeffType * coefficients(const unsigned int interval) const
The ordering/packing of the coefficients will depend on the subclass.
void check_temp_coeff_size_consistency() const
#define antioch_assert_less(expr1, expr2)
std::vector< CoeffType > _temp
The temperatures.
#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.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > constant_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex, const Scalar &value)
#define antioch_error_msg(errmsg)
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)
void check_coeff_size() const
unsigned int n_intervals() const
The number of intervals for this NASA9 curve fit.
The parameters are reduced parameters.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
unsigned int _n_coeffs
The number of coefficients in each interval.
std::vector< CoeffType > _coefficients
The coefficient data.