NeoPZ
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TPZFileEqnStorage< TVar > Class Template Reference

Has the same porpouse of EqnStack but stores the EqnArrays in a different form (binary files). Frontal. More...

#include <TPZFileEqnStorage.h>

Inheritance diagram for TPZFileEqnStorage< TVar >:
[legend]
Collaboration diagram for TPZFileEqnStorage< TVar >:
[legend]

Public Member Functions

void ReOpen ()
 Reopens an binary file with its current fFileName. More...
 
void Zero ()
 Reinitialize the object. More...
 
void ReadBlockPositions ()
 Method used for binary input/output. More...
 
void FinishWriting ()
 Method used for binary input/output. More...
 
void OpenGeneric (char option, const char *name)
 Sets file name and if it is for input or output, the second term can be either 'r' for input and 'w' for output. More...
 
 TPZFileEqnStorage ()
 Simple constructor. More...
 
 TPZFileEqnStorage (const TPZFileEqnStorage &cp)
 Copy constructor. More...
 
 ~TPZFileEqnStorage ()
 Simple destructor. More...
 
 TPZFileEqnStorage (char option, const std::string &name)
 Constructor with option (can assume "w" or "r") for writing and reading respectively. More...
 
void AddEqnArray (TPZEqnArray< TVar > *EqnArray)
 Adds an EqnArray. More...
 
void Print (const char *name, std::ostream &out) const
 It prints TPZEqnStorage data. More...
 
void Reset ()
 Resets data. More...
 
void Backward (TPZFMatrix< TVar > &f, DecomposeType dec) const
 Executes a Backward substitution. More...
 
void Forward (TPZFMatrix< TVar > &f, DecomposeType dec) const
 Executes a Forward substitution. More...
 
void Store (int ieq, int jeq, const char *name)
 Stores from ieq to jeq equations on a binary file. More...
 
void WriteHeaders ()
 Writes the header of the binary file. More...
 
std::string GetStorage ()
 Type of Storage. More...
 
int ClassId () const override
 Define the class id associated with the class. More...
 
- Public Member Functions inherited from TPZSavable
 TPZSavable ()
 
virtual ~TPZSavable ()
 
virtual std::list< std::map< std::string, uint64_t > > VersionHistory () const
 
virtual std::pair< std::string, uint64_t > Version () const
 
virtual void Write (TPZStream &buf, int withclassid) const
 Writes this object to the TPZStream buffer. Include the classid if withclassid = true. More...
 
virtual void Read (TPZStream &buf, void *context)
 read objects from the stream More...
 
virtual bool Compare (TPZSavable *copy, bool override=false)
 Compares the object for identity with the object pointed to, eventually copy the object. More...
 
virtual bool Compare (TPZSavable *copy, bool override=false) const
 Compares the object for identity with the object pointed to, eventually copy the object. More...
 
- Public Member Functions inherited from TPZRegisterClassId
template<typename T >
 TPZRegisterClassId (int(T::*)() const)
 
 TPZRegisterClassId ()=default
 

Static Public Member Functions

static void main ()
 
- Static Public Member Functions inherited from TPZSavable
static std::set< TPZRestoreClassBase * > & RestoreClassSet ()
 This static function guarantees that the gMap object is available when needed. More...
 
static std::map< int, TPZRestore_t > & ClassIdMap ()
 This static function guarantees that the gMap object is available when needed. More...
 
static std::pair< std::string, uint64_t > NeoPZVersion ()
 
static void Register (TPZRestoreClassBase *restore)
 
static void RegisterClassId (int classid, TPZRestore_t fun)
 
static TPZSavableCreateInstance (const int &classId)
 

Private Attributes

int fNumHeaders
 Indicates the number of headers for the object. More...
 
TPZStack< int64_t > fBlockPos
 Stack containing block positions. More...
 
std::string fFileName
 file name containing binary data More...
 
FILE * fIOStream
 binary file itself More...
 
int fCurrentBlock
 Used with binary input/output aritimethics. More...
 
int fCurBlockPosition
 Used with binary input/output aritimethics. More...
 
int fNumBlocks
 Used with binary input/output aritimethics. More...
 

Detailed Description

template<class TVar>
class TPZFileEqnStorage< TVar >

Has the same porpouse of EqnStack but stores the EqnArrays in a different form (binary files). Frontal.

Definition at line 23 of file TPZFileEqnStorage.h.

