xc
FE_Datastore.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.8 $
48 // $Date: 2005/11/08 00:04:32 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/utility/database/FE_Datastore.h,v $
50 
51 
52 #ifndef FE_Datastore_h
53 #define FE_Datastore_h
54 
55 // File: ~/utility/database/FE_Datastore.h
56 //
57 // Written: fmk
58 // Created: 10/98
59 // Revision: A
60 //
61 // Description: This file contains the class definition for FE_Datastore.
62 // FE_Datastore is an abstract base class. An FE_datastore object is used
63 // in the program to store/restore the geometry and state information in
64 // a model at a particular instance in the analysis.
65 //
66 // What: "@(#) FE_Datastore.h, revA"
67 
68 #include "utility/actor/channel/Channel.h"
69 #include <vector>
70 
71 namespace XC {
72 class Preprocessor;
73 class FEM_ObjectBroker;
74 
81 class FE_Datastore: public Channel
82  {
83  private:
84  FEM_ObjectBroker *theObjectBroker;
85  static int lastDbTag;
86  std::set<int> savedStates;
87  protected:
89  const Preprocessor *getPreprocessor(void) const;
91  public:
93  inline virtual ~FE_Datastore(void) {}
94 
95  // methods defined in the Channel class interface which mean nothing for a Datastore
96  char *addToProgram(void);
97  int setUpConnection(void);
98  int setNextAddress(const ChannelAddress &otherChannelAddress);
100 
101  // methods defined in the Channel class interface which can be implemented here
102  int sendObj(int commitTag,MovableObject &theObject, ChannelAddress *theAddress =0);
103 
104  int recvObj(int commitTag,MovableObject &theObject, FEM_ObjectBroker &theBroker,ChannelAddress *theAddress =0);
105 
106  // pure virtual functions in addition to those defined
107  // in the ModelBuilder and Channel classes for database applications
108  int getDbTag(void) const;
109  virtual bool isDatastore(void) const;
110 
111  virtual int commitState(int commitTag);
112  virtual int restoreState(int commitTag);
113  bool isSaved(int commitTag) const;
114 
115  virtual int createTable(const std::string &tableName, const std::vector<std::string> &);
116  virtual int insertData(const std::string &tableName,const std::vector<std::string> &, int commitTag, const Vector &data);
117  virtual int getData(const std::string &tableName,const std::vector<std::string> &, int commitTag, Vector &data);
118 
119  int save(const int &commitTag);
120  int restore(const int &commitTag);
121 
122  };
123 } // end of XC namespace
124 
125 
126 #endif
127 
virtual int restoreState(int commitTag)
Invoked to restore the state of the domain from a database.
Definition: FE_Datastore.cpp:186
Float vector abstraction.
Definition: Vector.h:93
int getDbTag(void) const
To return a unique integer identifier at each call.
Definition: FE_Datastore.cpp:240
Objects of this class are used in the program to store/restore the geometry and state information in ...
Definition: FE_Datastore.h:81
Finite element model generation tools.
Definition: Preprocessor.h:58
Object that can move between processes.
Definition: MovableObject.h:99
virtual int commitState(int commitTag)
Stores the current state on the database.
Definition: FE_Datastore.cpp:140
FE_Datastore(Preprocessor &, FEM_ObjectBroker &theBroker)
Constructor.
Definition: FE_Datastore.cpp:78
const Preprocessor * getPreprocessor(void) const
Returns a pointer to the object preprocessor.
Definition: FE_Datastore.cpp:86
FEM_ObjectBroker is is an object broker class for the finite element method.
Definition: FEM_ObjectBroker.h:145
int setNextAddress(const ChannelAddress &otherChannelAddress)
Return .
Definition: FE_Datastore.cpp:109
ChannelAddress * getLastSendersAddress(void)
Return .
Definition: FE_Datastore.cpp:114
FEM_ObjectBroker * getObjectBroker(void)
Returns a pointer to theBroker object passed in the constructor.
Definition: FE_Datastore.cpp:82
int recvObj(int commitTag, MovableObject &theObject, FEM_ObjectBroker &theBroker, ChannelAddress *theAddress=0)
Call {recvSelf(commitTag, *this, theBroker)} on theObject and return the result.
Definition: FE_Datastore.cpp:125
int sendObj(int commitTag, MovableObject &theObject, ChannelAddress *theAddress=0)
Call {sendSelf(commitTag, *this, theBroker)} on theObject and return the result.
Definition: FE_Datastore.cpp:120
Channel is an abstract base class which defines the channel interface.
Definition: Channel.h:91
virtual bool isDatastore(void) const
Return true (this channel type IS a Datastore).
Definition: FE_Datastore.cpp:94
bool isSaved(int commitTag) const
Returns true if the state identified by commitTag was previously saved on the database.
Definition: FE_Datastore.cpp:172
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
char * addToProgram(void)
Return .
Definition: FE_Datastore.cpp:102
Definition: ChannelAddress.h:69