Public Member Functions | Public Attributes | Private Attributes | List of all members
ScalarExpressionTree Class Reference

Used to hold part of the instance in memory. More...

#include <OSExpressionTree.h>

Inheritance diagram for ScalarExpressionTree:
Inheritance graph
[legend]
Collaboration diagram for ScalarExpressionTree:
Collaboration graph
[legend]

Public Member Functions

 ScalarExpressionTree ()
 default constructor. More...
 
 ~ScalarExpressionTree ()
 default destructor. More...
 
bool IsEqual (ScalarExpressionTree *that)
 A function to check for the equality of two objects. More...
 
std::vector< ExprNode * > getPrefixFromExpressionTree ()
 Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix format. More...
 
std::vector< ExprNode * > getPostfixFromExpressionTree ()
 Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix format. More...
 
std::map< int, int > * getVariableIndicesMap ()
 Retrieve a map of the indices of the variables that are in the expression tree. More...
 
double calculateFunction (double *x, bool new_x)
 Calculate the expression tree function value given the current variable values using the calculateFunction method of OSnLNode. More...
 
- Public Member Functions inherited from OSExpressionTree
 OSExpressionTree ()
 default constructor. More...
 
 ~OSExpressionTree ()
 default destructor. More...
 
bool IsEqual (OSExpressionTree *that)
 A function to check for the equality of two objects. More...
 

Public Attributes

OSnLNodem_treeRoot
 m_treeRoot holds the root node (of OSnLNode type) of the expression tree. More...
 
- Public Attributes inherited from OSExpressionTree
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; the value of the map is the location of the corresponding entry in the sparse Jacobian More...
 
bool m_bIndexMapGenerated
 Retrieve a map of the indices of the variables that are in the expression tree. More...
 
bool bADMustReTape
 is true if an AD Expression Tree has an expression that can change depending on the value of the input, e.g. More...
 
bool bDestroyNlNodes
 m_bDestroyNlNodes is true if the destructor deletes the nodes in the Expression tree More...
 

Private Attributes

double m_dTreeRootValue
 A function to make a deep copy of an instance of this class. More...
 

Detailed Description

Used to hold part of the instance in memory.

Remarks
This class stores the OSiL instance in memory as an expression tree.

Definition at line 99 of file OSExpressionTree.h.

Constructor & Destructor Documentation

ScalarExpressionTree::ScalarExpressionTree ( )

default constructor.

Definition at line 119 of file OSExpressionTree.cpp.

ScalarExpressionTree::~ScalarExpressionTree ( )

default destructor.

Definition at line 129 of file OSExpressionTree.cpp.

Member Function Documentation

bool ScalarExpressionTree::IsEqual ( ScalarExpressionTree that)

A function to check for the equality of two objects.

Definition at line 180 of file OSExpressionTree.cpp.

std::vector< ExprNode * > ScalarExpressionTree::getPrefixFromExpressionTree ( )

Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in prefix format.

Returns
the expression tree as a vector of ExprNodes in prefix.

Definition at line 142 of file OSExpressionTree.cpp.

std::vector< ExprNode * > ScalarExpressionTree::getPostfixFromExpressionTree ( )

Get a vector of pointers to ExprNodes that correspond to a scalar-valued OSExpressionTree in postfix format.

Returns
the expression tree as a vector of ExprNodes in postfix.

Definition at line 148 of file OSExpressionTree.cpp.

std::map< int, int > * ScalarExpressionTree::getVariableIndicesMap ( )

Retrieve a map of the indices of the variables that are in the expression tree.

Returns
a map of the variables in the current expression tree.

Definition at line 154 of file OSExpressionTree.cpp.

double ScalarExpressionTree::calculateFunction ( double *  x,
bool  new_x 
)

Calculate the expression tree function value given the current variable values using the calculateFunction method of OSnLNode.

If the function has been calculated, the method will retrieve it.

Parameters
xholds the values of the variables in a double array.
new_xis false if any evaluation method was previously called for the current x
Returns
the expression tree function value given the current variable values.

Definition at line 165 of file OSExpressionTree.cpp.

Member Data Documentation

OSnLNode* ScalarExpressionTree::m_treeRoot

m_treeRoot holds the root node (of OSnLNode type) of the expression tree.

Definition at line 106 of file OSExpressionTree.h.

double ScalarExpressionTree::m_dTreeRootValue
private

A function to make a deep copy of an instance of this class.

Parameters
that,:the instance from which information is to be copied
Returns
whether the copy was created successfully m_dTreeRootValue is the function value of the root node

Definition at line 195 of file OSExpressionTree.h.


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