xc
|
used in the program to store/restore the geometry and state information in the domain at particular instances. More...
#include <FileDatastore.h>
Public Member Functions | |
FileDatastore (const std::string &dataBase, Preprocessor &preprocessor, FEM_ObjectBroker &theBroker) | |
Constructor. More... | |
~FileDatastore (void) | |
Destructor. More... | |
int | sendMsg (int dbTag, int commitTag, const Message &, ChannelAddress *theAddress=0) |
Prints an error message and returns \(-1\) as not yet implemented. | |
int | recvMsg (int dbTag, int commitTag, Message &, ChannelAddress *theAddress=0) |
Prints an error message and returns \(-1\) as not yet implemented. | |
int | sendMatrix (int dbTag, int commitTag, const Matrix &, ChannelAddress *theAddress=nullptr) |
Send (write) the matrix. More... | |
int | recvMatrix (int dbTag, int commitTag, Matrix &, ChannelAddress *theAddress=nullptr) |
Receive (read) the matrix. More... | |
int | sendVector (int dbTag, int commitTag, const Vector &, ChannelAddress *theAddress=nullptr) |
Send (write) the vector. More... | |
int | recvVector (int dbTag, int commitTag, Vector &, ChannelAddress *theAddress=nullptr) |
Receive (read) the vector. More... | |
int | sendID (int dbTag, int commitTag, const ID &, ChannelAddress *theAddress=nullptr) |
Send (write) the ID. More... | |
int | recvID (int dbTag, int commitTag, ID &, ChannelAddress *theAddress=nullptr) |
Receive (read) the ID. More... | |
int | createTable (const std::string &tableName, const std::vector< std::string > &columns) |
int | insertData (const std::string &tableName, const std::vector< std::string > &columns, int commitTag, const Vector &) |
int | getData (const std::string &tableName, const std::vector< std::string > &columns, int commitTag, Vector &) |
int | commitState (int commitTag) |
Stores the current state on the database. More... | |
![]() | |
FE_Datastore (Preprocessor &, FEM_ObjectBroker &theBroker) | |
Constructor. More... | |
char * | addToProgram (void) |
Return \(nullptr\). | |
int | setUpConnection (void) |
int | setNextAddress (const ChannelAddress &otherChannelAddress) |
Return \(0\). | |
ChannelAddress * | getLastSendersAddress (void) |
Return \(nullptr\). | |
int | sendObj (int commitTag, MovableObject &theObject, ChannelAddress *theAddress=0) |
Call {sendSelf(commitTag, *this, theBroker)} on theObject and return the result. More... | |
int | recvObj (int commitTag, MovableObject &theObject, FEM_ObjectBroker &theBroker, ChannelAddress *theAddress=0) |
Call {recvSelf(commitTag, *this, theBroker)} on theObject and return the result. More... | |
int | getDbTag (void) const |
To return a unique integer identifier at each call. More... | |
virtual bool | isDatastore (void) const |
Return true (this channel type IS a Datastore). | |
virtual int | restoreState (int commitTag) |
Invoked to restore the state of the domain from a database. More... | |
bool | isSaved (int commitTag) const |
Returns true if the state identified by commitTag was previously saved on the database. More... | |
int | save (const int &commitTag) |
int | restore (const int &commitTag) |
![]() | |
Channel (CommandEntity *owr=nullptr) | |
Constructor. | |
bool | checkDbTag (const int &dbTag) |
Check if a dbTag is already used. | |
const ID & | getUsedTags (void) const |
Return the list of dbTags already used. | |
void | clearDbTags (void) |
Reset used database tags set. | |
int | getTag (void) const |
Return the object tag. | |
template<class inputIterator > | |
int | sendObjs (int commitTag, const inputIterator &first, const inputIterator &last, ChannelAddress *theAddress=nullptr) |
Send the objects on interval [first,last). | |
template<class inputIterator > | |
int | recvObjs (int commitTag, const inputIterator &first, const inputIterator &last, FEM_ObjectBroker &, ChannelAddress *theAddress=nullptr) |
Receive an object sequence. | |
Additional Inherited Members | |
![]() | |
FEM_ObjectBroker * | getObjectBroker (void) |
Returns a pointer to theBroker object passed in the constructor. | |
const Preprocessor * | getPreprocessor (void) const |
Returns a pointer to the object preprocessor. | |
Preprocessor * | getPreprocessor (void) |
Returns a pointer to the object preprocessor. | |
![]() | |
int | sendMovable (int commitTag, MovableObject &) |
Send theObject . | |
int | receiveMovable (int commitTag, MovableObject &, FEM_ObjectBroker &) |
Receive theObject . | |
used in the program to store/restore the geometry and state information in the domain at particular instances.
This information is stored in binary form in files.
An FileDatastore object is used in the program to store/restore the geometry and state information in the domain at particular instances. This information is stored in binary form in files. As no standard format is used for the storage of integers and double values, files used to store the data on one type of machine, may not be read by a FileDatastore object on another type of machine where the storage of integers and doubles is different.
For each of the base relations, i.e. Domain, Nodes, Elements, SFreedom_Constraints, MFreedom_Constraints, NodalLoads and ElementalLoads, a separate file is used to store the information. Files are also used for each size of ID, Vector and Matrix stored. At present, Messages are not stored, only ID and Vector objects of size \(<= 200\) can be stored, the max \(noRows * noCols\) of Matrices that can be stored is \(<= 2000\), and only a single relation is created for Matrices which have similar sizes but differing dimensions. The data is stored in the files following the schema outlined previously.
XC::FileDatastore::FileDatastore | ( | const std::string & | dataBaseName, |
Preprocessor & | preprocessor, | ||
FEM_ObjectBroker & | theObjBroker | ||
) |
Constructor.
Opens the files for the domain and base component relations, files have names {name.relation}, and stores the end of file locations. Creates three arrays of file pointers for the ID, Vector and Matrix files and then zeros these arrays. If the files could not be opened, or there is not enough memory for the arrays an error message is printed and the program is terminated.
XC::FileDatastore::~FileDatastore | ( | void | ) |
Destructor.
Each file that is opened is closed and the arrays of file pointers obtained from the heap in the constructor are returned to the heap.
|
virtual |
Stores the current state on the database.
Invoked to store the current state of the domain in the database. The integer commitTag
is used to identify the state for subsequent calls to restore the information from the database. To return \(0\) if successful, a negative number if not.
The object loops over all the components of the Domain object invoking {sendSelf(commitTag, this)} on each of these objects. Returns \(0\) if successful, a negative number if not. For each domain component that could not send itself a warning message is printed.
Reimplemented from XC::FE_Datastore.
|
virtual |
Receive (read) the ID.
If a file for IDs of this size has not yet been created, an error message is printed and \(-1\) is returned. A sequential search is made in the file to see if information is already stored for a ID with this dbTag
and commitTag
. If no information is stored a \(-1\) is returned. If information is stored, the information is retrieved and the data in the ID is set. Returns \(0\) if successful.
Implements XC::Channel.
|
virtual |
Receive (read) the matrix.
First determines the size of the matrix, \(noRows * noCols\). If a files for matrices of this size has not yet been created, an error message is printed and \(-1\) is returned. A sequential search is made in the file to see if information is already stored for a Matrix with this dbTag
and commitTag
. If no information is stored a \(-1\) is returned. If information is stored, the information is retrieved and the data in the Matrix is set. returns \(0\) if successful.
Implements XC::Channel.
|
virtual |
Receive (read) the vector.
If a file for Vectors of this size has not yet been created, an error message is printed and \(-1\) is returned. A sequential search is made in the file to see if information is already stored for a Vector with this dbTag
and commitTag
. If no information is stored a \(-1\) is returned. If information is stored, the information is retrieved and the data in the Vector is set. Returns \(0\) if successful.
Implements XC::Channel.
|
virtual |
Send (write) the ID.
//! If a file for IDs of this size has not yet been created, one is created now and the cell in the array of file pointers is set. If file can not be created a warning message is printed and program is terminated. A sequential search is made in the file to see if information is already stored for a ID with this dbTag
and commitTag
. The data is then written at this location, or eof if no location was found. The end of file location for IDss of this size is updated. If successful \(0\) is returned. A warning message and a negative number is returned if the operation fails: \(-1\) if ID size is too large.
Implements XC::Channel.
|
virtual |
Send (write) the matrix.
First determines the size of the matrix, \(noRows * noCols\). If a files for matrices of this size has not yet been created, one is created now and the cell in the array of file pointers is set. If file can not be created a warning message is printed and program is terminated. A sequential search is made in the file to see if information is already stored for a Matrix with this dbTag
and commitTag
. The data is then written at this location, or eof if no location was found. The end of file location for Matrices of this size is updated. If successful \(0\) is returned. A warning message and a negative number is returned if the operation fails: \(-1\) if Matrix size is too large.
Implements XC::Channel.
|
virtual |
Send (write) the vector.
If a file for Vectors of this size has not yet been created, one is created now and the cell in the array of file pointers is set. If file can not be created a warning message is printed and program is terminated. A sequential search is made in the file to see if information is already stored for a Vector with this dbTag
and commitTag
. The data is then written at this location, or eof if no location was found. The end of file location for Vectors of this size is updated. If successful \(0\) is returned. A warning message and a negative number is returned if the operation fails: \(-1\) if Vector size is too large.
Implements XC::Channel.