xc
CmbEdge.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 //CmbEdge.h
29 //Compound line.
30 
31 #ifndef CMBEDGE_H
32 #define CMBEDGE_H
33 
34 #include <deque>
35 #include "preprocessor/multi_block_topology/entities/1d/Edge.h"
36 
37 class Polyline3d;
38 
39 namespace XC {
40 
41 class LineMap;
42 
45 class CmbEdge: public Edge
46  {
47  public:
58  class Side: public CommandEntity
59  {
60  Edge *edge;
61  bool forward;
62  public:
63  Side(Edge *ptr= nullptr,const bool &s=true);
64  bool equal(const Side &) const;
65  Edge *getEdge(void);
66  const Edge *getEdge(void) const;
67  void SetEdge(Edge *l);
68  const Pnt *P1(void) const;
69  const Pnt *P2(void) const;
70  Pnt *P1(void);
71  Pnt *P2(void);
72  bool areEndPoints(const Pnt *,const Pnt *) const;
73  const std::string &getName(void) const;
74  inline bool isDirect(void) const
75  { return forward; }
76  inline void reverse(void)
77  { forward= !forward; }
78  size_t getTag(void) const;
79 
80  // Number of divisions.
81  void setNDivHomologousEdges(const size_t &);
82  void setNDiv(const size_t &nd);
83  size_t NDiv(void) const;
84  double getElemSize(void) const;
85 
86 
87  // Node positions.
88  Pos3dArray get_positions(void) const;
89  std::vector<Node *> getNodesForward(void);
90  std::vector<Node *> getNodesReverse(void);
91  std::vector<const Node *> getNodesForward(void) const;
92  std::vector<const Node *> getNodesReverse(void) const;
93  std::vector<int> getTagsNodesForward(void) const;
94  std::vector<int> getTagsNodesReverse(void) const;
95  Pos3dArray getNodePosForward(void) const;
96  Pos3dArray getNodePosReverse(void) const;
97 
98  // Geometry
99  double getLength(void) const;
100  Pos3d getCentroid(void) const;
101  bool In(const GeomObj3d &, const double &tol= 0.0) const;
102  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
103  const Vector &getTang(const double &) const;
104  double getDist(const Pos3d &) const;
105 
106  // Mesh
107  Node *getNodeForward(const size_t &i);
108  Node *getNodeReverse(const size_t &i);
109  Node *getNode(const size_t &i);
110  const Node *getNode(const size_t &i) const;
111  void genMesh(meshing_dir dm);
112  friend bool operator==(const Side &il1,const Side &il2);
113 
114  boost::python::dict getPyDict(void) const;
115  void setPyDict(LineMap &, const boost::python::dict &);
116  };
117  protected:
118  std::deque<Side> lines;
119  Pos3dArray get_positions(void) const;
120 
121  Side *first_line(void);
122  const Side *first_line(void) const;
123  Side *last_line(void);
124  const Side *last_line(void) const;
125 
126 
127  const Pnt *first_point(void) const;
128  const Pnt *last_point(void) const;
129 
130  virtual void create_line_nodes(void);
131  void line_meshing(meshing_dir dm);
132  void close(void);
133  void revolve(const int &);
134  public:
135  CmbEdge(void);
136  CmbEdge(Preprocessor *m,const size_t &nd= 4);
137  CmbEdge(const std::string &name,Preprocessor *m,const size_t &nd);
138  virtual bool operator==(const CmbEdge &) const;
139  virtual SetEstruct *getCopy(void) const;
140  virtual void insert(Edge *l);
141  void insert(const size_t &i);
142  Edge *newLine(Pnt *,Pnt *);
143  Edge *newLine(Pnt *,Pnt *,Pnt *);
144  void addPoints(const ID &);
145  void addLines(const ID &);
146 
147  // Number of divisions.
148  size_t NDiv(void) const;
149  void setNDiv(const size_t &nd);
150  double getAvgElemSize(void) const;
151  double getMaxElemSize(void) const;
152  double getMinElemSize(void) const;
153 
155  size_t getNumberOfEdges(void) const
156  { return lines.size(); }
157  inline std::deque<Side> &getSides(void)
158  { return lines; }
159  inline const std::deque<Side> &getSides(void) const
160  { return lines; }
161  CmbEdge getReversed(void) const;
162  virtual void reverse(void);
163  bool In(const GeomObj3d &, const double &tol= 0.0) const;
164  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
165 
166  double getLength(void) const;
167  Pos3d getCentroid(void) const;
168  virtual double getDist(const Pos3d &) const;
169 
171  virtual size_t getNumberOfVertices(void) const
172  { return getNumberOfEdges()+1; }
173 
174  Pnt *P1(void);
175  Pnt *P2(void);
176  const Pnt *P1(void) const;
177  const Pnt *P2(void) const;
178 
179  bool hasEdge(const Edge *) const;
180  size_t IndiceEdge(const Edge *) const;
181  const Side *getSide(const size_t &i) const;
182  Side *getSide(const size_t &i);
183  const Side *getSideByPoints(const Pnt *,const Pnt *) const;
184  Side *getSideByPoints(const Pnt *,const Pnt *);
185  const Side *getSideByPoints(const size_t &,const size_t &) const;
186  Side *getSideByPoints(const size_t &,const size_t &);
187  std::deque<Edge *> getEdges(void);
188  std::deque<const Edge *> getEdges(void) const;
189  boost::python::list getEdgesPy(void) const;
190  std::deque<Side *> findSides(const Pos3d &);
191 
192  virtual const Pnt *getVertex(const size_t &i) const;
193  virtual Pnt *getVertex(const size_t &i);
194  std::deque<Pnt *> getVertices(void);
195  std::deque<const Pnt *> getVertices(void) const;
196  std::set<const Pnt *> getVertexSet(void) const;
197  virtual void SetVertice(const size_t &,Pnt *);
198  virtual ID getKPoints(void) const;
199  Pnt *findVertex(const Pos3d &);
200 
201  Polyline3d getPolyline(void) const;
202 
203  bool isConnectedTo(const Pnt &) const;
204  bool isConnectedTo(const CmbEdge &) const;
205  std::set<const Face *> getConnectedSurfaces(void) const;
206  boost::python::list getConnectedSurfacesPy(void) const;
207  std::set<const Face *> getConnectedSurfaces(const SetBase *) const;
208  boost::python::list getConnectedSurfacesPy(const SetBase *) const;
209 
210 
211  BND3d Bnd(void) const;
212  void genMesh(meshing_dir dm);
213 
214  friend bool operator==(const Side &il1,const Side &il2);
215 
216  boost::python::dict getPyDict(void) const;
217  void setPyDict(const boost::python::dict &);
218  };
219 
221 inline bool operator==(const CmbEdge::Side &il1,const CmbEdge::Side &il2)
222  { return il1.equal(il2); }
223 
224 } //end of XC namespace
225 
226 #endif
size_t getNumberOfEdges(void) const
Return the number of edges.
Definition: CmbEdge.h:155
const Pnt * first_point(void) const
Returns a pointer to the first point.
Definition: CmbEdge.cc:416
double getMaxElemSize(void) const
Return the maximum element size.
Definition: CmbEdge.cc:589
virtual void SetVertice(const size_t &, Pnt *)
Sets the i-th vertex.
Definition: CmbEdge.cc:1004
Component of a compound line.
Definition: CmbEdge.h:58
Float vector abstraction.
Definition: Vector.h:94
size_t NDiv(void) const
Return the number of divisions of the line.
Definition: CmbEdge.cc:313
virtual void create_line_nodes(void)
Triggers node creation on the edges.
Definition: CmbEdge.cc:636
Node * getNode(const size_t &i)
Return the node which index is being passed as parameter.
Definition: CmbEdge.cc:267
void close(void)
Close the line.
Definition: CmbEdge.cc:713
Base class for one-dimensional geometry objects.
Definition: Edge.h:49
void SetEdge(Edge *l)
Assigns the line.
Definition: CmbEdge.cc:69
std::deque< Edge * > getEdges(void)
Return the deque of lines that define the edges.
Definition: CmbEdge.cc:905
Pos3d getCentroid(void) const
Return the segment than links both ends.
Definition: CmbEdge.cc:147
double getLength(void) const
Return the side length.
Definition: CmbEdge.cc:127
Finite element model generation tools.
Definition: Preprocessor.h:59
Array of positions in a three-dimensional space.
Definition: Pos3dArray.h:38
virtual SetEstruct * getCopy(void) const
Virtual constructor.
Definition: CmbEdge.cc:378
Edge * newLine(Pnt *, Pnt *)
Creates a new line between the points being passed as parameters and inserts it on the edges set...
Definition: CmbEdge.cc:733
CmbEdge(void)
Constructor.
Definition: CmbEdge.cc:348
friend bool operator==(const Side &il1, const Side &il2)
Comparison operator.
Definition: CmbEdge.h:221
Pos3dArray get_positions(void) const
Return the positions on the line.
Definition: CmbEdge.cc:160
void setPyDict(LineMap &, const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: CmbEdge.cc:337
std::vector< int > getTagsNodesReverse(void) const
Return the identifiers of the nodes of the reverse sequence.
Definition: CmbEdge.cc:216
bool Out(const GeomObj3d &, const double &tol=0.0) const
Returns true if this object lies outside the geometric object.
Definition: CmbEdge.cc:143
Polyline in a three-dimensional space.
Definition: Polyline3d.h:37
Vector of integers.
Definition: ID.h:95
Edge * getEdge(void)
Returns a pointer to the edge.
Definition: CmbEdge.cc:63
double getAvgElemSize(void) const
Return the average element size.
Definition: CmbEdge.cc:579
double getDist(const Pos3d &) const
Returns the distance to the position being passed as parameter.
Definition: CmbEdge.cc:156
virtual const Pnt * getVertex(const size_t &i) const
Return the i-th vertex.
Definition: CmbEdge.cc:956
void line_meshing(meshing_dir dm)
Triggers meshing of lines.
Definition: CmbEdge.cc:643
const Side * getSideByPoints(const Pnt *, const Pnt *) const
Return the side whose end points are the points being passed as parameters.
Definition: CmbEdge.cc:860
const Pnt * P1(void) const
Returns a constant pointer to the back end of the edge.
Definition: CmbEdge.cc:73
void addLines(const ID &)
Creates and inserts the edges from the indexes being passed as parameter.
Definition: CmbEdge.cc:678
Base de las clases Set y SetEstruct.
Definition: SetBase.h:51
virtual ID getKPoints(void) const
Returns object k-points.
Definition: CmbEdge.cc:1033
double getElemSize(void) const
Return the element size.
Definition: CmbEdge.cc:317
Side * last_line(void)
Returns a pointer to the last edge.
Definition: CmbEdge.cc:399
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: CmbEdge.cc:325
Node * getNodeForward(const size_t &i)
Return the node which index is being passed as parameter empezando por el principio.
Definition: CmbEdge.cc:243
const Vector & getTang(const double &) const
Returns a vector tangent to the side at the point s.
Definition: CmbEdge.cc:151
Node * getNodeReverse(const size_t &i)
Return the node which index is being passed as parameter empezando por el final.
Definition: CmbEdge.cc:255
std::deque< Pnt * > getVertices(void)
Return the vertices.
Definition: CmbEdge.cc:974
boost::python::list getConnectedSurfacesPy(void) const
Return the surfaces that touch this point (neighbors).
Definition: CmbEdge.cc:1107
boost::python::list getEdgesPy(void) const
Return the lines that define the edges in a Python list.
Definition: CmbEdge.cc:923
virtual size_t getNumberOfVertices(void) const
Return the number of vertices.
Definition: CmbEdge.h:171
const Pnt * last_point(void) const
Returns a pointer to the last point.
Definition: CmbEdge.cc:426
void addPoints(const ID &)
Creates and inserts the the edges that link the points from the indexes being passed as parameter...
Definition: CmbEdge.cc:687
bool In(const GeomObj3d &, const double &tol=0.0) const
Returns true if this object lies inside the geometric object.
Definition: CmbEdge.cc:135
Line container.
Definition: LineMap.h:49
Side * first_line(void)
Returns a pointer to the first lado.
Definition: CmbEdge.cc:383
bool hasEdge(const Edge *) const
Return true if the given edge makes part of this compound line.
Definition: CmbEdge.cc:822
Pos3dArray getNodePosForward(void) const
Return the positions of the nodes of the forward sequence.
Definition: CmbEdge.cc:225
Pos3dArray getNodePosReverse(void) const
Return the positions of the nodes of the reverse sequence.
Definition: CmbEdge.cc:234
size_t getTag(void) const
Return the identifier of the line.
Definition: CmbEdge.cc:321
Objet that can execute python scripts.
Definition: CommandEntity.h:40
Compound line.
Definition: CmbEdge.h:45
const Side * getSide(const size_t &i) const
Returns a lado of the line compuesta.
Definition: CmbEdge.cc:851
"boundary" en tres dimensiones.
Definition: BND3d.h:34
virtual void insert(Edge *l)
Inserts the line which pointer is being passed as parameter.
Definition: CmbEdge.cc:788
Point (KPoint).
Definition: Pnt.h:51
structured set, i.
Definition: SetEstruct.h:48
std::vector< Node * > getNodesReverse(void)
Return the pointers to the nodes of the reverse sequence.
Definition: CmbEdge.cc:178
void revolve(const int &)
Move forward or backwards the sequence of vertexes.
Definition: CmbEdge.cc:471
Side(Edge *ptr=nullptr, const bool &s=true)
Constructor.
Definition: CmbEdge.cc:44
bool equal(const Side &) const
Comparison operator.
Definition: CmbEdge.cc:48
std::deque< Side * > findSides(const Pos3d &)
Return the pointers to the sides at the position argument.
Definition: CmbEdge.cc:938
Posición en tres dimensiones.
Definition: Pos3d.h:44
void setNDivHomologousEdges(const size_t &)
Set the number of divisions of the side and the number of divisions of its homologous edges...
Definition: CmbEdge.cc:301
size_t IndiceEdge(const Edge *) const
Searches the line l from those of this compound line.
Definition: CmbEdge.cc:837
std::set< const Face * > getConnectedSurfaces(void) const
Return the surfaces that touch this edge.
Definition: CmbEdge.cc:1061
std::deque< Side > lines
Lines that compose the object.
Definition: CmbEdge.h:118
double getMinElemSize(void) const
Return the minimum element size.
Definition: CmbEdge.cc:600
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
std::vector< Node * > getNodesForward(void)
Return the pointers to the nodes of the forward sequence.
Definition: CmbEdge.cc:169
bool areEndPoints(const Pnt *, const Pnt *) const
Returns true if the points being passed as parameters are the endpoints of the side.
Definition: CmbEdge.cc:108
bool isConnectedTo(const Pnt &) const
Returns true if this edge is connected to the point.
Definition: CmbEdge.cc:1043
std::set< const Pnt * > getVertexSet(void) const
Return the vertices.
Definition: CmbEdge.cc:994
const std::string & getName(void) const
Return the name of the line.
Definition: CmbEdge.cc:123
void genMesh(meshing_dir dm)
Genertes a mesh from the corresponding line.
Definition: CmbEdge.cc:295
Mesh node.
Definition: Node.h:112
void setNDiv(const size_t &nd)
Set the number of divisions of the side.
Definition: CmbEdge.cc:307
CmbEdge getReversed(void) const
Return the reverse vertex sequence.
Definition: CmbEdge.cc:448
Polyline3d getPolyline(void) const
Returns a polyline representation of the object.
Definition: CmbEdge.cc:1136
const Pnt * P2(void) const
Returns a constant pointer to the front end of the edge.
Definition: CmbEdge.cc:80
std::vector< int > getTagsNodesForward(void) const
Return the identifiers of the nodes of the forward sequence.
Definition: CmbEdge.cc:207
Pnt * findVertex(const Pos3d &)
Return a pointer to the vertex at the position argument.
Definition: CmbEdge.cc:1013
BND3d Bnd(void) const
Returns object BND.
Definition: CmbEdge.cc:1147
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43