Generates a graphical .dot file for a Jacobian tape. More...
#include <graphWriters.hpp>

Public Types | |
| using | Base = CommonTextTapeWriter<T_Type> |
| See CommonTextTapeWriter. | |
| using | Identifier = typename Type::Identifier |
| See TapeWriterInterface. | |
| using | Real = typename Type::Real |
| See TapeWriterInterface. | |
| using | Tape = typename Type::Tape |
| See TapeWriterInterface. | |
| using | Type = T_Type |
| See TapeWriterInterface. | |
Public Types inherited from codi::CommonTextTapeWriter< T_Type > | |
| using | Base = CommonBaseTapeWriter<T_Type> |
| See CommonBaseTapeWriter. | |
| using | Identifier = typename Type::Identifier |
| See TapeWriterInterface. | |
| using | Real = typename Type::Real |
| See TapeWriterInterface. | |
| using | Tape = typename Type::Tape |
| See TapeWriterInterface. | |
| using | Type = T_Type |
| See TapeWriterInterface. | |
Public Types inherited from codi::CommonBaseTapeWriter< T_Type > | |
| using | Identifier = typename Type::Identifier |
| See TapeWriterInterface. | |
| using | Tape = typename Type::Tape |
| See TapeWriterInterface. | |
| using | Type = T_Type |
| See TapeWriterInterface. | |
Public Types inherited from codi::TapeWriterInterface< T_Type > | |
| using | EvalHandle = typename Tape::EvalHandle |
| Evaluation handle used for primal value tapes. | |
| using | Identifier = typename Type::Identifier |
| Identifier for the internal management, e.g. int. | |
| using | Real = typename Type::Real |
| Primal computation type, e.g. double. | |
| using | Tape = typename Type::Tape |
| The tape type that is to be written out. | |
| using | Type = T_Type |
| The evaluation type. | |
Public Member Functions | |
| JacobianGraphTapeWriter (std::string const &name, std::vector< Identifier > const &in, std::vector< Identifier > const &out, bool ifJacobians) | |
| Constructor. | |
| void | writeStatement (Identifier const &curLhsIdentifier, size_t &curJacobianPos, Real const *const rhsJacobians, Identifier const *const rhsIdentifiers, Config::ArgumentSize const &nJacobians) |
| Called for each statement. The method writes the current statement to the file. This overload is used for the Jacobian writers. | |
Public Member Functions inherited from codi::CommonTextTapeWriter< T_Type > | |
| CommonTextTapeWriter (bool writeDotHeaderFooter, std::string const &name, std::vector< Identifier > const &in, std::vector< Identifier > const &out) | |
| Constructor. | |
| void | finish () |
| After all the statements have been written, the finish method finalizes the writing process. | |
| void | start (Tape &tape) |
| Destructor. | |
Public Member Functions inherited from codi::CommonBaseTapeWriter< T_Type > | |
| CommonBaseTapeWriter (std::string const &name, std::vector< Identifier > const &in, std::vector< Identifier > const &out) | |
| Constructor. | |
Public Member Functions inherited from codi::TapeWriterInterface< T_Type > | |
| virtual void | writeLowLevelFunction (size_t &curLLFByteDataPos, char *dataPtr, size_t &curLLFInfoDataPos, Config::LowLevelFunctionToken *const tokenPtr, Config::LowLevelFunctionDataSize *const dataSizePtr) |
| Used for statements that contain a low level function. | |
| virtual void | writeStatement (WriteInfo const &info, Identifier const *lhsIdentifiers, Real const *lhsPrimalValues, Config::ArgumentSize const &nPassiveValues, Identifier const *const rhsIdentifiers, Real const *const passiveValues, Real const *const constantValues, EvalHandle stmtEvalHandle) |
| Called for each statement. The method writes the current statement to the file. This overload is used for the primal value writers and contains additional arguments, such as the WriteInfo. | |
Public Member Functions inherited from codi::CommonReaderWriterMethods | |
| CommonReaderWriterMethods () | |
| Constructor. | |
| CommonReaderWriterMethods (std::string const &name) | |
| Constructor. | |
| std::string | modifyFileName (std::string const &suffix) |
| Remove the file extension and replace it with a new suffix. | |
| void | openFile (FILE *&fileHandle, std::string const &name, std::string const &mode) |
Public Attributes | |
| bool | printJacobians |
| Flag that enables the jacobians on the edges in the graph. | |
Public Attributes inherited from codi::CommonTextTapeWriter< T_Type > | |
| Identifier | aggregateCounter |
| Counts up or types of aggregate nodes. | |
| FILE * | fileHandleGraph = nullptr |
| The handle for the writer. | |
| std::vector< Identifier > | identifierExtensions |
| std::vector< Identifier > | identifierPrefix |
| Used to prefix nodes of aggregated types. Zero means no prefix. | |
| std::vector< IdentifierType > | identifierType |
| bool | lastNodeWasAggregate |
| Indicates if the lats created node was for an aggreate. | |
| bool | writeDotHeaderFooter |
| This flag sets toggles the heading and color index. | |
Public Attributes inherited from codi::CommonBaseTapeWriter< T_Type > | |
| std::vector< Identifier > | inputVariables |
| The identifiers which have been registered as inputs. | |
| std::vector< Identifier > | outputVariables |
| The identifiers which have been registered as outputs. | |
Public Attributes inherited from codi::CommonReaderWriterMethods | |
| std::string | fileName |
| The base file name provided by the user. | |
Additional Inherited Members | |
Protected Member Functions inherited from codi::CommonTextTapeWriter< T_Type > | |
| void | createEdge (Identifier const &from, std::string const &to, std::string const &label="") |
| Return a string that creates an edge between two nodes in the .dot language. | |
| std::string | createNode (size_t nIdentifiers, Identifier const *identifiers, std::string const &label) |
| Creates a new node for a given Identifier and label. | |
| std::string | formatAggregateName (Identifier const &aggregate) |
| Create the prefix for a node name. | |
| std::string | formatNodeLabel (Identifier const &identifier) |
| Return a string with the current identifier type and the identifier value. | |
| std::string | formatNodeName (Identifier const &identifier, int extensionOffset=0) |
| Add the identifier extension of the identifier to the node name. | |
| std::string | formatNodeNameForLink (Identifier const &identifier) |
| Prefixes the node name with the prefix for the identifier. | |
| std::string | formatNodePrefix (Identifier const &identifier) |
| Create the prefix for a node name. | |
| std::string | modifyMathRep (std::string const &mathRep, Identifier const *const rhsIdentifiers, size_t const &nActiveValues) |
Replaces all general identifiers in the math representation with the input, output or temporary annotation. E.g. x42 -> Y42 for a variable tagged as output. | |
| std::string | nodeColorProperties (Identifier const &identifier) |
| Returns the color for a given identifier. | |
| void | placeUnusedRhsNodes (Identifier const *const rhsIdentifiers, Config::ArgumentSize const &nArguments) |
| Ensure that all the nodes on the rhs have been placed in the .dot file before creating edges to them. | |
| void | replaceAll (std::string &str, const std::string &search, const std::string &replace) |
Replaces all substrings of search with replace in str. | |
| void | updateLhsIdentifiers (size_t nIdentifiers, Identifier const *identifiers) |
| Update the identifiers extension and the prefix. | |
Protected Member Functions inherited from codi::CommonBaseTapeWriter< T_Type > | |
| void | printIoBinary (Tape &tape) |
| Generate the IO file in a binary format. | |
| void | printIoText (Tape &tape) |
| Generate the IO file in a text format. | |
Generates a graphical .dot file for a Jacobian tape.
An example of how Nodes and Edges are produced in the .dot file:
Nodes: A35_1 [label = "T35"]; The T35 indicates that identifier 35 is a temporary variable.
Edges: A35_1 -> A56_2 [label="0.909297"]; The extension is used to record multiple unique nodes for a identifier and the label represents the Jacobian.
See codi::CommonTextTapeWriter for the methods that are used in this class. See codi::TapeWriterInterface for a general description on how to use tape writers.
| T_Type | The CoDiPack type of the tape that is to be written out. |
|
inlinevirtual |
Called for each statement. The method writes the current statement to the file. This overload is used for the Jacobian writers.
Reimplemented from codi::TapeWriterInterface< T_Type >.