XC Open source finite element analysis program
BerkeleyDbDatastore.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 2002, 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.2 $
48 // $Date: 2003/10/15 16:49:02 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/database/BerkeleyDbDatastore.h,v $
50 
51 #ifndef BerkeleyDbDatastore_h
52 #define BerkeleyDbDatastore_h
53 
54 // Written: fmk
55 // Created: 02/02
56 //
57 // Description: This file contains the class definition for BerkeleyDbDatastore.
58 // BerkeleyDbDatastore is a concrete subclas of DBDatastore. A BerkeleyDbDatastore
59 // object is used in the program to store/restore the geometry and state
60 // information in a model at a particular instance in the analysis. The
61 // information is stored using the BerkeleyDB Database.
62 //
63 // What: "@(#) BerkeleyDbDatastore.h, revA"
64 
65 #include <utility/database/DBDatastore.h>
66 #include <db.h>
67 
68 namespace XC {
70 //
72  {
73  private:
74  DB_ENV *dbenv;
75  DB *dbMatrix;
76  DB *dbVector;
77  DB *dbID;
78 
79  bool connection;
80 
81  DBT key, data; // structures for the key data pair
82 
83  std::string project;
84  static const size_t sz_dbl= sizeof(double);
85  static const size_t sz_int= sizeof(int);
86 
87  void setup_key(const int &,const int &,const int &);
88  void setup_data(const void *,const int &,const int &);
89  void setup_structures(const int &,const int &,const void *,const int &,const int &);
90  bool create_aux_entities(void);
91  DBTYPE get_type(const std::string &);
92  int createDB(void);
93  int open(const DBTYPE &type);
94  void close(void);
95  public:
96  BerkeleyDbDatastore(const std::string &projectName, Preprocessor &preprocessor, FEM_ObjectBroker &theBroker,const std::string &type= "");
97  ~BerkeleyDbDatastore(void);
98 
99  // method to get a database tag
100  int getDbTag(void) const;
101 
102  // methods for sending and recieving matrices, vectors and id's
103  int sendMsg(int dbTag, int commitTag, const Message &, ChannelAddress *theAddress= nullptr);
104  int recvMsg(int dbTag, int commitTag, Message &, ChannelAddress *theAddress= nullptr);
105 
106  int sendMatrix(int dbTag, int commitTag, const Matrix &theMatrix, ChannelAddress *theAddress= nullptr);
107  int recvMatrix(int dbTag, int commitTag, Matrix &theMatrix, ChannelAddress *theAddress= nullptr);
108 
109  int sendVector(int dbTag, int commitTag, const Vector &,ChannelAddress *theAddress= nullptr);
110  int recvVector(int dbTag, int commitTag, Vector &,ChannelAddress *theAddress= nullptr);
111 
112  int sendID(int dbTag, int commitTag, const ID &,ChannelAddress *theAddress= nullptr);
113  int recvID(int dbTag, int commitTag, ID &theID, ChannelAddress *theAddress= nullptr);
114  };
115 } // end of XC namespace
116 
117 #endif
Definition: Vector.h:82
Definition: BerkeleyDbDatastore.h:71
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
Definition: ChannelAddress.h:69
Finite element model generation tools.
Definition: Preprocessor.h:58
Definition: ID.h:77
BerkeleyDbDatastore(const std::string &projectName, Preprocessor &preprocessor, FEM_ObjectBroker &theBroker, const std::string &type="")
Constructor.
Definition: BerkeleyDbDatastore.cpp:242
Definition: Matrix.h:82
Message between processes.
Definition: Message.h:67
================================================================================
Definition: ContinuaReprComponent.h:34
Definition: DBDatastore.h:38