NeoPZ
|
Has the same porpouse of EqnStack but stores the EqnArrays in a different form (binary files). Frontal. More...
#include <TPZFileEqnStorage.h>
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 TPZSavable * | CreateInstance (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... | |
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.
TPZFileEqnStorage< TVar >::TPZFileEqnStorage | ( | ) |
Simple constructor.
Writes NumHeaders and NumBlocks information in the two initial positions on fIOStream
Definition at line 367 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::fCurBlockPosition, TPZFileEqnStorage< TVar >::fCurrentBlock, TPZFileEqnStorage< TVar >::fFileName, filenamestorage, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, and TPZFileEqnStorage< TVar >::fNumHeaders.
TPZFileEqnStorage< TVar >::TPZFileEqnStorage | ( | const TPZFileEqnStorage< TVar > & | cp | ) |
Copy constructor.
Writes NumHeaders and NumBlocks information in the two initial positions on fIOStream
Definition at line 400 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::fCurBlockPosition, TPZFileEqnStorage< TVar >::fCurrentBlock, TPZFileEqnStorage< TVar >::fFileName, filenamestorage, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, and TPZFileEqnStorage< TVar >::fNumHeaders.
TPZFileEqnStorage< TVar >::~TPZFileEqnStorage | ( | ) |
Simple destructor.
Definition at line 305 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::fFileName.
TPZFileEqnStorage< TVar >::TPZFileEqnStorage | ( | char | option, |
const std::string & | name | ||
) |
Constructor with option (can assume "w" or "r") for writing and reading respectively.
option | 'w' means writing and 'r' reading |
name | the 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().
void TPZFileEqnStorage< TVar >::AddEqnArray | ( | TPZEqnArray< TVar > * | EqnArray | ) |
Adds an EqnArray.
EqnArray | added 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().
void TPZFileEqnStorage< TVar >::Backward | ( | TPZFMatrix< TVar > & | f, |
DecomposeType | dec | ||
) | const |
Executes a Backward substitution.
f | Full matrix already decomposed |
dec | Decomposition type of f |
Definition at line 163 of file TPZFileEqnStorage.cpp.
References DebugStop, TPZEqnArray< TVar >::EqnBackward(), and TPZEqnArray< TVar >::Read().
|
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().
void TPZFileEqnStorage< TVar >::FinishWriting | ( | ) |
Method used for binary input/output.
Definition at line 533 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, and LOGPZ_DEBUG.
Referenced by TPZFileEqnStorage< TVar >::main(), and TPZFileEqnStorage< TVar >::Zero().
void TPZFileEqnStorage< TVar >::Forward | ( | TPZFMatrix< TVar > & | f, |
DecomposeType | dec | ||
) | const |
Executes a Forward substitution.
f | Full matrix already decomposed |
dec | Decomposition type of f |
Definition at line 135 of file TPZFileEqnStorage.cpp.
References TPZEqnArray< TVar >::EqnForward(), and TPZEqnArray< TVar >::Read().
Referenced by TPZFileEqnStorage< TVar >::main().
std::string TPZFileEqnStorage< TVar >::GetStorage | ( | ) |
Type of Storage.
Definition at line 581 of file TPZFileEqnStorage.cpp.
|
static |
Static main for testing
Definition at line 311 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::AddEqnArray(), TPZEqnArray< TVar >::AddTerm(), TPZEqnArray< TVar >::BeginEquation(), ECholesky, TPZEqnArray< TVar >::EndEquation(), test::f, stats::filename, TPZFileEqnStorage< TVar >::FinishWriting(), TPZFileEqnStorage< TVar >::Forward(), input, TPZFileEqnStorage< TVar >::Print(), TPZMatrix< TVar >::Print(), and TPZFileEqnStorage< TVar >::ReOpen().
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.
option | 'w' means writing and 'r' reading |
name | The 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().
void TPZFileEqnStorage< TVar >::Print | ( | const char * | name, |
std::ostream & | out | ||
) | const |
It prints TPZEqnStorage data.
name | File name to print to |
out | ofstream object name |
Definition at line 191 of file TPZFileEqnStorage.cpp.
References TPZEqnArray< TVar >::Print(), and TPZEqnArray< TVar >::Read().
Referenced by TPZFileEqnStorage< TVar >::main().
void TPZFileEqnStorage< TVar >::ReadBlockPositions | ( | ) |
Method used for binary input/output.
Definition at line 547 of file TPZFileEqnStorage.cpp.
References DebugStop, TPZFileEqnStorage< TVar >::fBlockPos, TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, TPZFileEqnStorage< TVar >::fNumHeaders, LOGPZ_DEBUG, and TPZManVector< T, NumExtAlloc >::Resize().
Referenced by TPZFileEqnStorage< TVar >::OpenGeneric(), and TPZFileEqnStorage< TVar >::TPZFileEqnStorage().
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().
void TPZFileEqnStorage< TVar >::Reset | ( | ) |
Resets data.
Definition at line 185 of file TPZFileEqnStorage.cpp.
void TPZFileEqnStorage< TVar >::Store | ( | int | ieq, |
int | jeq, | ||
const char * | name | ||
) |
Stores from ieq to jeq equations on a binary file.
ieq | Initial equation to be added to EqnArray |
jeq | Final equation to be added to EqnArray |
name | Binary file name |
Definition at line 95 of file TPZFileEqnStorage.cpp.
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.
void TPZFileEqnStorage< TVar >::Zero | ( | ) |
Reinitialize the object.
Writes NumHeaders and NumBlocks information in the two initial positions on fIOStream
Definition at line 433 of file TPZFileEqnStorage.cpp.
References TPZFileEqnStorage< TVar >::fBlockPos, TPZFileEqnStorage< TVar >::fCurBlockPosition, TPZFileEqnStorage< TVar >::fCurrentBlock, TPZFileEqnStorage< TVar >::fFileName, filenamestorage, TPZFileEqnStorage< TVar >::FinishWriting(), TPZFileEqnStorage< TVar >::fIOStream, TPZFileEqnStorage< TVar >::fNumBlocks, TPZFileEqnStorage< TVar >::fNumHeaders, and TPZManVector< T, NumExtAlloc >::Resize().
|
private |
Stack containing block positions.
Definition at line 115 of file TPZFileEqnStorage.h.
Referenced by TPZFileEqnStorage< TVar >::ReadBlockPositions(), and TPZFileEqnStorage< TVar >::Zero().
|
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().
|
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().
|
private |
file name containing binary data
Definition at line 118 of file TPZFileEqnStorage.h.
Referenced by TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::ReOpen(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), TPZFileEqnStorage< TVar >::Zero(), and TPZFileEqnStorage< TVar >::~TPZFileEqnStorage().
|
private |
binary file itself
Definition at line 121 of file TPZFileEqnStorage.h.
Referenced by TPZFileEqnStorage< TVar >::FinishWriting(), TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::ReadBlockPositions(), TPZFileEqnStorage< TVar >::ReOpen(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), and TPZFileEqnStorage< TVar >::Zero().
|
private |
Used with binary input/output aritimethics.
Definition at line 127 of file TPZFileEqnStorage.h.
Referenced by TPZFileEqnStorage< TVar >::FinishWriting(), TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::ReadBlockPositions(), TPZFileEqnStorage< TVar >::ReOpen(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), and TPZFileEqnStorage< TVar >::Zero().
|
private |
Indicates the number of headers for the object.
In blocks position
Definition at line 112 of file TPZFileEqnStorage.h.
Referenced by TPZFileEqnStorage< TVar >::OpenGeneric(), TPZFileEqnStorage< TVar >::ReadBlockPositions(), TPZFileEqnStorage< TVar >::ReOpen(), TPZFileEqnStorage< TVar >::TPZFileEqnStorage(), and TPZFileEqnStorage< TVar >::Zero().