OS  2.10.2
OSExpressionTree.h
Go to the documentation of this file.
1 /* $Id: OSExpressionTree.h 5284 2017-12-08 13:52:50Z stefan $ */
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 
189  //bool deepCopyFrom(ScalarExpressionTree *that);
190 
191 private:
195  double m_dTreeRootValue;
196 };//end ScalarExpressionTree
197 
198 
209 {
210 public:
215 
220 
225 
229  bool IsEqual(MatrixExpressionTree *that);
230 
239  std::vector<ExprNode*> getPrefixFromExpressionTree();
240 
249  std::vector<ExprNode*> getPostfixFromExpressionTree();
250 
259  //std::map<int, int> *getVariableIndicesMap();
260 
261 #if 0
262 
266 
271  bool bADMustReTape;
272 
276  bool bDestroyNlNodes;
277 
289  double calculateFunction( double *x, bool new_x);
290 #endif
291 
292 private:
293 
297  //double m_dTreeRootValue;
298 };//end MatrixExpressionTree
299 
300 #endif
301 
ScalarExpressionTree::~ScalarExpressionTree
~ScalarExpressionTree()
default destructor.
MatrixExpressionTree::m_treeRoot
OSnLMNode * m_treeRoot
m_treeRoot holds the root node (of OSnLMNode type) of the expression tree.
Definition: OSExpressionTree.h:214
OSExpressionTree::mapVarIdx
std::map< int, int > * mapVarIdx
m_mapVarIdx is a map used to generate the infix expression for AD the key is idx,...
Definition: OSExpressionTree.h:55
OSExpressionTree
Used to hold the instance in memory.
Definition: OSExpressionTree.h:37
ScalarExpressionTree::m_treeRoot
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
Definition: OSExpressionTree.h:106
ScalarExpressionTree::calculateFunction
double calculateFunction(double *x, bool new_x)
Calculate the expression tree function value given the current variable values using the calculateFun...
ExprNode
A generic class from which we derive both OSnLNode and OSnLMNode.
Definition: OSnLNode.h:56
OSnLMNode
The OSnLMNode Class for nonlinear expressions involving matrices.
Definition: OSnLNode.h:1760
ScalarExpressionTree::ScalarExpressionTree
ScalarExpressionTree()
default constructor.
MatrixExpressionTree::getPrefixFromExpressionTree
std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix f...
OSExpressionTree::m_bIndexMapGenerated
bool m_bIndexMapGenerated
Retrieve a map of the indices of the variables that are in the expression tree.
Definition: OSExpressionTree.h:70
OSExpressionTree::IsEqual
bool IsEqual(OSExpressionTree *that)
A function to check for the equality of two objects.
MatrixExpressionTree::~MatrixExpressionTree
~MatrixExpressionTree()
default destructor.
OSnLNode
The OSnLNode Class for nonlinear expressions.
Definition: OSnLNode.h:179
OSExpressionTree::bADMustReTape
bool bADMustReTape
is true if an AD Expression Tree has an expression that can change depending on the value of the inpu...
Definition: OSExpressionTree.h:76
MatrixExpressionTree
Used to hold the instance in memory.
Definition: OSExpressionTree.h:208
ScalarExpressionTree::IsEqual
bool IsEqual(ScalarExpressionTree *that)
A function to check for the equality of two objects.
MatrixExpressionTree::IsEqual
bool IsEqual(MatrixExpressionTree *that)
A function to check for the equality of two objects.
ScalarExpressionTree::getVariableIndicesMap
std::map< int, int > * getVariableIndicesMap()
Retrieve a map of the indices of the variables that are in the expression tree.
OSExpressionTree::~OSExpressionTree
~OSExpressionTree()
default destructor.
OSExpressionTree::OSExpressionTree
OSExpressionTree()
default constructor.
MatrixExpressionTree::MatrixExpressionTree
MatrixExpressionTree()
default constructor.
OSExpressionTree::bDestroyNlNodes
bool bDestroyNlNodes
m_bDestroyNlNodes is true if the destructor deletes the nodes in the Expression tree
Definition: OSExpressionTree.h:81
ScalarExpressionTree::getPostfixFromExpressionTree
std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix ...
ScalarExpressionTree::getPrefixFromExpressionTree
std::vector< ExprNode * > getPrefixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix f...
MatrixExpressionTree::getPostfixFromExpressionTree
std::vector< ExprNode * > getPostfixFromExpressionTree()
Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix ...
ScalarExpressionTree
Used to hold part of the instance in memory.
Definition: OSExpressionTree.h:99
OSnLNode.h
This file defines the OSnLNode class along with its derived classes.