xc
Edge.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 //Edge.h
29 
30 #ifndef EDGE_H
31 #define EDGE_H
32 
33 #include "preprocessor/multi_block_topology/entities/EntMdlr.h"
34 #include "utility/geom/d1/Segment3d.h"
35 
36 
37 class BND3d;
38 class Pos3dArray;
39 
40 namespace XC {
41 class Pnt;
42 class Face;
43 class DqPtrsFaces;
44 class Body;
45 
49 class Edge: public EntMdlr
50  {
51  friend class CmbEdge;
52  friend class Face;
53  friend class SetEntities;
54  private:
55  size_t ndiv;
56  std::set<const Face *> surfaces_line;
57  protected:
58  void insert_surf(Face *s);
59  void create_nodes_on_endpoints(void);
60  std::vector<Node *> create_interior_nodes(const std::vector<Pos3d> &positions);
61  virtual int create_gmsh_line(void) const;
62  public:
63  Edge(Preprocessor *m,const size_t &nd= 4);
64  Edge(const std::string &name= "",Preprocessor *m= nullptr,const size_t &nd= 4);
65  virtual bool operator==(const Edge &) const;
66 
67  // Geometry.
69  inline virtual unsigned short int GetDimension(void) const
70  { return 1; }
71  virtual Pnt *P1(void);
72  virtual Pnt *P2(void);
73  virtual const Pnt *P1(void) const;
74  virtual const Pnt *P2(void) const;
75  bool In(const GeomObj3d &, const double &tol= 0.0) const;
76  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
77  bool areEndPoints(const Pnt *,const Pnt *) const;
79  virtual size_t getNumberOfVertices(void) const= 0;
80  virtual double getLength(void) const= 0;
81  virtual Pos3d getCentroid(void) const;
82  virtual Vector3d getIVector(void) const;
83  virtual Vector3d getJVector(void) const;
84  virtual Vector3d getKVector(void) const;
85  virtual Matrix getLocalAxes(void) const;
86  virtual const Pnt *getVertex(const size_t &i) const= 0;
87  virtual Pnt *getVertex(const size_t &i)= 0;
88  virtual void SetVertice(const size_t &,Pnt *)= 0;
89  std::vector<int> getIndicesVertices(void) const;
90  virtual std::deque<Pnt *> getVertices(void);
91  virtual std::deque<const Pnt *> getVertices(void) const;
92  boost::python::list getVerticesPy(void);
93  virtual ID getKPoints(void) const;
94  virtual std::deque<Segment3d> getSegments(void) const;
95  boost::python::list getSegmentsPy(void) const;
96  virtual Pos3dArray get_positions(void) const= 0;
97  virtual Pos3dArray get_nodes_pos(void) const;
98  virtual BND3d Bnd(void) const= 0;
99  virtual const Vector &getTang(const double &) const;
100  virtual double getDist(const Pos3d &) const;
101  void divide(void);
102 
103  // Meshing.
104  void setNDivHomologousEdges(const size_t &);
105  virtual void setNDiv(const size_t &);
106  inline virtual size_t NDiv(void) const
107  { return ndiv; }
108  void SetElemSize(const double &sz);
109  double getElemSize(void) const;
110  virtual void create_nodes(const Pos3dArray &);
111  virtual void create_nodes(void);
112  virtual void genMesh(meshing_dir dm);
113  virtual Node *getNode(const size_t &i1,const size_t &j,const size_t &k=1);
114  virtual const Node *getNode(const size_t &i,const size_t &j,const size_t &k=1) const;
115  virtual Node *getNode(const size_t &i);
116  virtual const Node *getNode(const size_t &i) const;
117  Node *getNodeForward(const size_t &i);
118  const Node *getNodeForward(const size_t &i) const;
119  Node *getNodeReverse(const size_t &i);
120  const Node *getNodeReverse(const size_t &i) const;
121  Node *getFirstNode(void);
122  const Node *getFirstNode(void) const;
123  Node *getLastNode(void);
124  const Node *getLastNode(void) const;
125 
126  std::vector<Node *> getNodesForward(void);
127  std::vector<Node *> getNodesReverse(void);
128  std::vector<const Node *> getNodesForward(void) const;
129  std::vector<const Node *> getNodesReverse(void) const;
130  std::vector<int> getTagsNodesForward(void) const;
131  std::vector<int> getTagsNodesReverse(void) const;
132  Pos3dArray getNodePosForward(void) const;
133  Pos3dArray getNodePosReverse(void) const;
134 
135  // Topology.
136  std::set<const XC::Edge *> getHomologousSides(void) const;
137  void update_topology(void);
138  size_t getNumConnectedEdges(void) const;
139  std::set<const Edge *> getConnectedEdges(void) const;
140  boost::python::list getConnectedEdgesPy(void) const;
141  size_t getNumConnectedEdges(const SetBase *) const;
142  std::set<const Edge *> getConnectedEdges(const SetBase *) const;
143  boost::python::list getConnectedEdgesPy(const SetBase *) const;
144 
145  size_t getNumConnectedSurfaces(void) const;
146  const std::set<const Face *> &getConnectedSurfaces(void) const;
147  boost::python::list getConnectedSurfacesPy(void) const;
148  const std::string &getConnectedSurfacesNames(void) const;
149  size_t getNumConnectedSurfaces(const SetBase *) const;
150  std::set<const Face *> getConnectedSurfaces(const SetBase *) const;
151  boost::python::list getConnectedSurfacesPy(const SetBase *) const;
152  std::set<const Face *> getConnectedSurfaces(const DqPtrsFaces &) const;
153 
154  bool isConnectedTo(const Face &s) const;
155  bool isConnectedTo(const Body &b) const;
156  bool isEndPoint(const Pnt &) const;
157  virtual Edge *splitAtPoint(Pnt *p);
158  virtual Edge *splitAtLambda(const double &);
159  virtual Edge *splitAtNaturalCoord(const double &);
160  virtual Edge *splitAtPos3d(const Pos3d &, const double &tol= 1e-6);
161 
162  std::set<SetBase *> get_sets(void) const;
163  void add_to_sets(std::set<SetBase *> &);
164 
165  boost::python::dict getPyDict(void) const;
166  void setPyDict(const boost::python::dict &);
167  };
168 
169 std::set<const Edge *> get_connected_lines(const Pnt &p);
170 size_t calcula_ndiv_lados(const std::set<const XC::Edge *> &);
171 
172 } //end of XC namespace
173 #endif
size_t getNumConnectedEdges(void) const
Return the number of edges connected to this one.
Definition: Edge.cc:542
Float vector abstraction.
Definition: Vector.h:94
void insert_surf(Face *s)
Insert a surface in contact with the line (neighbour).
Definition: Edge.cc:75
Node * getNodeReverse(const size_t &i)
Return the node whose ordinal index is passed as parameter, starting from the end.
Definition: Edge.cc:405
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: Edge.cc:1095
Base class for one-dimensional geometry objects.
Definition: Edge.h:49
virtual Pnt * P1(void)
Return a pointer to the edge&#39;s start point.
Definition: Edge.cc:86
boost::python::list getConnectedEdgesPy(void) const
Return the edges connected to this in a Python list.
Definition: Edge.cc:608
bool In(const GeomObj3d &, const double &tol=0.0) const
Returns true if the line lies inside the geometric object.
Definition: Edge.cc:201
double getElemSize(void) const
Return the element size (aka L/ndiv).
Definition: Edge.cc:304
std::vector< int > getIndicesVertices(void) const
Return indices of the vertices.
Definition: Edge.cc:982
virtual void setNDiv(const size_t &)
Assigns the number of of divisions if it is compatible with the homologous edges. ...
Definition: Edge.cc:262
virtual Node * getNode(const size_t &i1, const size_t &j, const size_t &k=1)
Return a pointer to node whose indices are passed as parameters.
Definition: Edge.cc:359
Finite element model generation tools.
Definition: Preprocessor.h:59
virtual void genMesh(meshing_dir dm)
Trigger mesh generation.
Definition: Edge.cc:926
Array of positions in a three-dimensional space.
Definition: Pos3dArray.h:38
boost::python::list getVerticesPy(void)
Return the vertices in a Python list.
Definition: Edge.cc:1066
virtual double getDist(const Pos3d &) const
Return the distance to the edge.
Definition: Edge.cc:1030
std::set< SetBase * > get_sets(void) const
Return the sets to which this edge belongs.
Definition: Edge.cc:956
bool isConnectedTo(const Face &s) const
Return true if the line touches the surface (neighbor).
Definition: Edge.cc:775
Vector of integers.
Definition: ID.h:95
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: Edge.cc:1080
Edge(Preprocessor *m, const size_t &nd=4)
Constructor.
Definition: Edge.cc:47
virtual std::deque< Segment3d > getSegments(void) const
Return the segments that compose the edge.
Definition: Edge.cc:995
virtual Edge * splitAtLambda(const double &)
Divides the line by the point obtained by: p1+lambda*VDir().
Definition: Edge.cc:325
bool areEndPoints(const Pnt *, const Pnt *) const
Returns true if the points passed as parameters are the ends of the edge.
Definition: Edge.cc:184
Base de las clases Set y SetEstruct.
Definition: SetBase.h:51
void SetElemSize(const double &sz)
Compute the number of divisions necessary to get the element size passed as parameter.
Definition: Edge.cc:296
virtual Vector3d getKVector(void) const
Returns a vector in the direction of the local Z axis.
Definition: Edge.cc:158
virtual Pos3d getCentroid(void) const
Return the centroid of the edge.
Definition: Edge.cc:122
virtual Edge * splitAtNaturalCoord(const double &)
Divides the line by the point obtained by: p1+lambda*VDir().
Definition: Edge.cc:334
virtual std::deque< Pnt * > getVertices(void)
Return the vertices.
Definition: Edge.cc:1048
std::vector< int > getTagsNodesForward(void) const
Return the IDs of the nodes in forward order.
Definition: Edge.cc:498
virtual int create_gmsh_line(void) const
Ask Gmsh to create the line corresponding to this edge.
Definition: Edge.cc:938
Node * getLastNode(void)
Return the last node of the line.
Definition: Edge.cc:445
virtual Edge * splitAtPos3d(const Pos3d &, const double &tol=1e-6)
Divides the edge at the point argument.
Definition: Edge.cc:345
void divide(void)
Create points along the line.
Definition: Edge.cc:309
virtual Edge * splitAtPoint(Pnt *p)
Divides the line by the point being passed as parameter.
Definition: Edge.cc:316
boost::python::list getConnectedSurfacesPy(void) const
Return the surfaces that touch this point (neighbors).
Definition: Edge.cc:705
virtual void create_nodes(void)
Create nodes on objects.
Definition: Edge.cc:919
void update_topology(void)
Update topology.
Definition: Edge.cc:79
void create_nodes_on_endpoints(void)
Create the nodes for both end points of the edge.
Definition: Edge.cc:803
Pos3dArray getNodePosReverse(void) const
Return the positions of the nodes in reverse order.
Definition: Edge.cc:531
std::vector< Node * > getNodesForward(void)
Return the node pointers in forward order.
Definition: Edge.cc:458
Container for preprocessor faces.
Definition: DqPtrsFaces.h:42
size_t getNumConnectedSurfaces(void) const
Return the number of surfaces that touch the line.
Definition: Edge.cc:637
Pos3dArray getNodePosForward(void) const
Return the positions of the nodes in forward order.
Definition: Edge.cc:520
std::set< const Edge * > getConnectedEdges(void) const
Return the edges connected to this one.
Definition: Edge.cc:569
Compound line.
Definition: CmbEdge.h:45
const std::string & getConnectedSurfacesNames(void) const
Return names of the surfaces that touch the line (neighbors).
Definition: Edge.cc:734
"boundary" en tres dimensiones.
Definition: BND3d.h:34
void setNDivHomologousEdges(const size_t &)
Assigns the number of divisions of this edge and all its homologous.
Definition: Edge.cc:247
Point (KPoint).
Definition: Pnt.h:51
virtual unsigned short int GetDimension(void) const
Return the object dimension (0, 1, 2 or 3).
Definition: Edge.h:69
virtual const Vector & getTang(const double &) const
Return a vector tangent to the line in point at parameter s.
Definition: Edge.cc:947
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:55
virtual Vector3d getIVector(void) const
Returns a vector in the direction of the local X axis.
Definition: Edge.cc:134
const std::set< const Face * > & getConnectedSurfaces(void) const
Return the surfaces that touch the line.
Definition: Edge.cc:664
bool Out(const GeomObj3d &, const double &tol=0.0) const
Returns true if the line lies outside the geometric object.
Definition: Edge.cc:224
boost::python::list getSegmentsPy(void) const
Return the segments in a Python list.
Definition: Edge.cc:1016
Node * getFirstNode(void)
Return the first node of the line.
Definition: Edge.cc:424
std::vector< Node * > create_interior_nodes(const std::vector< Pos3d > &positions)
Creates interior nodes at the positions being passed as parameters.
Definition: Edge.cc:841
size_t calcula_ndiv_lados(const std::set< const XC::Edge *> &)
Compute the number of divisions for each line to make it compatible with adjacent surface meshing...
Definition: Edge.cc:760
virtual size_t getNumberOfVertices(void) const =0
Return the number of vertices.
Posición en tres dimensiones.
Definition: Pos3d.h:44
virtual ID getKPoints(void) const
Return k-points.
Definition: Edge.cc:1039
virtual bool operator==(const Edge &) const
Comparison operator.
Definition: Edge.cc:59
virtual Matrix getLocalAxes(void) const
Returns a matrix with the axes of the surface as matrix rows [[x1,y1,z1],[x2,y2,z2],...·].
Definition: Edge.cc:167
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
void add_to_sets(std::set< SetBase *> &)
Add the «edge» to the sets passed as parameters.
Definition: Edge.cc:972
Matrix of floats.
Definition: Matrix.h:111
Six-faced solid.
Definition: Body.h:71
virtual Vector3d getJVector(void) const
Returns a vector in the direction of the local Y axis.
Definition: Edge.cc:146
std::set< const Edge * > get_connected_lines(const Pnt &p)
Return the list of edges that have this point as starting or ending point.
Definition: Edge.cc:795
std::vector< Node * > getNodesReverse(void)
Return the node pointersin reverse order.
Definition: Edge.cc:468
bool isEndPoint(const Pnt &) const
Return true if it is an end point of the line.
Definition: Edge.cc:791
Mesh node.
Definition: Node.h:112
std::vector< int > getTagsNodesReverse(void) const
Return the IDs of the nodes in reverse order.
Definition: Edge.cc:509
Surface.
Definition: Face.h:45
Node * getNodeForward(const size_t &i)
Returns the node whose ordinal index is passed as parameter, starting from the beginning.
Definition: Edge.cc:391
Vector en tres dimensiones.
Definition: Vector3d.h:39
Object set.
Definition: SetEntities.h:78
virtual Pnt * P2(void)
Return a pointer to the edge&#39;s start point.
Definition: Edge.cc:104
virtual Pos3dArray get_nodes_pos(void) const
Return a matrix of positions along the line.
Definition: Edge.cc:799
std::set< const XC::Edge * > getHomologousSides(void) const
Return the homologous sides to that passed as a parameter.
Definition: Edge.cc:750
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43