xc
PyDictDatastore.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 //PyDictDatastore.h
29 
30 #ifndef PyDictDatastore_h
31 #define PyDictDatastore_h
32 
33 #include <utility/database/FE_Datastore.h>
34 
35 namespace XC {
39 //
40 //
44  {
45  private:
46  const std::string &getFileName(void) const
47  { return getName(); }
48  boost::python::dict pyDict;
49  void insertData(const std::string &,const int &,const int &,const double *,const int &);
50  void insertData(const std::string &,const int &,const int &,const int *,const int &);
51  std::vector<double> retrieveDoubleData(const std::string &,const int &,const int &);
52  std::vector<int> retrieveIntData(const std::string &,const int &,const int &);
53  public:
54  PyDictDatastore(const std::string &,Preprocessor &, FEM_ObjectBroker &,int dbRun = 0);
55 
56  std::string getTypeId(void) const
57  { return "PyDict"; }
58 
59  // methods for sending and receiving matrices, vectors and id's
60  int sendMsg(int , int , const Message &, ChannelAddress *a= nullptr);
61  int recvMsg(int , int , Message &, ChannelAddress *a= nullptr);
62 
63  int sendMatrix(int , int , const Matrix &,ChannelAddress *a= nullptr);
64  int recvMatrix(int , int , Matrix &, ChannelAddress *a= nullptr);
65 
66  int sendVector(int , int , const Vector &,ChannelAddress *a= nullptr);
67  int recvVector(int , int , Vector &,ChannelAddress *a= nullptr);
68 
69  int sendID(int , int ,const ID &,ChannelAddress *a= nullptr);
70  int recvID(int , int ,ID &,ChannelAddress *a= nullptr);
71 
72  void jsonWrite(std::ostream &) const;
73  void jsonRead(std::istream &);
74  int save(const int &commitTag);
75  int restore(const int &commitTag);
76  };
77 } // end of XC namespace
78 
79 #endif
Float vector abstraction.
Definition: Vector.h:94
int sendMatrix(int, int, const Matrix &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Matrix object theMatrix to another Channel object.
Definition: PyDictDatastore.cc:155
Base class for objects that store/restore model information.
Definition: FE_Datastore.h:84
int recvVector(int, int, Vector &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Vector object theVector to another Channel object.
Definition: PyDictDatastore.cc:183
Finite element model generation tools.
Definition: Preprocessor.h:59
FEM_ObjectBroker is is an object broker class for the finite element method.
Definition: FEM_ObjectBroker.h:151
Vector of integers.
Definition: ID.h:95
int sendVector(int, int, const Vector &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Vector object theVector to another Channel object.
Definition: PyDictDatastore.cc:175
int sendID(int, int, const ID &, ChannelAddress *a=nullptr)
Invoked to receive the data in the ID object theID to another Channel object.
Definition: PyDictDatastore.cc:195
int sendMsg(int, int, const Message &, ChannelAddress *a=nullptr)
A method invoked to send the data in the Message object theMsg to another Channel object...
Definition: PyDictDatastore.cc:41
void jsonRead(std::istream &)
Read Python dictionary from JSON file.
Definition: PyDictDatastore.cc:274
int recvMatrix(int, int, Matrix &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Matrix object theMatrix to another Channel object.
Definition: PyDictDatastore.cc:163
Store model data in a Python dictionary.
Definition: PyDictDatastore.h:43
int recvID(int, int, ID &, ChannelAddress *a=nullptr)
Invoked to receive the data in the ID object theID to another Channel object.
Definition: PyDictDatastore.cc:203
Message between processes.
Definition: Message.h:77
int recvMsg(int, int, Message &, ChannelAddress *a=nullptr)
Invoked to send the data in the Message object theMsg to another Channel object.
Definition: PyDictDatastore.cc:47
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
Matrix of floats.
Definition: Matrix.h:111
void jsonWrite(std::ostream &) const
Write Python dictionary from JSON file.
Definition: PyDictDatastore.cc:214