xc
MapSetBase.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 //MapSetBase.h
29 //Sets container.
30 
31 #ifndef MAPSETBASE_H
32 #define MAPSETBASE_H
33 
34 #include <map>
35 #include <deque>
36 #include <string>
37 #include "utility/actor/actor/MovableObject.h"
38 
39 
40 namespace XC {
41 
42 class SetBase;
43 class Set;
44 class Constraint;
45 class SetEstruct;
46 class EntMdlr;
47 class Pnt;
48 class Edge;
49 class Face;
50 class Body;
51 class UniformGrid;
52 class Preprocessor;
53 
58 class MapSetBase: public std::map<std::string,SetBase *>
59  {
60  public:
61  typedef std::map<std::string,SetBase *> map_sets;
62  protected:
63  static std::deque<std::string> setsClassNames;
64  friend class EntMdlr;
65 
67 
68  SetBase *find(const std::string &nmb) const;
69  SetEstruct *find_set_estruct(const std::string &nmb);
70  void clearSets(void);
71  friend class Set;
72 
73  MapSetBase(const MapSetBase &);
75  const std::deque<std::string> &getSetsClassNames(void) const;
76  const std::deque<std::string> &getSetsNames(void) const;
77  const std::deque<std::string> &getKeys(void) const;
78  DbTagData &getDbTagData(void) const;
79  const ID &getSetsDBTags(Communicator &comm);
80 
81  public:
82  MapSetBase(void)
83  :map_sets() {}
84  virtual ~MapSetBase(void);
85 
86  bool exists(const std::string &nmb) const;
87  void remove(const std::string &);
88  void rename(const std::string &, const std::string &);
89  void removeNode(Node *);
90  void removeElement(Element *);
92 
93  boost::python::list getSetsNamesPy(void) const;
94  boost::python::list getKeysPy(void) const;
95 
96  std::set<SetBase *> get_sets(const Node *);
97  boost::python::list get_sets_py(const Node *);
98  std::set<SetBase *> get_sets(const Element *);
99  boost::python::list get_sets_py(const Element *);
100  std::set<SetBase *> get_sets(const Pnt *);
101  std::set<SetBase *> get_sets(const Edge *);
102  std::set<SetBase *> get_sets(const Face *);
103  std::set<SetBase *> get_sets(const Body *);
104  std::set<SetBase *> get_sets(const UniformGrid *);
105 
106  boost::python::dict getPyDict(void) const;
107  void setPyDict(Preprocessor *, const boost::python::dict &);
108  };
109 } // end of XC namespace
110 
111 #endif
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
void removeNode(Node *)
Remove the given node from the sets.
Definition: MapSetBase.cc:160
bool exists(const std::string &nmb) const
Return true if the sets already exists.
Definition: MapSetBase.cc:42
Communication parameters between processes.
Definition: Communicator.h:66
SetBase * find(const std::string &nmb) const
Returns a pointer to the set which name is being passed as parameter.
Definition: MapSetBase.cc:46
Finite element model generation tools.
Definition: Preprocessor.h:59
void rename(const std::string &, const std::string &)
Rename the set.
Definition: MapSetBase.cc:117
void clearSets(void)
Clears all defined sets.
Definition: MapSetBase.cc:149
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
virtual ~MapSetBase(void)
Destructor.
Definition: MapSetBase.cc:190
std::set< SetBase * > get_sets(const Node *)
Return the sets that contain the pointer to node being passed as parameter.
Definition: MapSetBase.cc:293
Base de las clases Set y SetEstruct.
Definition: SetBase.h:51
Base class for the finite elements.
Definition: Element.h:112
Uniform mesh.
Definition: UniformGrid.h:41
boost::python::list get_sets_py(const Node *)
Return a Python list containing the sets that contain the pointer to node being passed as parameter...
Definition: MapSetBase.cc:303
Object set.
Definition: Set.h:57
boost::python::list getSetsNamesPy(void) const
Return the class names of the sets.
Definition: MapSetBase.cc:231
boost::python::list getKeysPy(void) const
Return the map keys in a Python list.
Definition: MapSetBase.cc:264
Point (KPoint).
Definition: Pnt.h:50
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:55
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: MapSetBase.cc:392
structured set, i.
Definition: SetEstruct.h:47
SetEstruct * create_set_estruct(const SetEstruct &)
Returns a copy of the argument.
Definition: MapSetBase.cc:61
const std::deque< std::string > & getSetsClassNames(void) const
Return the class names of the sets.
Definition: MapSetBase.cc:274
const std::deque< std::string > & getKeys(void) const
Return the map keys.
Definition: MapSetBase.cc:241
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
void setPyDict(Preprocessor *, const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: MapSetBase.cc:409
void removeElement(Element *)
Remove the given element from the sets.
Definition: MapSetBase.cc:170
Six-faced solid.
Definition: Body.h:71
Base class for model constraints.
Definition: Constraint.h:48
const std::deque< std::string > & getSetsNames(void) const
Return the class names of the sets.
Definition: MapSetBase.cc:213
Mesh node.
Definition: Node.h:111
SetEstruct * find_set_estruct(const std::string &nmb)
Returns a pointer to the structured set named as the parameter.
Definition: MapSetBase.cc:80
MapSetBase & operator=(const MapSetBase &)
Assignment operator (DOESN&#39;T COPY SETS).
Definition: MapSetBase.cc:95
Surface.
Definition: Face.h:45
void removeConstraint(Constraint *)
Remove the given constraint from the sets.
Definition: MapSetBase.cc:180
const ID & getSetsDBTags(Communicator &comm)
Return the DBTags of the sets.
Definition: MapSetBase.cc:194