xc
MapSet.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 //MapSet.h
29 //Sets container.
30 
31 #ifndef MAPSET_H
32 #define MAPSET_H
33 
34 #include "preprocessor/PreprocessorContainer.h"
35 #include "utility/actor/actor/MovableObject.h"
36 #include "MapSetBase.h"
37 #include <map>
38 #include <deque>
39 
40 
41 namespace XC {
42 
43 class Domain;
44 class Constraint;
45 
49  {
50  static ID setsDbTags;
51  public:
52  typedef std::map<std::string,EntMdlr *> map_ent_mdlr;
53  private:
54  map_ent_mdlr entities;
55  Set *total;
56  map_sets open_sets;
57 
58  friend class EntMdlr;
59 
60  bool is_open(const std::string &) const;
61  Set *create_set(const std::string &);
62  Set *alloc_set(const Set &);
63  SetBase *broke_set(const std::string &,const std::string &);
64 
65  SetBase *find_set(const std::string &nmb);
66  SetEstruct *find_struct_set(const std::string &nmb);
67  void setup_total(void);
68  void clearSets(void);
69  void clearAll(void);
70  void reset(void);
71  friend class MultiBlockTopology;
72  friend class SetMeshComp;
73  friend class SetEntities;
74  friend class Set;
75  void abre_set(const std::string &nmb);
76  void cierra_set(const std::string &nmb);
77 
78  MapSet(const MapSet &);
79  MapSet &operator=(const MapSet &);
80  protected:
81  DbTagData &getDbTagData(void) const;
82  int sendSetsDbTags(int posDbTag,Communicator &comm);
83  int sendSetsClassNames(int posDbTag,Communicator &comm);
84  int receiveSetsDbTags(int posDbTag,int size,const Communicator &comm);
85  int receiveSetsClassNames(int pDbTg,int sz,const Communicator &comm);
86  int sendSets(int posDbTag1, int posDbTag2, int posDbTag3,Communicator &comm);
87  int receiveSets(int posDbTag1, int posDbTag2, int posDbTag3,const int &,const Communicator &comm);
88  int sendOpenSets(int posDbTag1, int posDbTag2,Communicator &comm);
89  int receiveOpenSets(int posDbTag1, int posDbTag2,const Communicator &comm);
90 
91  int sendData(Communicator &);
92  int recvData(const Communicator &);
93 
94  friend class Preprocessor;
95  MapSet(Preprocessor *preprocessor= nullptr);
96  public:
97 
98  virtual ~MapSet(void);
99 
100  EntMdlr *insert_ent_mdlr(EntMdlr *ent_mdlr);
101 
102  Set *get_set_total(void)
103  { return total; }
104  const Set *get_set_total(void) const
105  { return total; }
106  inline const map_sets &get_open_sets(void) const
107  { return open_sets; }
108  inline map_sets &get_open_sets(void)
109  { return open_sets; }
110  Set *defSet(const std::string &);
111  void removeSet(const std::string &);
112 
113  void removeNode(Node *);
114  void removeElement(Element *);
116 
117  std::set<SetBase *> get_sets_containing_node(const int &);
118  boost::python::list get_sets_containing_node_py(const int &);
119  std::set<SetBase *> get_sets_containing_element(const int &);
120  boost::python::list get_sets_containing_element_py(const int&);
121 
122  const SetBase *find_set(const std::string &nmb) const;
123  SetBase &getSet(const std::string &nmb);
124 
125  int sendSelf(Communicator &);
126  int recvSelf(const Communicator &);
127  boost::python::dict getPyDict(void) const;
128  void setPyDict(const boost::python::dict &);
129  };
130 } // end of XC namespace
131 
132 #endif
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: MapSet.cc:581
boost::python::list get_sets_containing_node_py(const int &)
Return the a Python list with the sets that contain the pointer to the node whose identifier is being...
Definition: MapSet.cc:282
virtual ~MapSet(void)
Destructor.
Definition: MapSet.cc:329
int recvSelf(const Communicator &)
Receives object through the communicator argument.
Definition: MapSet.cc:532
void removeNode(Node *)
Remove the given node from the sets.
Definition: MapSet.cc:333
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of the class members.
Definition: MapSet.cc:357
Sets container.
Definition: MapSet.h:48
Communication parameters between processes.
Definition: Communicator.h:66
std::map< std::string, EntMdlr * > map_ent_mdlr
dbTags para the sets.
Definition: MapSet.h:52
Finite element model generation tools.
Definition: Preprocessor.h:59
int sendSelf(Communicator &)
Sends object through the communicator argument.
Definition: MapSet.cc:517
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: MapSet.cc:554
Object that can move between processes.
Definition: MovableObject.h:100
Model geometry manager.
Definition: MultiBlockTopology.h:68
int sendData(Communicator &)
Send members through the communicator argument.
Definition: MapSet.cc:489
int recvData(const Communicator &)
Receives members through the communicator argument.
Definition: MapSet.cc:503
SetBase & getSet(const std::string &nmb)
Return the set which name is being passed as parameter.
Definition: MapSet.cc:66
boost::python::list get_sets_containing_element_py(const int &)
Return the a Python list with the sets that contain the pointer to the element whose identifier is be...
Definition: MapSet.cc:314
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
Vector of integers.
Definition: ID.h:95
Sets container.
Definition: MapSetBase.h:58
Base de las clases Set y SetEstruct.
Definition: SetBase.h:51
void removeConstraint(Constraint *)
Remove the given element from the sets.
Definition: MapSet.cc:348
int receiveSetsClassNames(int pDbTg, int sz, const Communicator &comm)
Receives the class names of the sets through the communicator argument.
Definition: MapSet.cc:410
Base class for the finite elements.
Definition: Element.h:112
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:59
Object set.
Definition: Set.h:57
EntMdlr * insert_ent_mdlr(EntMdlr *ent_mdlr)
Inserts, as a set, a preprocessor entity.
Definition: MapSet.cc:169
Set * defSet(const std::string &)
Creates a new set with the name which is passed as a parameter.
Definition: MapSet.cc:226
std::set< SetBase * > get_sets_containing_element(const int &)
Return the sets that contain the pointer to the element whose identifier is being passed as parameter...
Definition: MapSet.cc:298
std::set< SetBase * > get_sets_containing_node(const int &)
Return the sets that contain the pointer to the node whose identifier is being passed as parameter...
Definition: MapSet.cc:266
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:55
void removeSet(const std::string &)
Deletes the set and removes it from the sets map.
Definition: MapSet.cc:230
Base class for preprocessor containers i.
Definition: PreprocessorContainer.h:44
structured set, i.
Definition: SetEstruct.h:47
int receiveOpenSets(int posDbTag1, int posDbTag2, const Communicator &comm)
Receives members through the communicator argument.
Definition: MapSet.cc:474
int sendSets(int posDbTag1, int posDbTag2, int posDbTag3, Communicator &comm)
Send the sets through the communicator argument.
Definition: MapSet.cc:423
int receiveSets(int posDbTag1, int posDbTag2, int posDbTag3, const int &, const Communicator &comm)
Receives the sets through the communicator argument.
Definition: MapSet.cc:440
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
void removeElement(Element *)
Remove the given element from the sets.
Definition: MapSet.cc:340
Base class for model constraints.
Definition: Constraint.h:48
int sendOpenSets(int posDbTag1, int posDbTag2, Communicator &comm)
Send members through the communicator argument.
Definition: MapSet.cc:460
int sendSetsClassNames(int posDbTag, Communicator &comm)
Send the names of the classes of the sets through the communicator argument.
Definition: MapSet.cc:381
Mesh node.
Definition: Node.h:111
int receiveSetsDbTags(int posDbTag, int size, const Communicator &comm)
Receives the dbTags of the sets through the communicator argument.
Definition: MapSet.cc:397
int sendSetsDbTags(int posDbTag, Communicator &comm)
Send the dbTags of the sets through the communicator argument.
Definition: MapSet.cc:364
Object set.
Definition: SetEntities.h:77