xc
SetEntities.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 //SetEntities.h
29 
30 #ifndef SETENTITIES_H
31 #define SETENTITIES_H
32 
33 #include "preprocessor/PreprocessorContainer.h"
34 #include "DqPtrsEntities.h"
35 #include "DqPtrsFaces.h"
36 #include "utility/actor/actor/MovableObject.h"
37 #include "preprocessor/set_mgmt/SetMeshComp.h"
38 
39 class Pos3d;
40 class GeomObj3d;
41 class BND3d;
42 class PrincipalAxes3D;
43 
44 namespace XC {
45 class Pnt;
46 class Edge;
47 class Face;
48 class Body;
49 class UniformGrid;
50 class TrfGeom;
51 class SFreedom_Constraint;
52 class ID;
53 
57  {
61  inline EdgeIntersectionRef(Edge *a= nullptr, Edge *b= nullptr, const Pos3d &p= Pos3d())
62  : first(a), second(b), intersectionPos(p) {}
63  };
64 typedef std::deque<EdgeIntersectionRef> edge_intersection_pairs;
65 
79  {
80  public:
82  typedef lst_ptr_points::iterator pnt_iterator;
83  typedef lst_ptr_points::const_iterator pnt_const_iterator;
84 
86  typedef lst_line_pointers::iterator lin_iterator;
87  typedef lst_line_pointers::const_iterator lin_const_iterator;
88 
90  typedef lst_surface_ptrs::iterator sup_iterator;
91  typedef lst_surface_ptrs::const_iterator sup_const_iterator;
92 
94  typedef lst_body_pointers::iterator body_iterator;
95  typedef lst_body_pointers::const_iterator body_const_iterator;
96 
98  typedef lst_ptr_uniform_grids::iterator ugrid_iterator;
99  typedef lst_ptr_uniform_grids::const_iterator ugrid_const_iterator;
100 
101  protected:
102  lst_ptr_points points;
103  lst_line_pointers lines;
104  lst_surface_ptrs surfaces;
105  lst_body_pointers bodies;
106  lst_ptr_uniform_grids uniform_grids;
107  bool useGmsh;
108 
109  friend class Set;
110  void clearAll(void);
111  void copy_lists(const SetEntities &);
112  SetEntities create_copy(const std::string &,const Vector3d &v);
113  void extend_lists(const SetEntities &);
114  void substract_lists(const SetEntities &);
115  void intersect_lists(const SetEntities &);
116 
117  DbTagData &getDbTagData(void) const;
118  int sendData(Communicator &);
119  int recvData(const Communicator &);
120 
121  //Mesh generation.
122  void create_gmsh_points(void) const;
123  void point_meshing(meshing_dir dm);
124  void create_gmsh_lines(void) const;
125  void line_meshing(meshing_dir dm);
126  void create_gmsh_loops(void) const;
127  std::vector<int> create_gmsh_surfaces(void) const;
128  void surface_meshing(meshing_dir dm);
129  void body_meshing(meshing_dir dm);
130  void uniform_grid_meshing(meshing_dir dm);
131  std::map<int, const Node *> create_nodes_from_gmsh(void);
132  int create_elements_from_gmsh(const std::map<int, const Node *> &);
133  void gen_mesh_gmsh(const std::string &modelName);
134 
135  void move(const Vector3d &);
136  public:
137  SetEntities(Preprocessor *preprocessor= nullptr);
138  SetEntities(const SetEntities &);
139  SetEntities &operator=(const SetEntities &);
140  ~SetEntities(void);
141 
142  void clear(void);
143  bool empty(void) const;
144 
146  virtual const lst_ptr_points &getPoints(void) const
147  { return points; }
149  virtual lst_ptr_points &getPoints(void)
150  { return points; }
152  void setPoints(const lst_ptr_points &pts)
153  { points= pts; }
154  PrincipalAxes3D getOrientation(void) const;
155  void sel_points_from_list(const ID &);
156  void selPointsFromListPy(const boost::python::list &);
157  bool In(const Pnt *) const;
158  bool isCloserThan(const Pnt &, const double &) const;
159  SetEntities pickPointsInside(const GeomObj3d &, const double &tol= 0.0) const;
160  Pnt *getNearestPoint(const Pos3d &);
161  const Pnt *getNearestPoint(const Pos3d &) const;
162  bool isCloserThan(const Pos3d &, const double &) const;
163  bool isCloserThan(const GeomObj::list_Pos3d &, const double &) const;
164 
165 
167  virtual const lst_line_pointers &getLines(void) const
168  { return lines; }
170  virtual lst_line_pointers &getLines(void)
171  { return lines; }
173  void setLines(const lst_line_pointers &lns)
174  { lines= lns; }
175  void sel_lines_from_list(const ID &);
176  void selLinesFromListPy(const boost::python::list &);
177  bool In(const Edge *) const;
178  bool isCloserThan(const Edge &, const double &) const;
179  SetEntities pickLinesInside(const GeomObj3d &, const double &tol= 0.0) const;
180  edge_intersection_pairs getLineIntersections(const double &tol= 1e-6) const;
181  void splitLinesAtIntersections(const double &tol= 1e-6);
182  Edge *getNearestLine(const Pos3d &);
183  const Edge *getNearestLine(const Pos3d &) const;
184 
186  virtual const lst_surface_ptrs &getSurfaces(void) const
187  { return surfaces; }
189  virtual lst_surface_ptrs &getSurfaces(void)
190  { return surfaces; }
192  void setSurfaces(const lst_surface_ptrs &sfs)
193  { surfaces= sfs; }
194  void sel_surfaces_from_list(const ID &);
195  void selSurfacesFromListPy(const boost::python::list &);
196  bool In(const Face *) const;
197  bool isCloserThan(const Face &, const double &) const;
198  SetEntities pickSurfacesInside(const GeomObj3d &, const double &tol= 0.0) const;
199 
201  virtual const lst_body_pointers &getBodies(void) const
202  { return bodies; }
204  virtual lst_body_pointers &getBodies(void)
205  { return bodies; }
207  void setBodies(const lst_body_pointers &bds)
208  { bodies= bds; }
209  void sel_bodies_from_list(const ID &);
210  void selBodiesFromListPy(const boost::python::list &);
211  bool In(const Body *) const;
212  bool isCloserThan(const Body &, const double &) const;
213  SetEntities pickBodiesInside(const GeomObj3d &, const double &tol= 0.0) const;
214 
216  virtual const lst_ptr_uniform_grids &getUniformGrids(void) const
217  { return uniform_grids; }
219  virtual lst_ptr_uniform_grids &getUniformGrids(void)
220  { return uniform_grids; }
221  void sel_ugrids_from_list(const ID &);
222  void selUgridsFromListPy(const boost::python::list &);
223  bool In(const UniformGrid *) const;
224  bool isCloserThan(const UniformGrid &, const double &) const;
225 
226  BND3d Bnd(void) const;
227  double getAverageSize(void) const;
228  SetEntities pickEntitiesInside(const GeomObj3d &, const double &tol= 0.0) const;
229 
230  double getMaxElementSize(void) const;
231  double getMinElementSize(void) const;
232  double getAverageElementSize(void) const;
233  bool remove(Element *);
234  bool remove(Node *);
235 
236  void fillUpwards(const SetMeshComp &);
237  void fillDownwards(void);
238  void fillDownwards(SetMeshComp &);
239 
240  void Transform(const TrfGeom &trf);
241 
242  void conciliaNDivs(void);
243  void setUseGmsh(const bool &);
244  bool getUseGmsh(void) const;
245  void genMesh(const std::string &, meshing_dir dm);
246 
247  virtual int sendSelf(Communicator &);
248  virtual int recvSelf(const Communicator &);
249 
250  void extend(const lst_ptr_points &);
251  void extend(const lst_line_pointers &);
252  void extend(const lst_surface_ptrs &);
253  void extend(const lst_body_pointers &);
254  void extend(const lst_ptr_uniform_grids &);
255  void extend(const SetEntities &);
256  void substract(const lst_ptr_points &);
257  void substract(const lst_line_pointers &);
258  void substract(const lst_surface_ptrs &);
259  void substract(const lst_body_pointers &);
260  void substract(const lst_ptr_uniform_grids &);
261  void substract(const SetEntities &);
262 
263  SetEntities &operator+=(const SetEntities &);
264  SetEntities &operator-=(const SetEntities &);
265  SetEntities &operator*=(const SetEntities &);
266 
267  SetEntities operator+(const SetEntities &) const;
268  SetEntities operator-(const SetEntities &) const;
269  SetEntities operator*(const SetEntities &) const;
270 
271  boost::python::dict getPyDict(void) const;
272  void setPyDict(const boost::python::dict &);
273  };
274 } //end of XC namespace
275 #endif
virtual const lst_ptr_points & getPoints(void) const
Returns a const reference to the point container.
Definition: SetEntities.h:146
lst_surface_ptrs surfaces
surface set.
Definition: SetEntities.h:104
void setSurfaces(const lst_surface_ptrs &sfs)
Assigns the surface set.
Definition: SetEntities.h:192
virtual const lst_line_pointers & getLines(void) const
Return a const reference to the line container.
Definition: SetEntities.h:167
lst_surface_ptrs::const_iterator sup_const_iterator
surface set const iterator.
Definition: SetEntities.h:91
Edge * second
second edge.
Definition: SetEntities.h:59
virtual lst_surface_ptrs & getSurfaces(void)
Returns a reference to the surface container.
Definition: SetEntities.h:189
Base class for one-dimensional geometry objects.
Definition: Edge.h:49
lst_line_pointers::const_iterator lin_const_iterator
Line set const iterator.
Definition: SetEntities.h:87
Communication parameters between processes.
Definition: Communicator.h:66
void setBodies(const lst_body_pointers &bds)
Assigns the bodies set.
Definition: SetEntities.h:207
Finite element model generation tools.
Definition: Preprocessor.h:59
Object that can move between processes.
Definition: MovableObject.h:100
virtual lst_body_pointers & getBodies(void)
Return a reference to the body container.
Definition: SetEntities.h:204
Edge * first
first edge.
Definition: SetEntities.h:58
Pos3d intersectionPos
intersection point.
Definition: SetEntities.h:60
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
void move(GeomObj::list_Pos2d &l, const Vector2d &v)
Moves the points of the list.
Definition: utils_list_pos2d.cc:41
Vector of integers.
Definition: ID.h:95
lst_ptr_points::iterator pnt_iterator
point set iterator.
Definition: SetEntities.h:82
lst_line_pointers::iterator lin_iterator
Line set iterator.
Definition: SetEntities.h:86
Base class for the finite elements.
Definition: Element.h:112
FiberSet operator+(const FiberSet &, const FiberSet &)
Return the union of both containers.
Definition: FiberSet.cc:65
lst_ptr_points::const_iterator pnt_const_iterator
point set const iterator.
Definition: SetEntities.h:83
Uniform mesh.
Definition: UniformGrid.h:41
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:59
lst_body_pointers::const_iterator body_const_iterator
body set const iterator.
Definition: SetEntities.h:95
DqPtrsEntities< Edge > lst_line_pointers
Line set.
Definition: SetEntities.h:85
virtual const lst_body_pointers & getBodies(void) const
Return a const reference to the body container.
Definition: SetEntities.h:201
virtual const lst_surface_ptrs & getSurfaces(void) const
Returns a const reference to the surface container.
Definition: SetEntities.h:186
lst_surface_ptrs::iterator sup_iterator
surface set iterator.
Definition: SetEntities.h:90
Container for preprocessor faces.
Definition: DqPtrsFaces.h:42
bool useGmsh
if true use Gmsh for mesh generation.
Definition: SetEntities.h:107
Object set.
Definition: Set.h:57
void setPoints(const lst_ptr_points &pts)
Assigns the points set.
Definition: SetEntities.h:152
"boundary" en tres dimensiones.
Definition: BND3d.h:34
lst_ptr_points points
point set.
Definition: SetEntities.h:102
Reference to the intersection of two edges (see SetEntities::getLineIntersections).
Definition: SetEntities.h:56
Point (KPoint).
Definition: Pnt.h:51
lst_line_pointers lines
line set.
Definition: SetEntities.h:103
lst_ptr_uniform_grids::iterator ugrid_iterator
Uniform grid iterator.
Definition: SetEntities.h:98
DqPtrsEntities< Body > lst_body_pointers
body set.
Definition: SetEntities.h:93
DqPtrsFaces lst_surface_ptrs
surface set.
Definition: SetEntities.h:89
Geometric transformation that can be applied to the components of a set.
Definition: TrfGeom.h:48
Base class for preprocessor containers i.
Definition: PreprocessorContainer.h:44
Posición en tres dimensiones.
Definition: Pos3d.h:44
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
FiberSet operator-(const FiberSet &, const FiberSet &)
Return the fibers in a that are not in b.
Definition: FiberSet.cc:73
Principals axes of inertia in planar geometry.
Definition: PrincipalAxes3D.h:34
virtual lst_ptr_points & getPoints(void)
Return a reference to the the point container.
Definition: SetEntities.h:149
Six-faced solid.
Definition: Body.h:71
DqPtrsEntities< UniformGrid > lst_ptr_uniform_grids
Unifrom grid set.
Definition: SetEntities.h:97
lst_body_pointers bodies
body set.
Definition: SetEntities.h:105
void setLines(const lst_line_pointers &lns)
Assigns the edge set.
Definition: SetEntities.h:173
virtual lst_ptr_uniform_grids & getUniformGrids(void)
Return a reference to the UniformGrids container.
Definition: SetEntities.h:219
lst_body_pointers::iterator body_iterator
body set iterator.
Definition: SetEntities.h:94
Mesh node.
Definition: Node.h:112
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:216
Vector en tres dimensiones.
Definition: Vector3d.h:39
lst_ptr_uniform_grids::const_iterator ugrid_const_iterator
Uniform grid const iterator.
Definition: SetEntities.h:99
Object set.
Definition: SetEntities.h:78
lst_ptr_uniform_grids uniform_grids
Uniform mesh set.
Definition: SetEntities.h:106
DqPtrsEntities< Pnt > lst_ptr_points
Point set.
Definition: SetEntities.h:81
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43
virtual lst_line_pointers & getLines(void)
Return a reference to the line container.
Definition: SetEntities.h:170