Constructor & Destructor Documentation

◆ TPZFileEqnStorage() [1/3]

template<class TVar >
TPZFileEqnStorage< TVar >::TPZFileEqnStorage ( )

◆ TPZFileEqnStorage() [2/3]

template<class TVar >
TPZFileEqnStorage< TVar >::TPZFileEqnStorage ( const TPZFileEqnStorage< TVar > &  cp)

◆ ~TPZFileEqnStorage()

template<class TVar >
TPZFileEqnStorage< TVar >::~TPZFileEqnStorage ( )

Simple destructor.

Definition at line 305 of file TPZFileEqnStorage.cpp.

References TPZFileEqnStorage< TVar >::fFileName.

◆ TPZFileEqnStorage() [3/3]

template<class TVar >
TPZFileEqnStorage< TVar >::TPZFileEqnStorage ( char  option,
const std::string &  name 
)

Constructor with option (can assume "w" or "r") for writing and reading respectively.

Parameters
option'w' means writing and 'r' reading
namethe file name to print to

Opens binary files and get initial information use this information for storage requirements

Writes NumHeaders and NumBlocks information in the two initial positions on fIOStream

Definition at line 266 of file TPZFileEqnStorage.cpp.

References DebugStop, TPZFileEqnStorage< TVar >::fCurBlockPosition, TPZFileEqnStorage< TVar >::fCurrentBlock, TPZFileEqnStorage< TVar >::fFileName, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, TPZFileEqnStorage< TVar >::fNumHeaders, and TPZFileEqnStorage< TVar >::ReadBlockPositions().

Member Function Documentation

◆ AddEqnArray()

template<class TVar >
void TPZFileEqnStorage< TVar >::AddEqnArray ( TPZEqnArray< TVar > *  EqnArray)

Adds an EqnArray.

Parameters
EqnArrayadded to the binary file

Gets actual position on fIOStream

Writes this address on next available header block and sets pointer to its previous position

Definition at line 206 of file TPZFileEqnStorage.cpp.

References LOGPZ_DEBUG, and TPZEqnArray< TVar >::Write().

Referenced by TPZFileEqnStorage< TVar >::main().

◆ Backward()

template<class TVar >
void TPZFileEqnStorage< TVar >::Backward ( TPZFMatrix< TVar > &  f,
DecomposeType  dec 
) const

Executes a Backward substitution.

Parameters
fFull matrix already decomposed
decDecomposition type of f

Definition at line 163 of file TPZFileEqnStorage.cpp.

References DebugStop, TPZEqnArray< TVar >::EqnBackward(), and TPZEqnArray< TVar >::Read().

◆ ClassId()

template<class TVar >
int TPZFileEqnStorage< TVar >::ClassId ( ) const
overridevirtual

Define the class id associated with the class.

This id has to be unique for all classes A non unique id is flagged at the startup of the program

Implements TPZSavable.

Definition at line 131 of file TPZFileEqnStorage.h.

References Hash().

◆ FinishWriting()

template<class TVar >
void TPZFileEqnStorage< TVar >::FinishWriting ( )

◆ Forward()

template<class TVar >
void TPZFileEqnStorage< TVar >::Forward ( TPZFMatrix< TVar > &  f,
DecomposeType  dec 
) const

Executes a Forward substitution.

Parameters
fFull matrix already decomposed
decDecomposition type of f

Definition at line 135 of file TPZFileEqnStorage.cpp.

References TPZEqnArray< TVar >::EqnForward(), and TPZEqnArray< TVar >::Read().

Referenced by TPZFileEqnStorage< TVar >::main().

◆ GetStorage()

template<class TVar >
std::string TPZFileEqnStorage< TVar >::GetStorage ( )

Type of Storage.

Definition at line 581 of file TPZFileEqnStorage.cpp.

◆ main()

template<class TVar >
void TPZFileEqnStorage< TVar >::main ( )
static

◆ OpenGeneric()

template<class TVar >
void TPZFileEqnStorage< TVar >::OpenGeneric ( char  option,
const char *  name 
)

Sets file name and if it is for input or output, the second term can be either 'r' for input and 'w' for output.

Sets file name and if it is for input or output, the second term can be either 'r' for input and 'w' for output.

Parameters
option'w' means writing and 'r' reading
nameThe file name to print to

Opens binary files and get initial information use this information for storage requirements

