OS  2.9.3
OSExpressionTree.h
Go to the documentation of this file.
1 /* $Id: OSExpressionTree.h 4960 2015-02-23 00:40:11Z tkr $ */
15 #ifndef EXPRESSIONTREE_H
16 #define EXPRESSIONTREE_H
17 
18 #include "OSnLNode.h"
19 #include <vector>
20 #include <map>
21 
22 class ExprNode;
23 class OSnLNode;
24 class OSnLMNode;
25 
38 {
39 public:
44 
49 
55  std::map<int, int> *mapVarIdx;
56 
65  //virtual std::map<int, int> *getVariableIndicesMap();
66 
71 
77 
82 
86  bool IsEqual(OSExpressionTree *that);
87 };//end OSExpressionTree
88 
89 
100 {
101 public:
102 
107 
112 
117 
121  bool IsEqual(ScalarExpressionTree *that);
122 
131  std::vector<ExprNode*> getPrefixFromExpressionTree();
132 
141  std::vector<ExprNode*> getPostfixFromExpressionTree();
142 
151  std::map<int, int> *getVariableIndicesMap();
152 
153 #if 0
154 
158 
163  bool bADMustReTape;
164 
168  bool bDestroyNlNodes;
169 #endif
170 
182  double calculateFunction( double *x, bool new_x);
183 
184 private:
188  double m_dTreeRootValue;
189 };//end ScalarExpressionTree
190 
191 
202 {
203 public:
208 
213 
218 
222  bool IsEqual(MatrixExpressionTree *that);
223 
232  std::vector<ExprNode*> getPrefixFromExpressionTree();
233 
242  std::vector<ExprNode*> getPostfixFromExpressionTree();
243 
252  //std::map<int, int> *getVariableIndicesMap();
253 
254 #if 0
255 
259 
264  bool bADMustReTape;
265 
269  bool bDestroyNlNodes;
270 
282  double calculateFunction( double *x, bool new_x);
283 #endif
284 
285 private:
286 
290  //double m_dTreeRootValue;
291 };//end MatrixExpressionTree
292 
293 #endif
294 
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
~ScalarExpressionTree()
default destructor.
Used to hold the instance in memory.
bool m_bIndexMapGenerated
Retrieve a map of the indices of the variables that are in the expression tree.
The OSnLMNode Class for nonlinear expressions involving matrices.
Definition: OSnLNode.h:1765
ScalarExpressionTree()
default constructor.
OSExpressionTree()
default constructor.
~OSExpressionTree()
default destructor.
std::map< int, int > * getVariableIndicesMap()
Retrieve a map of the indices of the variables that are in the expression tree.
bool IsEqual(OSExpressionTree *that)
A function to check for the equality of two objects.
bool bDestroyNlNodes
m_bDestroyNlNodes is true if the destructor deletes the nodes in the Expression tree ...
bool IsEqual(MatrixExpressionTree *that)
A function to check for the equality of two objects.
Used to hold part of the instance in memory.
std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix f...
Used to hold the instance in memory.
std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix f...
bool IsEqual(ScalarExpressionTree *that)
A function to check for the equality of two objects.
A generic class from which we derive both OSnLNode and OSnLMNode.
Definition: OSnLNode.h:56
This file defines the OSnLNode class along with its derived classes.
std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix ...
OSnLMNode * m_treeRoot
m_treeRoot holds the root node (of OSnLMNode type) of the expression tree.
std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix ...
double calculateFunction(double *x, bool new_x)
Calculate the expression tree function value given the current variable values using the calculateFun...
MatrixExpressionTree()
default constructor.
~MatrixExpressionTree()
default destructor.
std::map< int, int > * mapVarIdx
m_mapVarIdx is a map used to generate the infix expression for AD the key is idx, a variable number; ...
bool bADMustReTape
is true if an AD Expression Tree has an expression that can change depending on the value of the inpu...
The OSnLNode Class for nonlinear expressions.
Definition: OSnLNode.h:192