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 Body;
44 
48 class Edge: public EntMdlr
49  {
50  friend class CmbEdge;
51  friend class Face;
52  friend class SetEntities;
53  private:
54  size_t ndiv;
55  std::set<const Face *> surfaces_line;
56  protected:
57  void insert_surf(Face *s);
58  void create_nodes_on_endpoints(void);
59  std::vector<Node *> create_interior_nodes(const std::vector<Pos3d> &positions);
60  virtual int create_gmsh_line(void) const;
61  public:
62  Edge(Preprocessor *m,const size_t &nd= 4);
63  Edge(const std::string &name= "",Preprocessor *m= nullptr,const size_t &nd= 4);
64  virtual bool operator==(const Edge &) const;
65 
66  // Geometry.
68  inline virtual unsigned short int GetDimension(void) const
69  { return 1; }
70  virtual Pnt *P1(void);
71  virtual Pnt *P2(void);
72  virtual const Pnt *P1(void) const;
73  virtual const Pnt *P2(void) const;
74  bool In(const GeomObj3d &, const double &tol= 0.0) const;
75  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
76  bool areEndPoints(const Pnt *,const Pnt *) const;
78  virtual size_t getNumberOfVertices(void) const= 0;
79  virtual double getLength(void) const= 0;
80  virtual Pos3d getCentroid(void) const;
81  virtual Vector3d getIVector(void) const;
82  virtual Vector3d getJVector(void) const;
83  virtual Vector3d getKVector(void) const;
84  virtual Matrix getLocalAxes(void) const;
85  virtual const Pnt *getVertex(const size_t &i) const= 0;
86  virtual Pnt *getVertex(const size_t &i)= 0;
87  virtual void SetVertice(const size_t &,Pnt *)= 0;
88  std::vector<int> getIndicesVertices(void) const;
89  virtual std::deque<Pnt *> getVertices(void);
90  virtual std::deque<const Pnt *> getVertices(void) const;
91  boost::python::list getVerticesPy(void);
92  virtual ID getKPoints(void) const;
93  virtual std::deque<Segment3d> getSegments(void) const;
94  boost::python::list getSegmentsPy(void) const;
95  virtual Pos3dArray get_positions(void) const= 0;
96  virtual Pos3dArray get_nodes_pos(void) const;
97  virtual BND3d Bnd(void) const= 0;
98  virtual const Vector &getTang(const double &) const;
99  virtual double getDist(const Pos3d &) const;
100  void divide(void);
101 
102  // Meshing.
103  void setNDivHomologousEdges(const size_t &);
104  virtual void setNDiv(const size_t &);
105  inline virtual size_t NDiv(void) const
106  { return ndiv; }
107  void SetElemSize(const double &sz);
108  double getElemSize(void) const;
109  virtual void create_nodes(const Pos3dArray &);
110  virtual void create_nodes(void);
111  virtual void genMesh(meshing_dir dm);
112  virtual Node *getNode(const size_t &i1,const size_t &j,const size_t &k=1);
113  virtual const Node *getNode(const size_t &i,const size_t &j,const size_t &k=1) const;
114  virtual Node *getNode(const size_t &i);
115  virtual const Node *getNode(const size_t &i) const;
116  Node *getNodeForward(const size_t &i);
117  const Node *getNodeForward(const size_t &i) const;
118  Node *getNodeReverse(const size_t &i);
119  const Node *getNodeReverse(const size_t &i) const;
120  Node *getFirstNode(void);
121  const Node *getFirstNode(void) const;
122  Node *getLastNode(void);
123  const Node *getLastNode(void) const;
124 
125  std::vector<int> getTagsNodesForward(void) const;
126  std::vector<int> getTagsNodesReverse(void) const;
127  Pos3dArray getNodePosForward(void) const;
128  Pos3dArray getNodePosReverse(void) const;
129 
130  // Topology.
131  std::set<const XC::Edge *> getHomologousSides(void) const;
132  void update_topology(void);
133  const size_t getNumConnectedSurfaces(void) const;
134  const std::set<const Face *> &getConnectedSurfaces(void) const;
135  const std::string &getConnectedSurfacesNames(void) const;
136  bool isConnectedTo(const Face &s) const;
137  bool isConnectedTo(const Body &b) const;
138  bool isEndPoint(const Pnt &) const;
139  virtual Edge *splitAtPoint(Pnt *p);
140  virtual Edge *splitAtLambda(const double &);
141  virtual Edge *splitAtNaturalCoord(const double &);
142  virtual Edge *splitAtPos3d(const Pos3d &, const double &tol= 1e-6);
143 
144  std::set<SetBase *> get_sets(void) const;
145  void add_to_sets(std::set<SetBase *> &);
146 
147  boost::python::dict getPyDict(void) const;
148  void setPyDict(const boost::python::dict &);
149  };
150 
151 std::set<const Edge *> getConnectedLines(const Pnt &p);
152 size_t calcula_ndiv_lados(const std::set<const XC::Edge *> &);
153 
154 } //end of XC namespace
155 #endif
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:867
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
virtual Pnt * P1(void)
Return a pointer to the edge&#39;s start point.
Definition: Edge.cc:86
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:754
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:698
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:838
virtual double getDist(const Pos3d &) const
Return the distance to the edge.
Definition: Edge.cc:802
std::set< SetBase * > get_sets(void) const
Return the sets to which this edge belongs.
Definition: Edge.cc:728
bool isConnectedTo(const Face &s) const
Return true if the line touches the surface (neighbor).
Definition: Edge.cc:547
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:852
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:767
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
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:820
std::vector< int > getTagsNodesForward(void) const
Return the IDs of the nodes in forward order.
Definition: Edge.cc:458
virtual int create_gmsh_line(void) const
Ask Gmsh to create the line corresponding to this edge.
Definition: Edge.cc:710
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
virtual void create_nodes(void)
Create nodes on objects.
Definition: Edge.cc:691
void update_topology(void)
Update topology.
Definition: Edge.cc:79
const size_t getNumConnectedSurfaces(void) const
Return the number of surfaces that touch the line.
Definition: Edge.cc:498
void create_nodes_on_endpoints(void)
Create the nodes for both end points of the edge.
Definition: Edge.cc:575
Pos3dArray getNodePosReverse(void) const
Return the positions of the nodes in reverse order.
Definition: Edge.cc:488
Pos3dArray getNodePosForward(void) const
Return the positions of the nodes in forward order.
Definition: Edge.cc:478
Compound line.
Definition: CmbEdge.h:46
const std::string & getConnectedSurfacesNames(void) const
Return names of the surfaces that touch the line (neighbors).
Definition: Edge.cc:506
"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:50
virtual unsigned short int GetDimension(void) const
Return the object dimension (0, 1, 2 or 3).
Definition: Edge.h:68
virtual const Vector & getTang(const double &) const
Return a vector tangent to the line in point at parameter s.
Definition: Edge.cc:719
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:502
std::set< const Axis * > getConnectedLines(const Spot &p)
Return the set of lines that touch the point being passed as parameter.
Definition: Axis.cc:97
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:788
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:613
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:532
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:811
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:744
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
bool isEndPoint(const Pnt &) const
Return true if it is an end point of the line.
Definition: Edge.cc:563
Mesh node.
Definition: Node.h:111
std::vector< int > getTagsNodesReverse(void) const
Return the IDs of the nodes in reverse order.
Definition: Edge.cc:468
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:77
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:571
std::set< const XC::Edge * > getHomologousSides(void) const
Return the homologous sides to that passed as a parameter.
Definition: Edge.cc:522
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43