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