antioch-0.4.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
AntiochTesting::ArrheniusRateVexCLFloatTest Class Reference
Inheritance diagram for AntiochTesting::ArrheniusRateVexCLFloatTest:
AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > > AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type > AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type >, vex::vector< float > >

Public Member Functions

 CPPUNIT_TEST_SUITE (ArrheniusRateVexCLFloatTest)
 
 CPPUNIT_TEST (test_standard_rate)
 
 CPPUNIT_TEST (test_standard_deriv)
 
 CPPUNIT_TEST (test_standard_rate_and_deriv)
 
 CPPUNIT_TEST_SUITE_END ()
 
virtual void setUp ()
 
virtual void tearDown ()
 
virtual void init ()
 
virtual void clear ()
 
void test_standard_rate ()
 
void test_standard_deriv ()
 
void test_standard_rate_and_deriv ()
 
void test_rate (const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
 
void test_deriv (const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
 
void test_rate_and_deriv (const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
 

Protected Member Functions

virtual vex::vector< float > exact_rate (vex::vector< float >T)
 
virtual vex::vector< float > exact_deriv (vex::vector< float >T)
 
void reset_params (Antioch::value_type< vex::vector< float > >::typeCf, Antioch::value_type< vex::vector< float > >::typeEa)
 
void reset_params (Antioch::value_type< vex::vector< float > >::typeCf, Antioch::value_type< vex::vector< float > >::typeEa, Antioch::value_type< vex::vector< float > >::typeR)
 
Antioch::value_type
< vex::vector< float > >::type 
value (Antioch::value_type< vex::vector< float > >::typeT)
 
Antioch::value_type
< vex::vector< float > >::type 
deriv (Antioch::value_type< vex::vector< float > >::typeT)
 
vex::vector< float > setup_T (const vex::vector< float > &example)
 

Protected Attributes

Antioch::ArrheniusRate
< typename Antioch::value_type
< vex::vector< float > >::type > * 
_rate
 
Antioch::value_type
< vex::vector< float > >::type 
_Cf
 
Antioch::value_type
< vex::vector< float > >::type 
_Ea
 
Antioch::value_type
< vex::vector< float > >::type 
_R
 
vex::vector< float > * _example
 

Private Attributes

vex::Context * _ctx
 

Detailed Description

Definition at line 45 of file arrhenius_rate_vexcl_test.C.

Member Function Documentation

virtual void AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::clear ( )
inlinevirtualinherited

Definition at line 64 of file arrhenius_rate_vector_test_base.h.

References AntiochTesting::ArrheniusRateVectorTestBase< PairScalars >::_rate.

Referenced by tearDown().

65  {
66  delete _rate;
67  }
Antioch::ArrheniusRate< typename Antioch::value_type< vex::vector< float > >::type > * _rate
AntiochTesting::ArrheniusRateVexCLFloatTest::CPPUNIT_TEST ( test_standard_rate  )
AntiochTesting::ArrheniusRateVexCLFloatTest::CPPUNIT_TEST ( test_standard_deriv  )
AntiochTesting::ArrheniusRateVexCLFloatTest::CPPUNIT_TEST ( test_standard_rate_and_deriv  )
AntiochTesting::ArrheniusRateVexCLFloatTest::CPPUNIT_TEST_SUITE ( ArrheniusRateVexCLFloatTest  )
AntiochTesting::ArrheniusRateVexCLFloatTest::CPPUNIT_TEST_SUITE_END ( )
Antioch::value_type< vex::vector< float > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::deriv ( Antioch::value_type< vex::vector< float > >::type  T)
inlineprotectedinherited

Definition at line 65 of file arrhenius_rate_test_helper.h.

66  {
67  using std::exp;
68  return _Ea/(_R*T*T)*_Cf *exp(-_Ea/(_R*T));
69  }
virtual vex::vector< float > AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::exact_deriv ( vex::vector< float >  T)
inlineprotectedvirtualinherited
virtual vex::vector< float > AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::exact_rate ( vex::vector< float >  T)
inlineprotectedvirtualinherited
virtual void AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::init ( )
inlinevirtualinherited

Definition at line 52 of file arrhenius_rate_vector_test_base.h.

References AntiochTesting::ArrheniusRateVectorTestBase< PairScalars >::_rate, and AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< PairScalars >::type >::reset_params().

Referenced by setUp().

53  {
54  typedef typename Antioch::value_type<PairScalars>::type Scalar;
55 
56  Scalar Cf = 1.4L;
57  Scalar Ea = 5.0L;
58  Scalar R = 1.0L; // Ea in K
59 
60  this->reset_params(Cf,Ea,R);
62  }
Antioch::ArrheniusRate< typename Antioch::value_type< vex::vector< float > >::type > * _rate
void reset_params(Antioch::value_type< vex::vector< float > >::typeCf, Antioch::value_type< vex::vector< float > >::typeEa)
void AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::reset_params ( Antioch::value_type< vex::vector< float > >::type  Cf,
Antioch::value_type< vex::vector< float > >::type  Ea 
)
inlineprotectedinherited

Definition at line 46 of file arrhenius_rate_test_helper.h.

void AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::reset_params ( Antioch::value_type< vex::vector< float > >::type  Cf,
Antioch::value_type< vex::vector< float > >::type  Ea,
Antioch::value_type< vex::vector< float > >::type  R 
)
inlineprotectedinherited
virtual void AntiochTesting::ArrheniusRateVexCLFloatTest::setUp ( )
inlinevirtual
vex::vector< float > AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > , vex::vector< float > >::setup_T ( const vex::vector< float > &  example)
inlineprotectedinherited

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  }
virtual void AntiochTesting::ArrheniusRateVexCLFloatTest::tearDown ( )
inlinevirtual
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > , vex::vector< float > >::test_deriv ( const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &  reaction_rate,
const vex::vector< float > &  T,
typename Antioch::value_type< vex::vector< float > >::type  tol 
)
inlineinherited

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  }
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > , vex::vector< float > >::test_rate ( const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &  reaction_rate,
const vex::vector< float > &  T,
typename Antioch::value_type< vex::vector< float > >::type  tol 
)
inlineinherited

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  }
void AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > , vex::vector< float > >::test_rate_and_deriv ( const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &  reaction_rate,
const vex::vector< float > &  T,
typename Antioch::value_type< vex::vector< float > >::type  tol 
)
inlineinherited

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  }
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
void AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::test_standard_deriv ( )
inlineinherited

