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

Reads and restores a text file for a primal value tape. More...

#include <primalTextReaderWriter.hpp>

Inheritance diagram for codi::PrimalTextTapeReader< T_Type >:

Public Types

using Identifier = typename Type::Identifier
 See TapeReaderInterface.
 
using Real = typename Type::Real
 See TapeReaderInterface.
 
using Tape = typename Type::Tape
 See TapeReaderInterface.
 
using Type = T_Type
 See TapeWriterInterface.
 
- Public Types inherited from codi::CommonBaseTapeReader< T_Type >
using Identifier = typename Type::Identifier
 See TapeReaderInterface.
 
using Tape = typename Type::Tape
 See TapeReaderInterface.
 
using Type = T_Type
 See TapeReaderInterface.
 
- Public Types inherited from codi::TapeReaderInterface< T_Type >
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 restored.
 
using Type = T_Type
 The evaluation type.
 

Public Member Functions

 PrimalTextTapeReader (std::vector< typename Tape::EvalHandle > const &handles)
 Constructor.
 
void readFile (std::string const &name)
 This method uses the the fileName to reproduce a valid tape.
 
void restorePrimals ()
 Read and record the primal values from the sparse primal vector stored in "filename"Primals.txt
 
- Public Member Functions inherited from codi::TapeReaderInterface< T_Type >
virtual ~TapeReaderInterface ()
 Destructor.
 
- 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

std::vector< typename Tape::EvalHandle > evalHandles
 Contains the unique evalHandles.
 
- Public Attributes inherited from codi::CommonBaseTapeReader< T_Type >
std::vector< IdentifierinputVariables
 Stores the restored input variables from the tape file.
 
Identifier largestIndex
 The largest index on the stored tape.
 
size_t nInputs
 Size of the input vector.
 
size_t nOutputs
 Size of the output vector.
 
std::vector< IdentifieroutputVariables
 Stores the restored output variables from the tape file.
 
Tape tape
 The newly resorted tape.
 
- 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::CommonBaseTapeReader< T_Type >
std::vector< Identifier > const & getInputs () const &
 Used to get the restored inputs of the tape.
 
std::vector< Identifier > const & getOutputs () const &
 
TapegetTape ()
 Used to get a reference to the restored tape.
 
void restoreIoBinary ()
 Restore the IO for the binary readers.
 
void restoreIoText ()
 Constructor.
 
void updateUserIO (Identifier const &linearOffset)
 This method is used to remove any offset and to update the largest created index.
 

Detailed Description

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

Reads and restores a text file for a primal value tape.

The reader uses the "filename".txt file to restore the statements and the "filename"IO.txt to restore the inputs and outputs of the tape.

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

lhsIdentifier(Identifier) primalValue(Real) nPassiveValues(Config::ArgumentSize)
numberOfActiveArguments(Config::ArgumentSize) (rhsIdentifiers(Identifier) ... [repeats numberOfArguments times])
(passiveValues(Real) ... [repeats nPassiveValues times]) numberOfConstantArguments(Config::ArgumentSize)
(constantValues(Real) ... [repeats numberOfConstantArguments times]) evalHandleKey(EvalHandle)
uint8_t ArgumentSize
Type for the number of arguments in statements.
Definition config.h:117
typename Type::Identifier Identifier
See TapeReaderInterface.
Definition primalTextReaderWriter.hpp:204
typename Type::Real Real
See TapeReaderInterface.
Definition primalTextReaderWriter.hpp:205

The primal values are read from the "filename"Primals.txt file.

The EvalHandles are created in the "filename".hpp file, which should be included for the read process.

See codi::TapeReaderInterface for a general description on how to use primal value tape readers.

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

Member Function Documentation

◆ readFile()

template<typename T_Type >
void codi::PrimalTextTapeReader< T_Type >::readFile ( std::string const & name)
inlinevirtual

This method uses the the fileName to reproduce a valid tape.

Reimplemented from codi::TapeReaderInterface< T_Type >.


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