xc
CmbEdge.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 //CmbEdge.h
28 //Compound line.
29 
30 #ifndef CMBEDGE_H
31 #define CMBEDGE_H
32 
33 #include <deque>
34 #include "Edge.h"
35 
36 class Polyline3d;
37 
38 namespace XC {
42 class CmbEdge: public Edge
43  {
44 
45  public:
46 
57  class Side: public CommandEntity
58  {
59  Edge *edge;
60  bool forward;
61  protected:
62 
63  public:
64  Side(Edge *ptr= nullptr,const bool &s=true);
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  bool ExtremosEn(const Pnt *,const Pnt *) const;
71  const std::string &getName(void) const;
72  inline bool isDirect(void) const
73  { return forward; }
74  inline void reverse(void)
75  { forward= !forward; }
76  void SetNDiv(const size_t &nd);
77  size_t NDiv(void) const;
78  size_t GetTag(void) const;
79  Pos3dArray get_positions(void) const;
80  std::vector<int> getTagsNodesForward(void) const;
81  std::vector<int> getTagsNodesReverse(void) const;
82  Pos3dArray getNodePosForward(void) const;
83  Pos3dArray getNodePosReverse(void) const;
84  double getLength(void) const;
85  Pos3d getCentroid(void) const;
86  bool In(const GeomObj3d &, const double &tol= 0.0) const;
87  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
88  const Vector &getTang(const double &) const;
89  Node *getNodeForward(const size_t &i);
90  Node *getNodeReverse(const size_t &i);
91  Node *getNode(const size_t &i);
92  const Node *getNode(const size_t &i) const;
93  void genMesh(meshing_dir dm);
94  friend bool operator==(const Side &il1,const Side &il2);
95 
96  };
97  protected:
98  std::deque<Side> lines;
99  Pos3dArray get_positions(void) const;
100 
101  Side *first_line(void);
102  const Side *first_line(void) const;
103  Side *last_line(void);
104  const Side *last_line(void) const;
105 
106 
107  const Pnt *first_point(void) const;
108  const Pnt *last_point(void) const;
109 
110  protected:
111 
112  void create_line_nodes(void);
113  void line_meshing(meshing_dir dm);
114  Pnt *P1(void);
115  Pnt *P2(void);
116  void close(void);
117  public:
118  CmbEdge(void);
119  CmbEdge(Preprocessor *m,const size_t &nd= 4);
120  CmbEdge(const std::string &nombre,Preprocessor *m,const size_t &nd);
121  virtual SetEstruct *getCopy(void) const;
122  virtual void insert(Edge *l);
123  void insert(const size_t &i);
124  Edge *newLine(Pnt *,Pnt *);
125  Edge *newLine(Pnt *,Pnt *,Pnt *);
126  void addPoints(const ID &);
127  void addLines(const ID &);
128  size_t NDiv(void) const;
129  void SetNDiv(const size_t &nd);
130 
132  size_t getNumberOfEdges(void) const
133  { return lines.size(); }
134  inline std::deque<Side> &getSides(void)
135  { return lines; }
136  void reverse(void);
137  bool In(const GeomObj3d &, const double &tol= 0.0) const;
138  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
139 
140  double getLength(void) const;
141  Pos3d getCentroid(void) const;
142 
144  virtual size_t getNumberOfVertices(void) const
145  { return getNumberOfEdges()+1; }
146 
147  const Pnt *P1(void) const;
148  const Pnt *P2(void) const;
149 
150  size_t IndiceEdge(const Edge *l) const;
151  const Side *getSide(const size_t &i) const;
152  Side *getSide(const size_t &i);
153  const Side *getSideByPoints(const Pnt *,const Pnt *) const;
154  Side *getSideByPoints(const Pnt *,const Pnt *);
155  const Side *getSideByPoints(const size_t &,const size_t &) const;
156  Side *getSideByPoints(const size_t &,const size_t &);
157  std::deque<Edge *> GetEdges(void);
158  virtual const Pnt *getVertex(const size_t &i) const;
159  virtual void SetVertice(const size_t &,Pnt *);
160  virtual ID getKPoints(void) const;
161  Polyline3d getPolyline(void) const;
162 
163  BND3d Bnd(void) const;
164  void genMesh(meshing_dir dm);
165 
166  friend bool operator==(const Side &il1,const Side &il2);
167 
168 
169  };
170 
171 bool operator==(const CmbEdge::Side &il1,const CmbEdge::Side &il2);
172 
173 } //end of XC namespace
174 
175 #endif
size_t getNumberOfEdges(void) const
Return the number of edges.
Definition: CmbEdge.h:132
const Pnt * first_point(void) const
Returns a pointer to the first point.
Definition: CmbEdge.cc:299
virtual void SetVertice(const size_t &, Pnt *)
Sets the i-th vertex.
Definition: CmbEdge.cc:715
Component of a compound line.
Definition: CmbEdge.h:57
Float vector abstraction.
Definition: Vector.h:93
size_t NDiv(void) const
Return the number of divisions of the line.
Definition: CmbEdge.cc:230
size_t IndiceEdge(const Edge *l) const
Searchs the line l from those of this compound line.
Definition: CmbEdge.cc:628
void create_line_nodes(void)
Triggers node creation on the edges.
Definition: CmbEdge.cc:442
Node * getNode(const size_t &i)
Return the node which index is being passed as parameter.
Definition: CmbEdge.cc:194
void close(void)
Close the line.
Definition: CmbEdge.cc:519
Base class for one-dimensional geometry objects.
Definition: Edge.h:46
void SetEdge(Edge *l)
Assigns the line.
Definition: CmbEdge.cc:54
Pos3d getCentroid(void) const
Return the segment than links both ends.
Definition: CmbEdge.cc:117
double getLength(void) const
Return the side length.
Definition: CmbEdge.cc:97
Finite element model generation tools.
Definition: Preprocessor.h:58
virtual SetEstruct * getCopy(void) const
Virtual constructor.
Definition: CmbEdge.cc:261
size_t GetTag(void) const
Return the identifier of the line.
Definition: CmbEdge.cc:234
Edge * newLine(Pnt *, Pnt *)
Creates a new line between the points being passed as parameters and inserts it on the edge set set...
Definition: CmbEdge.cc:539
CmbEdge(void)
Constructor.
Definition: CmbEdge.cc:246
bool ExtremosEn(const Pnt *, const Pnt *) const
Returns true if the points being passed as parameters are the endpoints of the side.
Definition: CmbEdge.cc:78
Pos3dArray get_positions(void) const
Return the positions on the line.
Definition: CmbEdge.cc:125
std::vector< int > getTagsNodesReverse(void) const
Return the identifiers of the nodes of the reverse sequence.
Definition: CmbEdge.cc:143
bool Out(const GeomObj3d &, const double &tol=0.0) const
Returns true if this object lies outside the geometric object.
Definition: CmbEdge.cc:113
Vector of integers.
Definition: ID.h:93
Edge * getEdge(void)
Returns a pointer to the edge.
Definition: CmbEdge.cc:48
virtual const Pnt * getVertex(const size_t &i) const
Return the i-th vertex.
Definition: CmbEdge.cc:705
void line_meshing(meshing_dir dm)
Triggers meshing of lines.
Definition: CmbEdge.cc:449
const Side * getSideByPoints(const Pnt *, const Pnt *) const
Return the side which extremes are the points being passed as parameters.
Definition: CmbEdge.cc:651
const Pnt * P1(void) const
Returns a constant pointer to the back end of the edge.
Definition: CmbEdge.cc:57
void addLines(const ID &)
Creates and inserts the edges from the indexes being passed as parameter.
Definition: CmbEdge.cc:484
virtual ID getKPoints(void) const
Returns object k-points.
Definition: CmbEdge.cc:722
std::deque< Edge * > GetEdges(void)
Return the deque of lines that define the edges.
Definition: CmbEdge.cc:696
Side * last_line(void)
Returns a pointer to the last edge.
Definition: CmbEdge.cc:282
Node * getNodeForward(const size_t &i)
Return the node which index is being passed as parameter empezando por el principio.
Definition: CmbEdge.cc:170
const Vector & getTang(const double &) const
Returns a vector tangent to the side at the point s.
Definition: CmbEdge.cc:121
Node * getNodeReverse(const size_t &i)
Return the node which index is being passed as parameter empezando por el final.
Definition: CmbEdge.cc:182
virtual size_t getNumberOfVertices(void) const
Return the number of vertices.
Definition: CmbEdge.h:144
const Pnt * last_point(void) const
Returns a pointer to the last point.
Definition: CmbEdge.cc:309
void addPoints(const ID &)
Creates and inserts the the edges that link the points from the indexes being passed as parameter...
Definition: CmbEdge.cc:493
bool In(const GeomObj3d &, const double &tol=0.0) const
Returns true if this object lies inside the geometric object.
Definition: CmbEdge.cc:105
Side * first_line(void)
Returns a pointer to the first lado.
Definition: CmbEdge.cc:266
Pos3dArray getNodePosForward(void) const
Return the positions of the nodes of the forward sequence.
Definition: CmbEdge.cc:152
Pos3dArray getNodePosReverse(void) const
Return the positions of the nodes of the reverse sequence.
Definition: CmbEdge.cc:161
Compound line.
Definition: CmbEdge.h:42
const Side * getSide(const size_t &i) const
Returns a lado of the line compuesta.
Definition: CmbEdge.cc:642
virtual void insert(Edge *l)
Inserts the line which pointer is being passed as parameter.
Definition: CmbEdge.cc:594
Point (KPoint).
Definition: Pnt.h:49
structured set, i.
Definition: SetEstruct.h:45
Side(Edge *ptr=nullptr, const bool &s=true)
Constructor.
Definition: CmbEdge.cc:44
std::deque< Side > lines
Lines that compose the object.
Definition: CmbEdge.h:98
void SetNDiv(const size_t &nd)
Set el number of divisions of the line.
Definition: CmbEdge.cc:226
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
const std::string & getName(void) const
Return the name of the line.
Definition: CmbEdge.cc:93
void genMesh(meshing_dir dm)
Genertes a mesh from the corresponding line.
Definition: CmbEdge.cc:222
Mesh node.
Definition: Node.h:110
Polyline3d getPolyline(void) const
Returns a polyline representation of the object.
Definition: CmbEdge.cc:732
const Pnt * P2(void) const
Returns a constant pointer to the front end of the edge.
Definition: CmbEdge.cc:66
std::vector< int > getTagsNodesForward(void) const
Return the identifiers of the nodes of the forward sequence.
Definition: CmbEdge.cc:134
BND3d Bnd(void) const
Returns object BND.
Definition: CmbEdge.cc:743