CppADCodeGen
HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
|
Public Member Functions | |
BipartiteGraph (ADFun< CG< Base > > &fun, const std::vector< DaeVarInfo > &varInfo, const std::vector< std::string > &eqName, SimpleLogger &logger) | |
BipartiteGraph (const BipartiteGraph &p)=delete | |
BipartiteGraph & | operator= (const BipartiteGraph &p)=delete |
std::vector< Vnode< Base > * > & | variables () |
const std::vector< Vnode< Base > * > & | variables () const |
std::vector< Enode< Base > * > & | equations () |
const std::vector< Enode< Base > * > & | equations () const |
const std::vector< DaeVarInfo > & | getOriginalVariableInfo () const |
size_t | getOrigTimeDependentCount () const |
void | setPreserveNames (bool p) |
bool | isPreserveNames () const |
size_t | getStructuralIndex () const |
void | printResultInfo (const std::string &method) |
void | uncolorAll () |
Vnode< Base > * | createDerivate (Vnode< Base > &j) |
Enode< Base > * | createDerivate (Enode< Base > &i, bool addOrigVars=true) |
void | remove (const Enode< Base > &i) |
void | dirtyDifferentiateEq (Enode< Base > &i, Enode< Base > &iDiff, bool addOrigVars=true) |
std::unique_ptr< ADFun< CGBase > > | generateNewModel (std::vector< DaeVarInfo > &newVarInfo, std::vector< DaeEquationInfo > &equationInfo, const std::vector< Base > &x) |
std::vector< CppAD::AD< CG< Base > > > | prepareTimeDependentVariables (const std::vector< ADCG > &indepOrig, const std::vector< DaeVarInfo > &newVarInfo, size_t timeTapeIndex) const |
void | printModel (std::ostream &out, ADFun< CG< Base > > *fun) |
void | printModel (std::ostream &out, ADFun< CG< Base > > &fun, const std::vector< DaeVarInfo > &varInfo, const std::vector< DaeEquationInfo > &eqInfo) const |
void | printModel (std::ostream &out, ADFun< CG< Base > > &fun, const std::vector< std::string > &indepNames, const std::vector< std::string > &depNames=std::vector< std::string >()) const |
void | printDot (std::ostream &out) const |
template<class VectorCGB > | |
VectorCGB | forward0 (ADFun< CGBase > &fun, const VectorCGB &indep0) const |
Static Public Member Functions | |
static void | forwardTimeDiff (ADFun< CGBase > &reducedFun, const std::vector< Enode< Base > *> &equations, std::vector< CG< Base > > &dep, size_t tapeTimeIndex) |
static void | reverseTimeDiff (ADFun< CGBase > &reducedFun, const std::vector< Enode< Base > *> &equations, std::vector< CG< Base > > &dep, size_t tapeTimeIndex) |
static std::vector< int > | determineVariableDiffOrder (const std::vector< DaeVarInfo > &varInfo) |
static int | determineVariableDiffOrder (const std::vector< DaeVarInfo > &varInfo, size_t index, size_t &j0) |
Protected Types | |
using | CGBase = CppAD::cg::CG< Base > |
using | ADCG = CppAD::AD< CGBase > |
Protected Attributes | |
ADFun< CG< Base > > *const | fun_ |
std::vector< DaeVarInfo > | varInfo_ |
std::vector< bool > | sparsity_ |
std::vector< Vnode< Base > * > | vnodes_ |
std::vector< Enode< Base > * > | enodes_ |
int | origMaxTimeDivOrder_ |
size_t | origTimeDependentCount_ |
bool | preserveNames_ |
Bipartite graph which holds nodes to represent variables and equations in a DAE system.
Definition at line 30 of file bipartite_graph.hpp.
|
inline |
Creates the bipartite graph.
fun | The DAE model |
varInfo | DAE model variable classification |
eqName | Equation names (it can be an empty vector) |
generate names for the variables
Definition at line 76 of file bipartite_graph.hpp.
|
inline |
Adds edges to a new equation resulting from the differentiation of another assuming the new equation differential contains all variables present in the original equation and their time derivatives (not exactly correct but it works because the potentially extra variables are removed later in the Pantelides method).
An example with incorrectly added variables would be the dirty differentiation of: x1 + x2 == 0 wich include the variables [x1, dx1dt, x2, dx2dt] although it should only be [dx1dt, dx2dt].
i | equation node to differentiate |
CGException |
Definition at line 498 of file bipartite_graph.hpp.
|
inline |
Creates a new tape for the index 1 model
Add the relationship between variables and derivatives
Prepare the output information
generate a new tape
generate the system of equations by repeatedly differentiating and adding equations to the DAE system
register operations from the other equations
register operations used to differentiate the equations
reconstruct the new system of equations
Definition at line 517 of file bipartite_graph.hpp.
|
inline |
Provides the structural index after this graph has been reduced.
Definition at line 314 of file bipartite_graph.hpp.
Referenced by CppAD::cg::DaeStructuralIndexReduction< Base >::getStructuralIndex().
|
inline |
Whether or not original names saved by using CppAD::PrintFor(0, "", val, name) should be kept by also adding PrintFor operations in the reduced model.
Definition at line 305 of file bipartite_graph.hpp.
Referenced by CppAD::cg::DaeStructuralIndexReduction< Base >::isPreserveNames().
|
inline |
Introduces a dependency with respect to time in the provided variables.
indepOrig | The variables without time dependency (in the original variable order). |
Definition at line 784 of file bipartite_graph.hpp.
Referenced by CppAD::cg::BipartiteGraph< Base >::generateNewModel().
|
inline |
Prints out a DAE model to the standard output.
fun | The taped model |
Definition at line 827 of file bipartite_graph.hpp.
|
inline |
Prints out a DAE model to the standard output.
fun | The taped model |
indepNames | The independent variable names |
depNames | The dependent variable names |
generate the source code
Definition at line 855 of file bipartite_graph.hpp.
|
inline |
Completely removes an equation and any variable that is only referenced by this equation from the graph. The equation cannot have a differentiated version of itself in the graph.
remove variable
Definition at line 427 of file bipartite_graph.hpp.
|
inline |
Defines whether or not original names saved by using CppAD::PrintFor(0, "", val, name) should be kept by also adding PrintFor operations in the reduced model.
Definition at line 296 of file bipartite_graph.hpp.
Referenced by CppAD::cg::DaeStructuralIndexReduction< Base >::setPreserveNames().
|
protected |
The original model
Definition at line 38 of file bipartite_graph.hpp.
|
protected |
the maximum order of the time derivatives in the original model
Definition at line 53 of file bipartite_graph.hpp.
Referenced by CppAD::cg::BipartiteGraph< Base >::BipartiteGraph().
|
protected |
the number of time dependent variables in the original model
Definition at line 57 of file bipartite_graph.hpp.
Referenced by CppAD::cg::BipartiteGraph< Base >::BipartiteGraph(), CppAD::cg::BipartiteGraph< Base >::generateNewModel(), and CppAD::cg::BipartiteGraph< Base >::getStructuralIndex().
|
protected |
Defines whether or not original names saved by using CppAD::PrintFor(0, "", val, name) should be kept by also adding PrintFor operations in the reduced model.
Definition at line 63 of file bipartite_graph.hpp.
Referenced by CppAD::cg::BipartiteGraph< Base >::isPreserveNames().
|
protected |
original sparsity pattern
Definition at line 46 of file bipartite_graph.hpp.
|
protected |
DAE variable information for the original system
Definition at line 42 of file bipartite_graph.hpp.
Referenced by CppAD::cg::BipartiteGraph< Base >::BipartiteGraph(), and CppAD::cg::BipartiteGraph< Base >::generateNewModel().