Definition at line 78 of file arrhenius_rate_vector_test_base.h.

References AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::_example, AntiochTesting::ArrheniusRateVectorTestBase< PairScalars >::_rate, AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::setup_T(), and AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::test_deriv().

79  {
80  typedef typename Antioch::value_type<PairScalars>::type Scalar;
81 
82  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
83  PairScalars T = this->setup_T(*(this->_example));
84  this->test_deriv( *_rate, T, tol );
85  }
void test_deriv(const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
Antioch::ArrheniusRate< typename Antioch::value_type< vex::vector< float > >::type > * _rate
void AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::test_standard_rate ( )
inlineinherited

Definition at line 69 of file arrhenius_rate_vector_test_base.h.

References AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::_example, AntiochTesting::ArrheniusRateVectorTestBase< PairScalars >::_rate, AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::setup_T(), and AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::test_rate().

70  {
71  typedef typename Antioch::value_type<PairScalars>::type Scalar;
72 
73  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
74  PairScalars T = this->setup_T(*(this->_example));
75  this->test_rate( *_rate, T, tol );
76  }
Antioch::ArrheniusRate< typename Antioch::value_type< vex::vector< float > >::type > * _rate
void test_rate(const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
void AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::test_standard_rate_and_deriv ( )
inlineinherited

Definition at line 87 of file arrhenius_rate_vector_test_base.h.

References AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::_example, AntiochTesting::ArrheniusRateVectorTestBase< PairScalars >::_rate, AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::setup_T(), and AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< PairScalars >::type >, PairScalars >::test_rate_and_deriv().

88  {
89  typedef typename Antioch::value_type<PairScalars>::type Scalar;
90 
91  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
92  PairScalars T = this->setup_T(*(this->_example));
93  this->test_rate_and_deriv( *_rate, T, tol );
94  }
void test_rate_and_deriv(const Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > &reaction_rate, const vex::vector< float > &T, typename Antioch::value_type< vex::vector< float > >::typetol)
Antioch::ArrheniusRate< typename Antioch::value_type< vex::vector< float > >::type > * _rate
Antioch::value_type< vex::vector< float > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::value ( Antioch::value_type< vex::vector< float > >::type  T)
inlineprotectedinherited

Definition at line 59 of file arrhenius_rate_test_helper.h.

Member Data Documentation

Antioch::value_type< vex::vector< float > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::_Cf
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

vex::Context* AntiochTesting::ArrheniusRateVexCLFloatTest::_ctx
private

Definition at line 59 of file arrhenius_rate_vexcl_test.C.

Referenced by setUp(), and tearDown().

Antioch::value_type< vex::vector< float > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::_Ea
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

vex::vector< float > * AntiochTesting::ReactionRateVectorTestBase< Antioch::ArrheniusRate< Antioch::value_type< vex::vector< float > >::type > , vex::vector< float > >::_example
protectedinherited

Definition at line 121 of file reaction_rate_vector_test_base.h.

Referenced by setUp(), and tearDown().

Antioch::value_type< vex::vector< float > >::type AntiochTesting::ArrheniusRateTestHelper< Antioch::value_type< vex::vector< float > >::type >::_R
protectedinherited

Definition at line 44 of file arrhenius_rate_test_helper.h.

Antioch::ArrheniusRate<typename Antioch::value_type<vex::vector< float > >::type>* AntiochTesting::ArrheniusRateVectorTestBase< vex::vector< float > >::_rate
protectedinherited

Definition at line 98 of file arrhenius_rate_vector_test_base.h.


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

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