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 
43 namespace XC {
44 class Pnt;
45 class Edge;
46 class Face;
47 class Body;
48 class UniformGrid;
49 class TrfGeom;
50 class SFreedom_Constraint;
51 class ID;
52 
56  {
60  inline EdgeIntersectionRef(Edge *a= nullptr, Edge *b= nullptr, const Pos3d &p= Pos3d())
61  : first(a), second(b), intersectionPos(p) {}
62  };
63 typedef std::deque<EdgeIntersectionRef> edge_intersection_pairs;
64 
78  {
79  public:
81  typedef lst_ptr_points::iterator pnt_iterator;
82  typedef lst_ptr_points::const_iterator pnt_const_iterator;
83 
85  typedef lst_line_pointers::iterator lin_iterator;
86  typedef lst_line_pointers::const_iterator lin_const_iterator;
87 
89  typedef lst_surface_ptrs::iterator sup_iterator;
90  typedef lst_surface_ptrs::const_iterator sup_const_iterator;
91 
93  typedef lst_body_pointers::iterator body_iterator;
94  typedef lst_body_pointers::const_iterator body_const_iterator;
95 
97  typedef lst_ptr_uniform_grids::iterator ugrid_iterator;
98  typedef lst_ptr_uniform_grids::const_iterator ugrid_const_iterator;
99 
100  protected:
101  lst_ptr_points points;
102  lst_line_pointers lines;
103  lst_surface_ptrs surfaces;
104  lst_body_pointers bodies;
105  lst_ptr_uniform_grids uniform_grids;
106  bool useGmsh;
107 
108  friend class Set;
109  void clearAll(void);
110  void copy_lists(const SetEntities &);
111  SetEntities create_copy(const std::string &,const Vector3d &v);
112  void extend_lists(const SetEntities &);
113  void substract_lists(const SetEntities &);
114  void intersect_lists(const SetEntities &);
115 
116  DbTagData &getDbTagData(void) const;
117  int sendData(Communicator &);
118  int recvData(const Communicator &);
119 
120  //Mesh generation.
121  void create_gmsh_points(void) const;
122  void point_meshing(meshing_dir dm);
123  void create_gmsh_lines(void) const;
124  void line_meshing(meshing_dir dm);
125  void create_gmsh_loops(void) const;
126  std::vector<int> create_gmsh_surfaces(void) const;
127  void surface_meshing(meshing_dir dm);
128  void body_meshing(meshing_dir dm);
129  void uniform_grid_meshing(meshing_dir dm);
130  std::map<int, const Node *> create_nodes_from_gmsh(void);
131  int create_elements_from_gmsh(const std::map<int, const Node *> &);
132  void gen_mesh_gmsh(const std::string &modelName);
133 
134  void move(const Vector3d &);
135  public:
136  SetEntities(Preprocessor *preprocessor= nullptr);
137  SetEntities(const SetEntities &);
138  SetEntities &operator=(const SetEntities &);
139  ~SetEntities(void);
140 
141  void clear(void);
142  bool empty(void) const;
143 
145  virtual const lst_ptr_points &getPoints(void) const
146  { return points; }
148  virtual lst_ptr_points &getPoints(void)
149  { return points; }
151  void setPoints(const lst_ptr_points &pts)
152  { points= pts; }
153  void sel_points_from_list(const ID &);
154  void selPointsFromListPy(const boost::python::list &);
155  bool In(const Pnt *) const;
156  bool isCloserThan(const Pnt &, const double &) const;
157  SetEntities pickPointsInside(const GeomObj3d &, const double &tol= 0.0) const;
158  Pnt *getNearestPoint(const Pos3d &);
159  const Pnt *getNearestPoint(const Pos3d &) const;
160  bool isCloserThan(const Pos3d &, const double &) const;
161  bool isCloserThan(const GeomObj::list_Pos3d &, const double &) const;
162 
163 
165  virtual const lst_line_pointers &getLines(void) const
166  { return lines; }
168  virtual lst_line_pointers &getLines(void)
169  { return lines; }
171  void setLines(const lst_line_pointers &lns)
172  { lines= lns; }
173  void sel_lines_from_list(const ID &);
174  void selLinesFromListPy(const boost::python::list &);
175  bool In(const Edge *) const;
176  bool isCloserThan(const Edge &, const double &) const;
177  SetEntities pickLinesInside(const GeomObj3d &, const double &tol= 0.0) const;
178  edge_intersection_pairs getLineIntersections(const double &tol= 1e-6) const;
179  void splitLinesAtIntersections(const double &tol= 1e-6);
180  Edge *getNearestLine(const Pos3d &);
181  const Edge *getNearestLine(const Pos3d &) const;
182 
184  virtual const lst_surface_ptrs &getSurfaces(void) const
185  { return surfaces; }
187  virtual lst_surface_ptrs &getSurfaces(void)
188  { return surfaces; }
190  void setSurfaces(const lst_surface_ptrs &sfs)
191  { surfaces= sfs; }
192  void sel_surfaces_from_list(const ID &);
193  void selSurfacesFromListPy(const boost::python::list &);
194  bool In(const Face *) const;
195  bool isCloserThan(const Face &, const double &) const;
196  SetEntities pickSurfacesInside(const GeomObj3d &, const double &tol= 0.0) const;
197 
199  virtual const lst_body_pointers &getBodies(void) const
200  { return bodies; }
202  virtual lst_body_pointers &getBodies(void)
203  { return bodies; }
205  void setBodies(const lst_body_pointers &bds)
206  { bodies= bds; }
207  void sel_bodies_from_list(const ID &);
208  void selBodiesFromListPy(const boost::python::list &);
209  bool In(const Body *) const;
210  bool isCloserThan(const Body &, const double &) const;
211  SetEntities pickBodiesInside(const GeomObj3d &, const double &tol= 0.0) const;
212 
214  virtual const lst_ptr_uniform_grids &getUniformGrids(void) const
215  { return uniform_grids; }
217  virtual lst_ptr_uniform_grids &getUniformGrids(void)
218  { return uniform_grids; }
219  void sel_ugrids_from_list(const ID &);
220  void selUgridsFromListPy(const boost::python::list &);
221  bool In(const UniformGrid *) const;
222  bool isCloserThan(const UniformGrid &, const double &) const;
223 
224  BND3d Bnd(void) const;
225  double getAverageSize(void) const;
226  SetEntities pickEntitiesInside(const GeomObj3d &, const double &tol= 0.0) const;
227 
228  double getMaxElementSize(void) const;
229  double getMinElementSize(void) const;
230  double getAverageElementSize(void) const;
231  bool remove(Element *);
232  bool remove(Node *);
233 
234  void fillUpwards(const SetMeshComp &);
235  void fillDownwards(void);
236  void fillDownwards(SetMeshComp &);
237 
238  void Transform(const TrfGeom &trf);
239 
240  void conciliaNDivs(void);
241  void setUseGmsh(const bool &);
242  bool getUseGmsh(void) const;
243  void genMesh(const std::string &, meshing_dir dm);
244 
245  virtual int sendSelf(Communicator &);
246  virtual int recvSelf(const Communicator &);
247 
248  void extend(const lst_ptr_points &);
249  void extend(const lst_line_pointers &);
250  void extend(const lst_surface_ptrs &);
251  void extend(const lst_body_pointers &);
252  void extend(const lst_ptr_uniform_grids &);
253 
254  SetEntities &operator+=(const SetEntities &);
255  SetEntities &operator-=(const SetEntities &);
256  SetEntities &operator*=(const SetEntities &);
257 
258  SetEntities operator+(const SetEntities &) const;
259  SetEntities operator-(const SetEntities &) const;
260  SetEntities operator*(const SetEntities &) const;
261 
262  boost::python::dict getPyDict(void) const;
263  void setPyDict(const boost::python::dict &);
264  };
265 } //end of XC namespace
266 #endif
virtual const lst_ptr_points & getPoints(void) const
Returns a const reference to the point container.
Definition: SetEntities.h:145
lst_surface_ptrs surfaces
surface set.
Definition: SetEntities.h:103
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
lst_surface_ptrs::const_iterator sup_const_iterator
surface set const iterator.
Definition: SetEntities.h:90
Edge * second
second edge.
Definition: SetEntities.h:58
virtual lst_surface_ptrs & getSurfaces(void)
Returns a reference to the surface container.
Definition: SetEntities.h:187
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
Base class for position lists.
Definition: PolyPos.h:35
lst_line_pointers::const_iterator lin_const_iterator
Line set const iterator.
Definition: SetEntities.h:86
Communication parameters between processes.
Definition: Communicator.h:66
void setBodies(const lst_body_pointers &bds)
Assigns the bodies set.
Definition: SetEntities.h:205
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:202
Edge * first
first edge.
Definition: SetEntities.h:57
Pos3d intersectionPos
intersection point.
Definition: SetEntities.h:59
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:38
Vector of integers.
Definition: ID.h:95
lst_ptr_points::iterator pnt_iterator
point set iterator.
Definition: SetEntities.h:81
lst_line_pointers::iterator lin_iterator
Line set iterator.
Definition: SetEntities.h:85
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:82
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:94
DqPtrsEntities< Edge > lst_line_pointers
Line set.
Definition: SetEntities.h:84
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
lst_surface_ptrs::iterator sup_iterator
surface set iterator.
Definition: SetEntities.h:89
Container for preprocessor faces.
Definition: DqPtrsFaces.h:41
bool useGmsh
if true use Gmsh for mesh generation.
Definition: SetEntities.h:106
Object set.
Definition: Set.h:57
void setPoints(const lst_ptr_points &pts)
Assigns the points set.
Definition: SetEntities.h:151
"boundary" en tres dimensiones.
Definition: BND3d.h:34
lst_ptr_points points
point set.
Definition: SetEntities.h:101
Reference to the intersection of two edges (see SetEntities::getLineIntersections).
Definition: SetEntities.h:55
Point (KPoint).
Definition: Pnt.h:50
lst_line_pointers lines
line set.
Definition: SetEntities.h:102
lst_ptr_uniform_grids::iterator ugrid_iterator
Uniform grid iterator.
Definition: SetEntities.h:97
DqPtrsEntities< Body > lst_body_pointers
body set.
Definition: SetEntities.h:92
DqPtrsFaces lst_surface_ptrs
surface set.
Definition: SetEntities.h:88
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
virtual lst_ptr_points & getPoints(void)
Return a reference to the the point container.
Definition: SetEntities.h:148
Six-faced solid.
Definition: Body.h:71
DqPtrsEntities< UniformGrid > lst_ptr_uniform_grids
Unifrom grid set.
Definition: SetEntities.h:96
lst_body_pointers bodies
body set.
Definition: SetEntities.h:104
void setLines(const lst_line_pointers &lns)
Assigns the edge set.
Definition: SetEntities.h:171
virtual lst_ptr_uniform_grids & getUniformGrids(void)
Return a reference to the UniformGrids container.
Definition: SetEntities.h:217
lst_body_pointers::iterator body_iterator
body set iterator.
Definition: SetEntities.h:93
Mesh node.
Definition: Node.h:111
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
Vector en tres dimensiones.
Definition: Vector3d.h:39
lst_ptr_uniform_grids::const_iterator ugrid_const_iterator
Uniform grid const iterator.
Definition: SetEntities.h:98
Object set.
Definition: SetEntities.h:77
lst_ptr_uniform_grids uniform_grids
Uniform mesh set.
Definition: SetEntities.h:105
DqPtrsEntities< Pnt > lst_ptr_points
Point set.
Definition: SetEntities.h:80
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:168