Writes NumHeaders and NumBlocks information in the two initial positions on fIOStream

Definition at line 494 of file TPZFileEqnStorage.cpp.

References DebugStop, TPZFileEqnStorage< TVar >::fCurBlockPosition, TPZFileEqnStorage< TVar >::fCurrentBlock, TPZFileEqnStorage< TVar >::fFileName, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, TPZFileEqnStorage< TVar >::fNumHeaders, and TPZFileEqnStorage< TVar >::ReadBlockPositions().

◆ Print()

template<class TVar >
void TPZFileEqnStorage< TVar >::Print ( const char *  name,
std::ostream &  out 
) const

It prints TPZEqnStorage data.

Parameters
nameFile name to print to
outofstream object name

Definition at line 191 of file TPZFileEqnStorage.cpp.

References TPZEqnArray< TVar >::Print(), and TPZEqnArray< TVar >::Read().

Referenced by TPZFileEqnStorage< TVar >::main().

◆ ReadBlockPositions()

template<class TVar >
void TPZFileEqnStorage< TVar >::ReadBlockPositions ( )

◆ ReOpen()

template<class TVar >
void TPZFileEqnStorage< TVar >::ReOpen ( )

Reopens an binary file with its current fFileName.

Opens binary files and get initial information use this information for storage requirements

Definition at line 471 of file TPZFileEqnStorage.cpp.

References DebugStop, TPZFileEqnStorage< TVar >::fFileName, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, TPZFileEqnStorage< TVar >::fNumHeaders, and LOGPZ_DEBUG.

Referenced by TPZFileEqnStorage< TVar >::main().

◆ Reset()

template<class TVar >
void TPZFileEqnStorage< TVar >::Reset ( )

Resets data.

Definition at line 185 of file TPZFileEqnStorage.cpp.

◆ Store()

template<class TVar >
void TPZFileEqnStorage< TVar >::Store ( int  ieq,
int  jeq,
const char *  name 
)

Stores from ieq to jeq equations on a binary file.

Parameters
ieqInitial equation to be added to EqnArray
jeqFinal equation to be added to EqnArray
nameBinary file name

Definition at line 95 of file TPZFileEqnStorage.cpp.

References DebugStop, and val().

◆ WriteHeaders()

template<class TVar >
void TPZFileEqnStorage< TVar >::WriteHeaders ( )

Writes the header of the binary file.

Updates fNumBlocks information each time WriteHeaders is called

If fCurrentBlock = 0 then a fBlockPos.Push must be called to store the first address

Writes fNumHeaders positions for the headers

Get starting position of first header

Writes first position the address of block one

Sets fCurBlockPosition to actual address

Return the pointer to the actual position

Definition at line 22 of file TPZFileEqnStorage.cpp.

References TPZVec< T >::begin(), and LOGPZ_DEBUG.

◆ Zero()

template<class TVar >
void TPZFileEqnStorage< TVar >::Zero ( )

Member Data Documentation

◆ fBlockPos

template<class TVar >
TPZStack<int64_t> TPZFileEqnStorage< TVar >::fBlockPos
private

Stack containing block positions.

Definition at line 115 of file TPZFileEqnStorage.h.

Referenced by TPZFileEqnStorage< TVar >::ReadBlockPositions(), and TPZFileEqnStorage< TVar >::Zero().

◆ fCurBlockPosition

template<class TVar >
int TPZFileEqnStorage< TVar >::fCurBlockPosition
private

Used with binary input/output aritimethics.

Definition at line 125 of file TPZFileEqnStorage.h.

Referenced by TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), and TPZFileEqnStorage< TVar >::Zero().

◆ fCurrentBlock

template<class TVar >
int TPZFileEqnStorage< TVar >::fCurrentBlock
private

Used with binary input/output aritimethics.

Definition at line 123 of file TPZFileEqnStorage.h.

Referenced by TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), and TPZFileEqnStorage< TVar >::Zero().

◆ fFileName

template<class TVar >
std::string TPZFileEqnStorage< TVar >::fFileName
private

◆ fIOStream

template<class TVar >
FILE* TPZFileEqnStorage< TVar >::fIOStream
private

◆ fNumBlocks

template<class TVar >
int TPZFileEqnStorage< TVar >::fNumBlocks
private

◆ fNumHeaders

template<class TVar >
int TPZFileEqnStorage< TVar >::fNumHeaders
private

The documentation for this class was generated from the following files: