00001 00017 #ifndef EXPRESSIONTREE_H 00018 #define EXPRESSIONTREE_H 00019 00020 #include "OSnLNode.h" 00021 #include <vector> 00022 #include <map> 00023 #include<cppad/cppad.hpp> 00024 using CppAD::Parameter; 00025 00035 class OSExpressionTree{ 00036 00037 public: 00038 00042 OSnLNode *m_treeRoot; 00043 00047 OSExpressionTree(); 00048 00052 ~OSExpressionTree(); 00053 00066 double calculateFunction( double *x, bool new_x); 00067 00068 00077 std::vector<OSnLNode*> getPrefixFromExpressionTree(); 00078 00087 std::vector<OSnLNode*> getPostfixFromExpressionTree(); 00088 00089 00090 00097 std::map<int, int> *mapVarIdx; 00098 00107 std::map<int, int> *getVariableIndiciesMap(); 00111 bool m_bIndexMapGenerated; 00112 00117 bool bCppADMustReTape; 00118 00122 bool bDestroyNlNodes; 00123 00124 00125 private: 00126 00130 std::map<int, int>::iterator m_mPosVarIdx; 00131 00135 CppAD::AD<double> m_CppADTape; 00136 00137 00141 double m_dTreeRootValue; 00142 00143 00144 00145 };//end OSExpressionTree 00146 00147 00148 00149 00150 #endif 00151