The interface used by all the tape writers. The tape writers are used to generate text, binary, graphical or the math statement files from the current tape. The text and binary files can be used to restore a tape using the codi::TapeReaderInterface in a new context. The writers are supported for both Jacobian and primal value tapes. More...
#include <tapeReaderWriterInterface.hpp>
Public Member Functions | |
virtual void | finish () |
After all the statements have been written, the finish method finalizes the writing process. | |
virtual void | start (Tape &tape) |
Destructor. | |
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 (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. | |
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. | |
The interface used by all the tape writers. The tape writers are used to generate text, binary, graphical or the math statement files from the current tape. The text and binary files can be used to restore a tape using the codi::TapeReaderInterface in a new context. The writers are supported for both Jacobian and primal value tapes.
The user does not access the methods of this interface directly, instead the standard steps are as follows:
1) Record the inputs and outputs of the tape in std::vectors.
2) Use the codi::createWriter() function with a fileName, the input and output vectors and the desired Codi::FileType to create an automatic writer.
3) Call the codi::ReadWriteTapeInterface::writeTape() method with the generated writer.
4) The codi::TapeWriterInterface::start() is called once, after which the relevant codi::TapeWriterInterface::writeStatement() method is called for each of the statements on the tape. After all the statements have been added, the codi::TapeWriterInterface::finish method() is called and the file has been generated.
The createWriter function does not have to be used. Writers can instead be created and managed manually. The manual writers are then passed to the writeTape method. The rest of the procedure remains the same.
T_Type | The CoDiPack type of the tape that is to be written out. |
|
inlinevirtual |
After all the statements have been written, the finish method finalizes the writing process.
Reimplemented in codi::CommonTextTapeWriter< T_Type >, codi::JacobianBinaryTapeWriter< T_Type >, codi::JacobianTextTapeWriter< T_Type >, codi::PrimalBinaryTapeWriter< T_Type >, and codi::PrimalTextTapeWriter< T_Type >.
|
inlinevirtual |
Destructor.
Called once at the beginning of the tape write process. Should initialize all required data structures and files.
Reimplemented in codi::CommonTextTapeWriter< T_Type >, codi::JacobianBinaryTapeWriter< T_Type >, codi::JacobianTextTapeWriter< T_Type >, codi::PrimalBinaryTapeWriter< T_Type >, and codi::PrimalTextTapeWriter< T_Type >.
|
inlinevirtual |
Called for each statement. The method writes the current statement to the file. This overload is used for the Jacobian writers.
Reimplemented in codi::JacobianGraphTapeWriter< T_Type >, codi::JacobianBinaryTapeWriter< T_Type >, and codi::JacobianTextTapeWriter< T_Type >.
|
inlinevirtual |
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.
Reimplemented in codi::PrimalGraphTapeWriter< T_Type >, codi::MathRepWriter< T_Type >, codi::PrimalBinaryTapeWriter< T_Type >, and codi::PrimalTextTapeWriter< T_Type >.