xc
EntMdlr.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 //EntMdlr.h
29 //Multiblock topology entity.
30 
31 #ifndef ENTMDLR_H
32 #define ENTMDLR_H
33 
34 #include "preprocessor/set_mgmt/SetEstruct.h"
35 #include "preprocessor/multi_block_topology/matrices/NodePtrArray3d.h"
36 #include "preprocessor/multi_block_topology/matrices/ElemPtrArray3d.h"
37 #include "preprocessor/MeshingParams.h"
38 
39 class BND3d;
40 class Pos3d;
41 class Pos3dArray;
42 class Pos3dArray3d;
43 class RangoIndice;
44 class Array3dRange;
45 class GeomObj3d;
46 
47 namespace XC {
48 class IRowSet;
49 class JRowSet;
50 class KRowSet;
51 
55 class EntMdlr: public SetEstruct
56  {
57  private:
58  size_t idx;
59  bool doGenMesh;
60  protected:
61  NodePtrArray3d ttzNodes;
62  ElemPtrArray3d ttzElements;
63  friend class Set;
64  friend class SetMeshComp;
65  friend class MultiBlockTopology;
66  virtual void update_topology(void)= 0;
67  void create_nodes(const Pos3dArray3d &);
68  Node *create_node(const Pos3d &pos,size_t i=1,size_t j=1, size_t k=1);
69  const Node *set_node(size_t i,size_t j, size_t k, Node *);
70  bool create_elements(meshing_dir dm);
71  Pnt *create_point(const Pos3d &);
72  Pnt *create_point_if_needed(const Pos3d &, const double &tol= 1e-6);
73  void create_points(const Pos3dArray &);
74  SetEstruct *create_row_set(const Array3dRange &,const std::string &);
75 
76  void clearAll(void);
77  public:
78  EntMdlr(Preprocessor *m,const size_t &i= 0);
79  EntMdlr(const std::string &name= "",const size_t &i= 0,Preprocessor *m= nullptr);
80  EntMdlr(const EntMdlr &);
81  virtual ~EntMdlr(void);
82  EntMdlr &operator=(const EntMdlr &);
83  virtual bool operator==(const EntMdlr &) const;
84 
85  std::string getDescription(void) const;
86 
87  virtual void set_index(const size_t &i);
88 
89  virtual bool In(const GeomObj3d &, const double &tol= 0.0) const;
90  virtual bool Out(const GeomObj3d &, const double &tol= 0.0) const;
91 
92  inline bool hasNodes(void) const
93  { return !ttzNodes.empty(); }
94  virtual size_t getNumNodeLayers(void) const
95  { return ttzNodes.getNumberOfLayers(); }
96  virtual size_t getNumNodeRows(void) const
97  { return ttzNodes.getNumberOfRows(); }
98  virtual size_t getNumNodeColumns(void) const
99  { return ttzNodes.getNumberOfColumns(); }
100  virtual size_t getNumElementLayers(void) const
101  { return ttzElements.getNumberOfLayers(); }
102  virtual size_t getNumElementRows(void) const
103  { return ttzElements.getNumberOfRows(); }
104  virtual size_t getNumElementColumns(void) const
105  { return ttzElements.getNumberOfColumns(); }
106 
107  virtual Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1);
108  virtual const Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1) const;
109  std::deque<const Node *> getNodePtrs(void) const;
110  Node *getNearestNode(const Pos3d &p);
111  const Node *getNearestNode(const Pos3d &p) const;
112  ID getNodeIndices(const Node *) const;
113  ID getIndicesOfNearestNode(const Pos3d &) const;
114  virtual Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1);
115  virtual const Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1) const;
116  Node *findNode(const int &tag);
117  const Node *findNode(const int &tag) const;
118  bool remove(Node *);
119  bool removeNode(const int &);
120 
121  Element *findElement(const int &);
122  const Element *findElement(const int &) const;
123  Element *getNearestElement(const Pos3d &p);
124  const Element *getNearestElement(const Pos3d &p) const;
125  bool remove(Element *);
126  bool removeElement(const int &);
127  std::set<const Element *> getConnectedElements(const Node *) const;
128  std::set<Element *> getConnectedElements(const Node *);
129  boost::python::list getConnectedElementsPy(const Node *);
130 
131  NodePtrArray3d &getTtzNodes(void)
132  { return ttzNodes; }
133  const NodePtrArray3d &getTtzNodes(void) const
134  { return ttzNodes; }
135  ElemPtrArray3d &getTtzElements(void)
136  { return ttzElements; }
137  const ElemPtrArray3d &getTtzElements(void) const
138  { return ttzElements; }
139 
141  virtual unsigned short int GetDimension(void) const= 0;
142  virtual BND3d Bnd(void) const= 0;
143 
144  IRowSet getVarRefIRow(size_t f=1,size_t c=1,const std::string &nmb="tmp");
145  IRowSet getVarRefIRow(const RangoIndice &layer_range,size_t f,size_t c,const std::string &nmb="tmp");
146  IRowSet getVarRefIRow(const Array3dRange &rango,const std::string &nmb="tmp");
147 
148  JRowSet getVarRefJRow(size_t layer=1,size_t c=1,const std::string &nmb="tmp");
149  JRowSet getVarRefJRow(size_t layer,const RangoIndice &row_range,size_t c,const std::string &nmb="tmp");
150  JRowSet getVarRefJRow(const Array3dRange &rango,const std::string &nmb="tmp");
151 
152  KRowSet getVarRefKRow(size_t layer=1,size_t f=1,const std::string &nmb="tmp");
153  KRowSet getVarRefKRow(size_t layer,size_t f,const RangoIndice &column_range,const std::string &nmb="tmp");
154  KRowSet getVarRefKRow(const Array3dRange &rango,const std::string &nmb="tmp");
155 
156  void fix(const SFreedom_Constraint &);
157 
158 
159  void setGenMesh(bool m);
160  const bool &getGenMesh(void) const;
161 
162  virtual std::set<SetBase *> get_sets(void) const= 0;
163 
164  virtual double getSquaredDistanceTo(const Pos3d &pt) const;
165  virtual double getDistanceTo(const Pos3d &pt) const;
166 
167  Vector getSimpsonWeights(const std::string &,const std::string &,const size_t &f=1,const size_t &c=1, const size_t &n= 10) const;
168 
169  void BorraPtrNodElem(void);
170 
171  virtual Pos3d getCentroid(void) const;
172 
173  // VTK
174  virtual int getVtkCellType(void) const;
176  inline size_t getIdx(void) const
177  { return idx; }
178 
179  boost::python::dict getPyDict(void) const;
180  void setPyDict(const boost::python::dict &);
181  };
182 
183 } //end of XC namespace
184 
185 #endif
void create_points(const Pos3dArray &)
Creates points at the positions being passed as parameters.
Definition: EntMdlr.cc:512
Float vector abstraction.
Definition: Vector.h:94
ID getIndicesOfNearestNode(const Pos3d &) const
Return the indexes of the nearest node to the given position.
Definition: EntMdlr.cc:205
bool create_elements(meshing_dir dm)
Creates elements on the nodes created in create_nodes.
Definition: EntMdlr.cc:422
Pnt * create_point_if_needed(const Pos3d &, const double &tol=1e-6)
Creates a point if there is no other existing point at a distance less that tol.
Definition: EntMdlr.cc:494
Set of objects in a row.
Definition: KRowSet.h:51
virtual bool Out(const GeomObj3d &, const double &tol=0.0) const
Returns true if the object lies outside the geometric object.
Definition: EntMdlr.cc:136
virtual ~EntMdlr(void)
Destructor.
Definition: EntMdlr.cc:587
boost::python::dict getPyDict(void) const
Return a Python dictionary containing the object members values.
Definition: EntMdlr.cc:592
virtual bool In(const GeomObj3d &, const double &tol=0.0) const
Returns true if the object lies inside the geometric object.
Definition: EntMdlr.cc:123
Finite element model generation tools.
Definition: Preprocessor.h:59
virtual Pos3d getCentroid(void) const
Return the centroid of the object.
Definition: EntMdlr.cc:578
Array of positions in a three-dimensional space.
Definition: Pos3dArray.h:38
virtual Node * getNode(const size_t &i=1, const size_t &j=1, const size_t &k=1)
Returns a pointer to the node which indexes are being passed as parameters.
Definition: EntMdlr.cc:164
Model geometry manager.
Definition: MultiBlockTopology.h:68
Node * create_node(const Pos3d &pos, size_t i=1, size_t j=1, size_t k=1)
Creates a node at the position being passed as parameter.
Definition: EntMdlr.cc:346
const bool & getGenMesh(void) const
Returns true if the points begins or ends in the line.
Definition: EntMdlr.cc:485
bool removeNode(const int &)
Remove the node identifie by the given tag from the array.
Definition: EntMdlr.cc:293
EntMdlr & operator=(const EntMdlr &)
Assignment operator.
Definition: EntMdlr.cc:63
Vector of integers.
Definition: ID.h:95
virtual unsigned short int GetDimension(void) const =0
Return the object dimension (0, 1, 2 or 3).
Pnt * create_point(const Pos3d &)
Creates a point at the position being passed as parameter.
Definition: EntMdlr.cc:489
Three-dimensional array of pointers to elements.
Definition: ElemPtrArray3d.h:47
virtual Element * getElement(const size_t &i=1, const size_t &j=1, const size_t &k=1)
Returns a pointer to the element which indexes are being passed as parameters.
Definition: EntMdlr.cc:217
void create_nodes(const Pos3dArray3d &)
Creates nodes at the positions being passed as parameters.
Definition: EntMdlr.cc:367
const Node * set_node(size_t i, size_t j, size_t k, Node *)
Set the (i,j,k) node.
Definition: EntMdlr.cc:401
Vector getSimpsonWeights(const std::string &, const std::string &, const size_t &f=1, const size_t &c=1, const size_t &n=10) const
Return Simpson&#39;s weights.
Definition: EntMdlr.cc:332
Base class for the finite elements.
Definition: Element.h:112
Set of objecst in a row.
Definition: IRowSet.h:51
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:59
boost::python::list getConnectedElementsPy(const Node *)
Return the elements connected to the node being passed as parameter.
Definition: EntMdlr.cc:259
Node * findNode(const int &tag)
Returns a pointer to the node cuyo identifier is being passed as parameter.
Definition: EntMdlr.cc:263
Element * findElement(const int &)
Returns a pointer to the element identified by the tag being passed as parameter. ...
Definition: EntMdlr.cc:272
virtual int getVtkCellType(void) const
Interfaz con VTK.
Definition: EntMdlr.cc:110
virtual bool operator==(const EntMdlr &) const
Comparison operator.
Definition: EntMdlr.cc:74
Node * getNearestNode(const Pos3d &p)
Return the node closest to the point being passed as parameter.
Definition: EntMdlr.cc:190
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
Object set.
Definition: Set.h:57
"boundary" en tres dimensiones.
Definition: BND3d.h:34
EntMdlr(Preprocessor *m, const size_t &i=0)
Constructor.
Definition: EntMdlr.cc:47
ID getNodeIndices(const Node *) const
Return the indexes of the given node.
Definition: EntMdlr.cc:201
Objects in a row.
Definition: JRowSet.h:51
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: EntMdlr.cc:601
Point (KPoint).
Definition: Pnt.h:50
std::string getDescription(void) const
Return a description of the object.
Definition: EntMdlr.cc:102
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:55
bool removeElement(const int &)
Remove the element identifie by the given tag from the array.
Definition: EntMdlr.cc:285
structured set, i.
Definition: SetEstruct.h:47
Position array in a three-dimensional space.
Definition: Pos3dArray3d.h:37
std::set< const Element * > getConnectedElements(const Node *) const
Return the elements connected to the node being passed as parameter.
Definition: EntMdlr.cc:251
Posición en tres dimensiones.
Definition: Pos3d.h:44
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:51
virtual void set_index(const size_t &i)
Assigns the objects index for its use in VTK arrays (see numerate in Set).
Definition: EntMdlr.cc:96
void BorraPtrNodElem(void)
Clears pointer to nodes and elements.
Definition: EntMdlr.cc:152
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
std::deque< const Node * > getNodePtrs(void) const
Returns the pointers to the nodes of this array.
Definition: EntMdlr.cc:186
Rangos de variación de tres índices, se emplea en BoxConstRef.
Definition: Array3dRange.h:32
Element * getNearestElement(const Pos3d &p)
Return the element closest to the point being passed as parameter.
Definition: EntMdlr.cc:239
virtual double getDistanceTo(const Pos3d &pt) const
Return the distance to the position being passed as parameter.
Definition: EntMdlr.cc:569
Mesh node.
Definition: Node.h:111
void clearAll(void)
Clears object contents.
Definition: EntMdlr.cc:145
size_t getIdx(void) const
Returns the index of the object for it use in VTK arrays.
Definition: EntMdlr.h:176
void fix(const SFreedom_Constraint &)
Fixes the nodes of the set.
Definition: EntMdlr.cc:573
Rango de variación de un índice, se emplea en BoxConstRef.
Definition: RangoIndice.h:30
SetEstruct * create_row_set(const Array3dRange &, const std::string &)
Creates a set that corresponds to a row of nodes and elements.
Definition: EntMdlr.cc:297
void setGenMesh(bool m)
Returns true if the points begins or ends in the line.
Definition: EntMdlr.cc:481
virtual double getSquaredDistanceTo(const Pos3d &pt) const
Return the squared distance to the position being passed as parameter.
Definition: EntMdlr.cc:560
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43