CoDiPack  2.3.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::JacobianTextTapeWriter< T_Type > Struct Template Reference

Writes a Jacobian tape in a text format. More...

#include <jacobianTextReaderWriter.hpp>

Inheritance diagram for codi::JacobianTextTapeWriter< T_Type >:

Public Types

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

void finish ()
 After all the statements have been written, the finish method finalizes the writing process.
 
 JacobianTextTapeWriter (std::string const &name, std::vector< Identifier > const &in, std::vector< Identifier > const &out, bool ifIO, bool ifColumnNames)
 Constructor.
 
void start (Tape &tape)
 Destructor.
 
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::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 &curLhsIdentifier, Real const &primalValue, Config::ArgumentSize const &nPassiveValues, size_t const &curRhsIdentifiersPos, Identifier const *const rhsIdentifiers, size_t const &curPassiveValuePos, Real const *const passiveValues, size_t &curConstantPos, 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

FILE * fileHandleTxt = nullptr
 File handle.
 
bool printColumnNames
 Flag to enable column names.
 
bool printIO
 Flag to enable the writing of the IO file.
 
- Public Attributes inherited from codi::CommonBaseTapeWriter< T_Type >
std::vector< IdentifierinputVariables
 The identifiers which have been registered as inputs.
 
std::vector< IdentifieroutputVariables
 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::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.
 

Detailed Description

template<typename T_Type>
struct codi::JacobianTextTapeWriter< T_Type >

Writes a Jacobian tape in a text format.

The format of the produced "filename".txt file is as follows:

lhsIdentifier(Identifier) numberOfArguments(Config::ArgumentSize) (rhsIdentifiers(Identifier) rhsJacobian(Real) ...
[repeats numberOfArguments times])
uint8_t ArgumentSize
Type for the number of arguments in statements.
Definition config.h:117
typename Type::Identifier Identifier
See TapeWriterInterface.
Definition jacobianTextReaderWriter.hpp:60
typename Type::Real Real
See TapeWriterInterface.
Definition jacobianTextReaderWriter.hpp:61

The writer also generates an additional file "filename"IO.txt for the inputs and outputs of the tape.

See codi::TapeWriterInterface for a general description on how to use tape writers.

Template Parameters
T_TypeThe CoDiPack type of the tape that is to be written out.

Member Function Documentation

◆ finish()

template<typename T_Type >
void codi::JacobianTextTapeWriter< T_Type >::finish ( )
inlinevirtual

After all the statements have been written, the finish method finalizes the writing process.

Reimplemented from codi::TapeWriterInterface< T_Type >.

◆ start()

template<typename T_Type >
void codi::JacobianTextTapeWriter< T_Type >::start ( Tape & tape)
inlinevirtual

Destructor.

Called once at the beginning of the tape write process. Should initialize all required data structures and files.

Reimplemented from codi::TapeWriterInterface< T_Type >.

◆ writeStatement()

template<typename T_Type >
void codi::JacobianTextTapeWriter< T_Type >::writeStatement ( Identifier const & curLhsIdentifier,
size_t & curJacobianPos,
Real const *const rhsJacobians,
Identifier const *const rhsIdentifiers,
Config::ArgumentSize const & nJacobians )
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 >.


The documentation for this struct was generated from the following file: