xc
Set.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 //Set.h
29 
30 #ifndef SET_H
31 #define SET_H
32 
33 #include "preprocessor/set_mgmt/SetMeshComp.h"
34 #include "preprocessor/set_mgmt/SetEntities.h"
35 
36 class Pos3d;
37 
38 namespace XC {
39 class SFreedom_Constraint;
40 class ID;
41 class Element;
42 class Node;
43 class Constraint;
44 
57 class Set: public SetMeshComp
58  {
59  private:
60  Set *alloc_set(void);
61  public:
62  void numerate(void);
63 
64  protected:
65  std::string description;
67 
68  void clearAll(void);
69  void create_copy(const std::string &,const Vector3d &v);
70 
71  DbTagData &getDbTagData(void) const;
72  int sendData(Communicator &);
73  int recvData(const Communicator &);
74 
75 
76  void move(const Vector3d &);
77  public:
78  Set(const std::string &nmb="",Preprocessor *preprocessor= nullptr);
79  ~Set(void);
80 
81  inline void setDescription(const std::string &d)
82  { description= d; }
83  const std::string &getDescription(void) const
84  { return description; }
85 
86  void clear(void);
87  bool empty(void) const;
88 
89  Set getEntitiesSet(void) const;
90  Set getMeshComponentsSet(void) const;
91 
92  bool In(const Node *) const;
93  bool isCloserThan(const Node &, const double &) const;
94  bool remove(Node *);
95  bool In(const Element *) const;
96  bool isCloserThan(const Element &, const double &) const;
97  bool remove(Element *);
98  Set pickNodesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
99  Set pickNodesInside(const std::string &, const GeomObj2d &, const double &tol= 0.0);
100  Set pickElemsInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
101  Set pickElemsInside(const std::string &, const GeomObj2d &, const double &tol= 0.0);
102  Set pickElemsCrossing(const std::string &, const GeomObj3d &, const double &tol= 0.0);
103  Set pickElemsCrossing(const std::string &, const GeomObj2d &, const double &tol= 0.0);
104  Set pickElemsOfType(const std::string &, const std::string &);
105  Set pickElemsOfDimension(const std::string &, const size_t &);
106 
107  bool remove(Constraint *);
108 
110  virtual const SetEntities &getEntities(void) const
111  { return entities; }
113  virtual SetEntities &getEntities(void)
114  { return entities; }
116  virtual const SetMeshComp &getMeshComp(void) const
117  { return *this; }
119  virtual SetMeshComp &getMeshComp(void)
120  { return *this; }
121 
123  virtual const SetEntities::lst_ptr_points &getPoints(void) const
124  { return entities.getPoints(); }
127  { return entities.getPoints(); }
130  { entities.setPoints(pts); }
131  void sel_points_from_list(const ID &);
132  void selPointsFromListPy(const boost::python::list &);
133  bool In(const Pnt *) const;
134  bool isCloserThan(const Pnt &, const double &) const;
135  Set pickPointsInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
136 
138  virtual const SetEntities::lst_line_pointers &getLines(void) const
139  { return entities.getLines(); }
142  { return entities.getLines(); }
145  { entities.setLines(lns); }
146  void sel_lines_from_list(const ID &);
147  void selLinesFromListPy(const boost::python::list &);
148  bool In(const Edge *) const;
149  bool isCloserThan(const Edge &, const double &) const;
150  Set pickLinesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
151 
153  virtual const SetEntities::lst_surface_ptrs &getSurfaces(void) const
154  { return entities.getSurfaces(); }
157  { return entities.getSurfaces(); }
160  { entities.setSurfaces(sfs); }
161  void sel_surfaces_from_list(const ID &);
162  void selSurfacesFromListPy(const boost::python::list &);
163  bool In(const Face *) const;
164  bool isCloserThan(const Face &, const double &) const;
165  Set pickSurfacesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
166 
168  virtual const SetEntities::lst_body_pointers &getBodies(void) const
169  { return entities.getBodies(); }
172  { return entities.getBodies(); }
175  { entities.setBodies(bds); }
176  void sel_bodies_from_list(const ID &);
177  void selBodiesFromListPy(const boost::python::list &);
178  bool In(const Body *) const;
179  bool isCloserThan(const Body &, const double &) const;
180  Set pickBodiesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
181 
184  { return entities.getUniformGrids(); }
187  { return entities.getUniformGrids(); }
188  void sel_ugrids_from_list(const ID &);
189  void selUgridsFromListPy(const boost::python::list &);
190  bool isCloserThan(const UniformGrid &, const double &) const;
191  bool In(const UniformGrid *) const;
192 
193  BND3d Bnd(const double &) const;
194  Set pickEntitiesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
195 
196  void conciliaNDivs(void);
197  void setUseGmsh(const bool &);
198  bool getUseGmsh(void) const;
199  void genMesh(meshing_dir dm);
200 
201 
202  void fillUpwards(void);
203  void fillDownwards(void);
204 
205  void Transform(const TrfGeom &trf);
206 
207  virtual int sendSelf(Communicator &);
208  virtual int recvSelf(const Communicator &);
209 
210  void extend(const SetEntities::lst_ptr_points &);
215  void extend(const Set &);
216  Set &operator+=(const Set &);
217  Set &operator-=(const Set &);
218  Set &operator*=(const Set &);
219 
220  Set &operator+(const Set &) const;
221  Set &operator-(const Set &) const;
222  Set &operator*(const Set &) const;
223 
224  boost::python::dict getPyDict(void) const;
225  void setPyDict(const boost::python::dict &);
226  };
227 } //end of XC namespace
228 #endif
virtual SetEntities::lst_ptr_uniform_grids & getUniformGrids(void)
Return a reference to the UniformGrids container.
Definition: Set.h:186
virtual int sendSelf(Communicator &)
Sends object through the communicator argument.
Definition: Set.cc:731
virtual const lst_ptr_points & getPoints(void) const
Returns a const reference to the point container.
Definition: SetEntities.h:145
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: Set.cc:779
Set pickLinesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the lines that lie insiof the geometric object.
Definition: Set.cc:496
virtual const SetEntities::lst_body_pointers & getBodies(void) const
Return a const reference to the body container.
Definition: Set.h:168
void setSurfaces(const lst_surface_ptrs &sfs)
Assigns the surface set.
Definition: SetEntities.h:190
virtual const lst_line_pointers & getLines(void) const
Return a const reference to the line container.
Definition: SetEntities.h:165
virtual const SetEntities::lst_ptr_points & getPoints(void) const
Returns a const reference to the points container.
Definition: Set.h:123
bool getUseGmsh(void) const
Get the value of the useGmsh member.
Definition: Set.cc:244
~Set(void)
Destructor.
Definition: Set.cc:55
Set getEntitiesSet(void) const
Return a set with the entities of this one.
Definition: Set.cc:324
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
bool empty(void) const
Return true if the set is empty.
Definition: Set.cc:160
virtual const SetEntities::lst_ptr_uniform_grids & getUniformGrids(void) const
Return a const reference to the UniformGrids container.
Definition: Set.h:183
Set pickNodesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the nodes that lie insiof the geometric object.
Definition: Set.cc:349
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of the class members.
Definition: Set.cc:707
void genMesh(meshing_dir dm)
Triggers mesh generation from set components.
Definition: Set.cc:303
Communication parameters between processes.
Definition: Communicator.h:66
void setBodies(const lst_body_pointers &bds)
Assigns the bodies set.
Definition: SetEntities.h:205
Set pickEntitiesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the entities that lie insiof the geometric object. ...
Definition: Set.cc:627
void extend(const SetEntities::lst_ptr_points &)
Extend this set with the points of the argument.
Definition: Set.cc:59
Finite element model generation tools.
Definition: Preprocessor.h:59
virtual int recvSelf(const Communicator &)
Receives object through the communicator argument.
Definition: Set.cc:747
void selBodiesFromListPy(const boost::python::list &)
Select the bodies identified by the given tags.
Definition: Set.cc:692
void setUseGmsh(const bool &)
Set the value of the useGmsh member.
Definition: Set.cc:240
void clearAll(void)
Clears all the objects of the set.
Definition: Set.cc:169
void sel_surfaces_from_list(const ID &)
Selects the surfaces with the identifiers being passed as parameter.
Definition: Set.cc:676
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
Vector of integers.
Definition: ID.h:95
void sel_lines_from_list(const ID &)
Select the lines identified by the tags in the parameter.
Definition: Set.cc:666
std::string description
set description.
Definition: Set.h:65
int recvData(const Communicator &)
Receives members through the communicator argument.
Definition: Set.cc:722
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: Set.cc:770
void setSurfaces(const SetEntities::lst_surface_ptrs &sfs)
Assigns the surface set.
Definition: Set.h:159
void sel_points_from_list(const ID &)
Select the points identified by the tags in the parameter.
Definition: Set.cc:654
void setPoints(const SetEntities::lst_ptr_points &pts)
Assigns the points set.
Definition: Set.h:129
Set & operator+(const Set &) const
Addition (union) operator.
Definition: Set.cc:122
Set pickElemsOfDimension(const std::string &, const size_t &)
Return a new set that contains the elements of the specified dimension.
Definition: Set.cc:445
Base class for the finite elements.
Definition: Element.h:112
Uniform mesh.
Definition: UniformGrid.h:41
Set pickPointsInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the points that lie insiof the geometric object.
Definition: Set.cc:459
Set & operator-(const Set &) const
Difference operator.
Definition: Set.cc:133
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:59
Base class for the two-dimensional geometric objects.
Definition: GeomObj2d.h:37
Set & operator*(const Set &) const
Intersection operator.
Definition: Set.cc:144
bool In(const Node *) const
Returns true if the node belongs to the set.
Definition: Set.cc:248
void selUgridsFromListPy(const boost::python::list &)
Select the ugrids identified by the given tags.
Definition: Set.cc:702
virtual const lst_body_pointers & getBodies(void) const
Return a const reference to the body container.
Definition: SetEntities.h:199
virtual const lst_surface_ptrs & getSurfaces(void) const
Returns a const reference to the surface container.
Definition: SetEntities.h:184
Container for preprocessor faces.
Definition: DqPtrsFaces.h:41
void Transform(const TrfGeom &trf)
Applies the transformation to the elements of the set.
Definition: Set.cc:193
Object set.
Definition: Set.h:57
void numerate(void)
Set indices for the set objects (nodes,elements,points...) to its use in VTK.
Definition: Set.cc:176
void selPointsFromListPy(const boost::python::list &)
Select the points identified by the given tags.
Definition: Set.cc:660
virtual const SetMeshComp & getMeshComp(void) const
Return a reference to the mesh components container.
Definition: Set.h:116
void setPoints(const lst_ptr_points &pts)
Assigns the points set.
Definition: SetEntities.h:151
void clear(void)
Clears the set.
Definition: Set.cc:153
Set & operator+=(const Set &)
Addition assignment operator.
Definition: Set.cc:89
"boundary" en tres dimensiones.
Definition: BND3d.h:34
void setBodies(const SetEntities::lst_body_pointers &bds)
Assigns the bodies set.
Definition: Set.h:174
virtual const SetEntities & getEntities(void) const
Return a reference to the entities container.
Definition: Set.h:110
Point (KPoint).
Definition: Pnt.h:50
void selLinesFromListPy(const boost::python::list &)
Select the lines identified by the given tags.
Definition: Set.cc:672
SetEntities entities
points, lines, surfaces, bodies, ...
Definition: Set.h:66
Set pickBodiesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the bodies that lie insiof the geometric object.
Definition: Set.cc:570
virtual SetEntities::lst_body_pointers & getBodies(void)
Return a reference to the body container.
Definition: Set.h:171
virtual const SetEntities::lst_line_pointers & getLines(void) const
Return a const reference to the line container.
Definition: Set.h:138
virtual SetEntities & getEntities(void)
Return a reference to the entities container.
Definition: Set.h:113
BND3d Bnd(const double &) const
Return the set boundary.
Definition: Set.cc:598
Geometric transformation that can be applied to the components of a set.
Definition: TrfGeom.h:48
int sendData(Communicator &)
Send members through the communicator argument.
Definition: Set.cc:714
Posición en tres dimensiones.
Definition: Pos3d.h:44
Set pickElemsOfType(const std::string &, const std::string &)
Return a new set that contains the elements that match the type.
Definition: Set.cc:432
void setLines(const SetEntities::lst_line_pointers &lns)
Assigns the edge set.
Definition: Set.h:144
Set getMeshComponentsSet(void) const
Return a set with the mesh components of this one.
Definition: Set.cc:334
virtual SetMeshComp & getMeshComp(void)
Return a reference to the entities container.
Definition: Set.h:119
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
void selSurfacesFromListPy(const boost::python::list &)
Select the surfaces identified by the given tags.
Definition: Set.cc:682
Six-faced solid.
Definition: Body.h:71
Set & operator*=(const Set &)
*= operator (intersection).
Definition: Set.cc:109
virtual SetEntities::lst_line_pointers & getLines(void)
Return a reference to the line container.
Definition: Set.h:141
void conciliaNDivs(void)
Conciliate number of divisions of the lines shared by faces.
Definition: Set.cc:236
void sel_bodies_from_list(const ID &)
Selects the bodies with the identifiers being passed as parameter.
Definition: Set.cc:686
Base class for model constraints.
Definition: Constraint.h:48
void setLines(const lst_line_pointers &lns)
Assigns the edge set.
Definition: SetEntities.h:171
void fillDownwards(void)
Appends to the set being passed as parameter the elements that intervene on the definition of those e...
Definition: Set.cc:637
Mesh node.
Definition: Node.h:111
void fillUpwards(void)
Appends to this set the objects that make reference to one or more of the objects that already make p...
Definition: Set.cc:645
virtual SetEntities::lst_ptr_points & getPoints(void)
Return a reference to the the point container.
Definition: Set.h:126
Set(const std::string &nmb="", Preprocessor *preprocessor=nullptr)
Constructor.
Definition: Set.cc:51
Set & operator-=(const Set &)
-= operator.
Definition: Set.cc:99
Surface.
Definition: Face.h:45
virtual const lst_ptr_uniform_grids & getUniformGrids(void) const
Return a const reference to the UniformGrids container.
Definition: SetEntities.h:214
Set pickSurfacesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the surfaces that lie insiof the geometric object. ...
Definition: Set.cc:533
virtual SetEntities::lst_surface_ptrs & getSurfaces(void)
Returns a reference to the surface container.
Definition: Set.h:156
Vector en tres dimensiones.
Definition: Vector3d.h:39
void sel_ugrids_from_list(const ID &)
Selects the ugrids with the identifiers being passed as parameter.
Definition: Set.cc:696
Object set.
Definition: SetEntities.h:77
Set pickElemsInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the elements that lie inside of the geometric object.
Definition: Set.cc:377
void create_copy(const std::string &, const Vector3d &v)
Creates a copy of the elements of the set and put them in another set with the name is being passed a...
Definition: Set.cc:215
void move(const Vector3d &)
Moves the objects of the set.
Definition: Set.cc:186
Set pickElemsCrossing(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set with the elements that cross (i.e.
Definition: Set.cc:405
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43
bool isCloserThan(const Node &, const double &) const
Return true if the distance to the given node is smaller than the given one.
Definition: Set.cc:255
virtual const SetEntities::lst_surface_ptrs & getSurfaces(void) const
Returns a const reference to the surface container.
Definition: Set.h:153