Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #ifndef ACADO_TOOLKIT_EVALUATION_TEMPLATE_HPP
00035 #define ACADO_TOOLKIT_EVALUATION_TEMPLATE_HPP
00036
00037 #include <acado/symbolic_operator/symbolic_operator_fwd.hpp>
00038 #include <acado/symbolic_operator/evaluation_base.hpp>
00039
00040
00041 BEGIN_NAMESPACE_ACADO
00042
00051 template <typename T>
00052 class EvaluationTemplate : public EvaluationBase{
00053
00054 public:
00055
00057 EvaluationTemplate();
00058 EvaluationTemplate( Tmatrix<T> *_val );
00059
00060 virtual ~EvaluationTemplate();
00061
00062 virtual void addition ( Operator &arg1, Operator &arg2 );
00063 virtual void subtraction( Operator &arg1, Operator &arg2 );
00064 virtual void product ( Operator &arg1, Operator &arg2 );
00065 virtual void quotient ( Operator &arg1, Operator &arg2 );
00066 virtual void power ( Operator &arg1, Operator &arg2 );
00067 virtual void powerInt ( Operator &arg1, int &arg2 );
00068
00069 virtual void project ( int &idx );
00070 virtual void set ( double &arg );
00071 virtual void Acos ( Operator &arg );
00072 virtual void Asin ( Operator &arg );
00073 virtual void Atan ( Operator &arg );
00074 virtual void Cos ( Operator &arg );
00075 virtual void Exp ( Operator &arg );
00076 virtual void Log ( Operator &arg );
00077 virtual void Sin ( Operator &arg );
00078 virtual void Tan ( Operator &arg );
00079
00080 Tmatrix<T> *val;
00081 T res;
00082
00083 };
00084
00085
00086
00087 CLOSE_NAMESPACE_ACADO
00088
00089 #include <acado/symbolic_operator/operator.hpp>
00090
00091 BEGIN_NAMESPACE_ACADO
00092
00093
00094
00095 template <typename T> EvaluationTemplate<T>::EvaluationTemplate():EvaluationBase(){ val = 0; }
00096 template <typename T> EvaluationTemplate<T>::EvaluationTemplate( Tmatrix<T> *_val ):EvaluationBase()
00097 { val = _val; }
00098 template <typename T> EvaluationTemplate<T>::~EvaluationTemplate(){}
00099
00100 template <typename T> void EvaluationTemplate<T>::addition( Operator &arg1, Operator &arg2 ){
00101
00102 EvaluationTemplate<T> r(val);
00103 arg1.evaluate( this );
00104 arg2.evaluate( &r );
00105 res += r.res;
00106 }
00107
00108 template <typename T> void EvaluationTemplate<T>::subtraction( Operator &arg1, Operator &arg2 ){
00109
00110 EvaluationTemplate<T> r(val);
00111 arg1.evaluate( this );
00112 arg2.evaluate( &r );
00113 res -= r.res;
00114 }
00115
00116 template <typename T> void EvaluationTemplate<T>::product( Operator &arg1, Operator &arg2 ){
00117
00118 EvaluationTemplate<T> r(val);
00119 arg1.evaluate( this );
00120 arg2.evaluate( &r );
00121 res *= r.res;
00122 }
00123
00124 template <typename T> void EvaluationTemplate<T>::quotient( Operator &arg1, Operator &arg2 ){
00125
00126 EvaluationTemplate<T> r(val);
00127 arg1.evaluate( this );
00128 arg2.evaluate( &r );
00129 res /= r.res;
00130 }
00131
00132 template <typename T> void EvaluationTemplate<T>::power( Operator &arg1, Operator &arg2 ){
00133
00134 EvaluationTemplate<T> r(val);
00135 arg1.evaluate( this );
00136 arg2.evaluate( &r );
00137 res = pow(res,r.res);
00138 }
00139
00140 template <typename T> void EvaluationTemplate<T>::powerInt( Operator &arg1, int &arg2 ){
00141
00142 arg1.evaluate( this );
00143 res = pow( res, arg2 );
00144 }
00145
00146
00147 template <typename T> void EvaluationTemplate<T>::project( int &idx ){
00148
00149 res = val->operator()(idx);
00150 }
00151
00152
00153 template <typename T> void EvaluationTemplate<T>::set( double &arg ){
00154
00155 res = arg;
00156 }
00157
00158
00159 template <typename T> void EvaluationTemplate<T>::Acos( Operator &arg ){
00160
00161 arg.evaluate( this );
00162 res = acos( res );
00163 }
00164
00165 template <typename T> void EvaluationTemplate<T>::Asin( Operator &arg ){
00166
00167 arg.evaluate( this );
00168 res = asin( res );
00169 }
00170
00171 template <typename T> void EvaluationTemplate<T>::Atan( Operator &arg ){
00172
00173 arg.evaluate( this );
00174 res = atan( res );
00175 }
00176
00177 template <typename T> void EvaluationTemplate<T>::Cos( Operator &arg ){
00178
00179 arg.evaluate( this );
00180 res = cos( res );
00181 }
00182
00183 template <typename T> void EvaluationTemplate<T>::Exp( Operator &arg ){
00184
00185 arg.evaluate( this );
00186 res = exp( res );
00187 }
00188
00189 template <typename T> void EvaluationTemplate<T>::Log( Operator &arg ){
00190
00191 arg.evaluate( this );
00192 res = log( res );
00193 }
00194
00195 template <typename T> void EvaluationTemplate<T>::Sin( Operator &arg ){
00196
00197 arg.evaluate( this );
00198 res = sin( res );
00199 }
00200
00201 template <typename T> void EvaluationTemplate<T>::Tan( Operator &arg ){
00202
00203 arg.evaluate( this );
00204 res = tan( res );
00205 }
00206
00207 CLOSE_NAMESPACE_ACADO
00208
00209 #endif