antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars > Class Template Referenceabstract

#include <reaction_rate_vector_test_base.h>

Inheritance diagram for AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >:

Public Member Functions

void test_rate (const ReactionRate &reaction_rate, const PairScalars &T, typename Antioch::value_type< PairScalars >::typetol)
 
void test_deriv (const ReactionRate &reaction_rate, const PairScalars &T, typename Antioch::value_type< PairScalars >::typetol)
 
void test_rate_and_deriv (const ReactionRate &reaction_rate, const PairScalars &T, typename Antioch::value_type< PairScalars >::typetol)
 

Protected Member Functions

PairScalars setup_T (const PairScalars &example)
 
virtual PairScalars exact_rate (PairScalars T)=0
 
virtual PairScalars exact_deriv (PairScalars T)=0
 

Protected Attributes

PairScalars * _example
 

Detailed Description

template<typename ReactionRate, typename PairScalars>
class AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >

Definition at line 40 of file reaction_rate_vector_test_base.h.

Member Function Documentation

template<typename ReactionRate, typename PairScalars>
virtual PairScalars AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::exact_deriv ( PairScalars  T)
protectedpure virtual
template<typename ReactionRate, typename PairScalars>
virtual PairScalars AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::exact_rate ( PairScalars  T)
protectedpure virtual
template<typename ReactionRate, typename PairScalars>
PairScalars AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::setup_T ( const PairScalars &  example)
inlineprotected

Definition at line 123 of file reaction_rate_vector_test_base.h.

124  {
125  // Construct from example to avoid resizing issues
126  PairScalars T = example;
127  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
128  {
129  T[2*tuple] = 1500.1;
130  T[2*tuple+1] = 1600.1;
131  }
132  return T;
133  }
template<typename ReactionRate, typename PairScalars>
void AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::test_deriv ( const ReactionRate &  reaction_rate,
const PairScalars &  T,
typename Antioch::value_type< PairScalars >::type  tol 
)
inline

Definition at line 64 of file reaction_rate_vector_test_base.h.

67  {
68  const PairScalars deriv = reaction_rate.derivative(T);
69  const PairScalars exact_deriv = this->exact_deriv(T);
70 
71  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
72  {
73  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple],
74  exact_deriv[0],
75  tol );
76 
77  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple+1],
78  exact_deriv[1],
79  tol );
80 
81  }
82  }
virtual PairScalars exact_deriv(PairScalars T)=0
template<typename ReactionRate, typename PairScalars>
void AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::test_rate ( const ReactionRate &  reaction_rate,
const PairScalars &  T,
typename Antioch::value_type< PairScalars >::type  tol 
)
inline

Definition at line 44 of file reaction_rate_vector_test_base.h.

47  {
48  const PairScalars rate = reaction_rate(T);
49  const PairScalars exact_rate = this->exact_rate(T);
50 
51  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
52  {
53  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple],
54  exact_rate[0],
55  tol );
56 
57  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple+1],
58  exact_rate[1],
59  tol );
60 
61  }
62  }
virtual PairScalars exact_rate(PairScalars T)=0
template<typename ReactionRate, typename PairScalars>
void AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::test_rate_and_deriv ( const ReactionRate &  reaction_rate,
const PairScalars &  T,
typename Antioch::value_type< PairScalars >::type  tol 
)
inline

Definition at line 84 of file reaction_rate_vector_test_base.h.

87  {
88  // Init using T as the "example"
89  PairScalars rate = T;
90  PairScalars deriv = T;
91 
92  reaction_rate.rate_and_derivative(T,rate,deriv);
93 
94  const PairScalars exact_rate = this->exact_rate(T);
95  const PairScalars exact_deriv = this->exact_deriv(T);
96 
97  for (unsigned int tuple=0; tuple != ANTIOCH_N_TUPLES; ++tuple)
98  {
99  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple],
100  exact_rate[0],
101  tol );
102 
103  CPPUNIT_ASSERT_DOUBLES_EQUAL( rate[2*tuple+1],
104  exact_rate[1],
105  tol );
106 
107  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple],
108  exact_deriv[0],
109  tol );
110 
111  CPPUNIT_ASSERT_DOUBLES_EQUAL( deriv[2*tuple+1],
112  exact_deriv[1],
113  tol );
114  }
115  }
virtual PairScalars exact_rate(PairScalars T)=0
virtual PairScalars exact_deriv(PairScalars T)=0

Member Data Documentation

template<typename ReactionRate, typename PairScalars>
PairScalars* AntiochTesting::ReactionRateVectorTestBase< ReactionRate, PairScalars >::_example
protected

Definition at line 121 of file reaction_rate_vector_test_base.h.


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

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