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 
46 class CmbEdge: public Edge
47  {
48  public:
59  class Side: public CommandEntity
60  {
61  Edge *edge;
62  bool forward;
63  public:
64  Side(Edge *ptr= nullptr,const bool &s=true);
65  bool equal(const Side &) const;
66  Edge *getEdge(void);
67  const Edge *getEdge(void) const;
68  void SetEdge(Edge *l);
69  const Pnt *P1(void) const;
70  const Pnt *P2(void) const;
71  Pnt *P1(void);
72  Pnt *P2(void);
73  bool areEndPoints(const Pnt *,const Pnt *) const;
74  const std::string &getName(void) const;
75  inline bool isDirect(void) const
76  { return forward; }
77  inline void reverse(void)
78  { forward= !forward; }
79  size_t getTag(void) const;
80 
81  // Number of divisions.
82  void setNDivHomologousEdges(const size_t &);
83  void setNDiv(const size_t &nd);
84  size_t NDiv(void) const;
85  double getElemSize(void) const;
86 
87 
88  // Node positions.
89  Pos3dArray get_positions(void) const;
90  std::vector<int> getTagsNodesForward(void) const;
91  std::vector<int> getTagsNodesReverse(void) const;
92  Pos3dArray getNodePosForward(void) const;
93  Pos3dArray getNodePosReverse(void) const;
94 
95  // Geometry
96  double getLength(void) const;
97  Pos3d getCentroid(void) const;
98  bool In(const GeomObj3d &, const double &tol= 0.0) const;
99  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
100  const Vector &getTang(const double &) const;
101  double getDist(const Pos3d &) const;
102 
103  // Mesh
104  Node *getNodeForward(const size_t &i);
105  Node *getNodeReverse(const size_t &i);
106  Node *getNode(const size_t &i);
107  const Node *getNode(const size_t &i) const;
108  void genMesh(meshing_dir dm);
109  friend bool operator==(const Side &il1,const Side &il2);
110 
111  boost::python::dict getPyDict(void) const;
112  void setPyDict(LineMap &, const boost::python::dict &);
113  };
114  protected:
115  std::deque<Side> lines;
116  Pos3dArray get_positions(void) const;
117 
118  Side *first_line(void);
119  const Side *first_line(void) const;
120  Side *last_line(void);
121  const Side *last_line(void) const;
122 
123 
124  const Pnt *first_point(void) const;
125  const Pnt *last_point(void) const;
126 
127  virtual void create_line_nodes(void);
128  void line_meshing(meshing_dir dm);
129  void close(void);
130  void revolve(const int &);
131  public:
132  CmbEdge(void);
133  CmbEdge(Preprocessor *m,const size_t &nd= 4);
134  CmbEdge(const std::string &name,Preprocessor *m,const size_t &nd);
135  virtual bool operator==(const CmbEdge &) const;
136  virtual SetEstruct *getCopy(void) const;
137  virtual void insert(Edge *l);
138  void insert(const size_t &i);
139  Edge *newLine(Pnt *,Pnt *);
140  Edge *newLine(Pnt *,Pnt *,Pnt *);
141  void addPoints(const ID &);
142  void addLines(const ID &);
143 
144  // Number of divisions.
145  size_t NDiv(void) const;
146  void setNDiv(const size_t &nd);
147  double getAvgElemSize(void) const;
148  double getMaxElemSize(void) const;
149  double getMinElemSize(void) const;
150 
152  size_t getNumberOfEdges(void) const
153  { return lines.size(); }
154  inline std::deque<Side> &getSides(void)
155  { return lines; }
156  inline const std::deque<Side> &getSides(void) const
157  { return lines; }
158  CmbEdge getReversed(void) const;
159  virtual void reverse(void);
160  bool In(const GeomObj3d &, const double &tol= 0.0) const;
161  bool Out(const GeomObj3d &, const double &tol= 0.0) const;
162 
163  double getLength(void) const;
164  Pos3d getCentroid(void) const;
165  virtual double getDist(const Pos3d &) const;
166 
168  virtual size_t getNumberOfVertices(void) const
169  { return getNumberOfEdges()+1; }
170 
171  Pnt *P1(void);
172  Pnt *P2(void);
173  const Pnt *P1(void) const;
174  const Pnt *P2(void) const;
175 
176  bool hasEdge(const Edge *) const;
177  size_t IndiceEdge(const Edge *) const;
178  const Side *getSide(const size_t &i) const;
179  Side *getSide(const size_t &i);
180  const Side *getSideByPoints(const Pnt *,const Pnt *) const;
181  Side *getSideByPoints(const Pnt *,const Pnt *);
182  const Side *getSideByPoints(const size_t &,const size_t &) const;
183  Side *getSideByPoints(const size_t &,const size_t &);
184  std::deque<Edge *> getEdges(void);
185  std::deque<const Edge *> getEdges(void) const;
186  boost::python::list getEdgesPy(void) const;
187  std::deque<Side *> findSides(const Pos3d &);
188 
189  virtual const Pnt *getVertex(const size_t &i) const;
190  virtual Pnt *getVertex(const size_t &i);
191  std::deque<Pnt *> getVertices(void);
192  std::deque<const Pnt *> getVertices(void) const;
193  std::set<const Pnt *> getVertexSet(void) const;
194  virtual void SetVertice(const size_t &,Pnt *);
195  virtual ID getKPoints(void) const;
196  Pnt *findVertex(const Pos3d &);
197 
198  Polyline3d getPolyline(void) const;
199 
200  BND3d Bnd(void) const;
201  void genMesh(meshing_dir dm);
202 
203  friend bool operator==(const Side &il1,const Side &il2);
204 
205  boost::python::dict getPyDict(void) const;
206  void setPyDict(const boost::python::dict &);
207  };
208 
210 inline bool operator==(const CmbEdge::Side &il1,const CmbEdge::Side &il2)
211  { return il1.equal(il2); }
212 
213 } //end of XC namespace
214 
215 #endif
size_t getNumberOfEdges(void) const
Return the number of edges.
Definition: CmbEdge.h:152
const Pnt * first_point(void) const
Returns a pointer to the first point.
Definition: CmbEdge.cc:378
double getMaxElemSize(void) const
Return the maximum element size.
Definition: CmbEdge.cc:551
virtual void SetVertice(const size_t &, Pnt *)
Sets the i-th vertex.
Definition: CmbEdge.cc:966
Component of a compound line.
Definition: CmbEdge.h:59
Float vector abstraction.
Definition: Vector.h:94
size_t NDiv(void) const
Return the number of divisions of the line.
Definition: CmbEdge.cc:275
virtual void create_line_nodes(void)
Triggers node creation on the edges.
Definition: CmbEdge.cc:598
Node * getNode(const size_t &i)
Return the node which index is being passed as parameter.
Definition: CmbEdge.cc:229
void close(void)
Close the line.
Definition: CmbEdge.cc:675
Base class for one-dimensional geometry objects.
Definition: Edge.h:48
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:867
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:340
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:695
CmbEdge(void)
Constructor.
Definition: CmbEdge.cc:310
friend bool operator==(const Side &il1, const Side &il2)
Comparison operator.
Definition: CmbEdge.h:210
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:299
std::vector< int > getTagsNodesReverse(void) const
Return the identifiers of the nodes of the reverse sequence.
Definition: CmbEdge.cc:178
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:541
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:918
void line_meshing(meshing_dir dm)
Triggers meshing of lines.
Definition: CmbEdge.cc:605
const Side * getSideByPoints(const Pnt *, const Pnt *) const
Return the side whose end points are the points being passed as parameters.
Definition: CmbEdge.cc:822
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:640
virtual ID getKPoints(void) const
Returns object k-points.
Definition: CmbEdge.cc:995
double getElemSize(void) const
Return the element size.
Definition: CmbEdge.cc:279
Side * last_line(void)
Returns a pointer to the last edge.
Definition: CmbEdge.cc:361
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: CmbEdge.cc:287
Node * getNodeForward(const size_t &i)
Return the node which index is being passed as parameter empezando por el principio.
Definition: CmbEdge.cc:205
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:217
std::deque< Pnt * > getVertices(void)
Return the vertices.
Definition: CmbEdge.cc:936
boost::python::list getEdgesPy(void) const
Return the lines that define the edges in a Python list.
Definition: CmbEdge.cc:885
virtual size_t getNumberOfVertices(void) const
Return the number of vertices.
Definition: CmbEdge.h:168
const Pnt * last_point(void) const
Returns a pointer to the last point.
Definition: CmbEdge.cc:388
void addPoints(const ID &)
Creates and inserts the the edges that link the points from the indexes being passed as parameter...
Definition: CmbEdge.cc:649
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:345
bool hasEdge(const Edge *) const
Return true if the given edge makes part of this compound line.
Definition: CmbEdge.cc:784
Pos3dArray getNodePosForward(void) const
Return the positions of the nodes of the forward sequence.
Definition: CmbEdge.cc:187
Pos3dArray getNodePosReverse(void) const
Return the positions of the nodes of the reverse sequence.
Definition: CmbEdge.cc:196
size_t getTag(void) const
Return the identifier of the line.
Definition: CmbEdge.cc:283
Objet that can execute python scripts.
Definition: CommandEntity.h:40
Compound line.
Definition: CmbEdge.h:46
const Side * getSide(const size_t &i) const
Returns a lado of the line compuesta.
Definition: CmbEdge.cc:813
"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:750
Point (KPoint).
Definition: Pnt.h:50
structured set, i.
Definition: SetEstruct.h:47
void revolve(const int &)
Move forward or backwards the sequence of vertexes.
Definition: CmbEdge.cc:433
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:900
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:263
size_t IndiceEdge(const Edge *) const
Searches the line l from those of this compound line.
Definition: CmbEdge.cc:799
std::deque< Side > lines
Lines that compose the object.
Definition: CmbEdge.h:115
double getMinElemSize(void) const
Return the minimum element size.
Definition: CmbEdge.cc:562
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
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
std::set< const Pnt * > getVertexSet(void) const
Return the vertices.
Definition: CmbEdge.cc:956
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:257
Mesh node.
Definition: Node.h:111
void setNDiv(const size_t &nd)
Set the number of divisions of the side.
Definition: CmbEdge.cc:269
CmbEdge getReversed(void) const
Return the reverse vertex sequence.
Definition: CmbEdge.cc:410
Polyline3d getPolyline(void) const
Returns a polyline representation of the object.
Definition: CmbEdge.cc:1005
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:169
Pnt * findVertex(const Pos3d &)
Return a pointer to the vertex at the position argument.
Definition: CmbEdge.cc:975
BND3d Bnd(void) const
Returns object BND.
Definition: CmbEdge.cc:1016
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43