Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

FileDatastore.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:17 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/database/FileDatastore.h,v $
00024                                                                         
00025                                                                         
00026 #ifndef FileDatastore_h
00027 #define FileDatastore_h
00028 
00029 // File: ~/database/FileDatastore.h
00030 //
00031 // Written: fmk 
00032 // Created: 10/98
00033 // Revision: A
00034 //
00035 // Description: This file contains the class definition for FileDatastore.
00036 // FileDatastore is a concrete subclas of FE_Datastore. A FileDatastore 
00037 // object is used in the program to store/restore the geometry and state 
00038 // information in a domain at a particular instance in the analysis. The
00039 // information is stored in text files.
00040 //
00041 // What: "@(#) FileDatastore.h, revA"
00042 
00043 #include <FE_Datastore.h>
00044 #include <fstream.h>
00045 
00046 #include <FEM_ObjectBroker.h>
00047 
00048 
00049 #define maxIDsize   512
00050 #define maxVectSize 512
00051 #define maxMatSize  512
00052 
00076 struct IDdata{
00078   int dbTag;
00079 
00081   int commitTag;
00083   int data[maxIDsize];     
00084 };
00085 
00087 struct VectData{
00089   int dbTag;
00091   int commitTag;
00093   double data[maxVectSize];     
00094 };
00095 
00097 struct MatrixData{
00099   int dbTag;
00101   int commitTag;
00103   double data[maxMatSize];     
00104 };
00105 
00107 struct FileEnds{
00109   int ids[maxIDsize];
00111   int vects[maxVectSize];
00113   int mats[maxMatSize];
00114 };
00115 
00117 struct CurrentFilePos{
00119   int ids[maxIDsize];
00121   int vects[maxVectSize];
00123   int mats[maxMatSize];
00124 };
00125 
00127 struct CurrentFileCommitTag{
00129   int ids[maxIDsize];
00131   int vects[maxVectSize];
00133   int mats[maxMatSize];
00134 };
00135 
00137 struct MaxFileDbTag{
00139   int ids[maxIDsize];
00141   int vects[maxVectSize];
00143   int mats[maxMatSize];
00144 };
00145 
00146 
00148 class FileDatastore: public FE_Datastore
00149 {
00150   public:
00152     FileDatastore(char *dataBase,
00153     Domain &theDomain, 
00154     FEM_ObjectBroker &theBroker);    
00155     
00157     ~FileDatastore();
00158 
00160     int getDbTag(void);
00161     
00163     char *addToProgram(void);
00165     int setUpShadow(void);
00167     int setUpActor(void);
00169     int setNextAddress(const ChannelAddress &otherChannelAddress);
00171     ChannelAddress *getLastSendersAddress(void);
00172     
00174     int commitState(int commitTag);        
00175 
00177     int sendObj(int commitTag,
00178   MovableObject &theObject, 
00179   ChannelAddress *theAddress =0);
00181     int recvObj(int commitTag,
00182   MovableObject &theObject, 
00183   FEM_ObjectBroker &theBroker,
00184   ChannelAddress *theAddress =0);
00185   
00187     int sendMsg(int dbTag, int commitTag, 
00188   const Message &, 
00189   ChannelAddress *theAddress =0);    
00191     int recvMsg(int dbTag, int commitTag, 
00192   Message &, 
00193   ChannelAddress *theAddress =0);        
00194 
00196     int sendMatrix(int dbTag, int commitTag, 
00197      const Matrix &theMatrix, 
00198      ChannelAddress *theAddress =0);
00200     int recvMatrix(int dbTag, int commitTag, 
00201      Matrix &theMatrix, 
00202      ChannelAddress *theAddress =0);
00203     
00205     int sendVector(int dbTag, int commitTag, 
00206      const Vector &theVector, ChannelAddress *theAddress =0);
00208     int recvVector(int dbTag, int commitTag, 
00209      Vector &theVector, 
00210      ChannelAddress *theAddress =0);
00211     
00213     int sendID(int dbTag, int commitTag, 
00214         const ID &theID, 
00215         ChannelAddress *theAddress =0);
00217     int recvID(int dbTag, int commitTag, 
00218         ID &theID, 
00219         ChannelAddress *theAddress =0);    
00220     
00221   protected:
00222 
00223   private:
00224     
00226     fstream *openFile(char *fileName);
00227     
00229     int dbTag;
00231     char dataBase[50];
00233     fstream **ids, **vects, **mats;
00235     int lastDomainChangeStamp;
00236 
00238     struct MatrixData matBuffer;    
00240     struct VectData vectBuffer;
00242     struct IDdata idBuffer;
00244     struct FileEnds fileEnds;
00245 
00247     struct CurrentFilePos filePos;
00249     struct CurrentFileCommitTag fileCommitTags;
00251     struct MaxFileDbTag fileDbTags;    
00252 };
00253 
00254 
00255 
00256 
00257 #endif
00258 
Copyright Contact Us