xc
EntMdlr.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 //EntMdlr.h
28 //Multiblock topology entity.
29 
30 #ifndef ENTMDLR_H
31 #define ENTMDLR_H
32 
33 #include "preprocessor/set_mgmt/SetEstruct.h"
34 #include "preprocessor/multi_block_topology/matrices/NodePtrArray3d.h"
35 #include "preprocessor/multi_block_topology/matrices/ElemPtrArray3d.h"
36 #include "preprocessor/MeshingParams.h"
37 
38 class BND3d;
39 class Pos3d;
40 class Pos3dArray;
41 class Pos3dArray3d;
42 class RangoIndice;
43 class Array3dRange;
44 class GeomObj3d;
45 
46 namespace XC {
47 class IRowSet;
48 class JRowSet;
49 class KRowSet;
50 
54 class EntMdlr: public SetEstruct
55  {
56  private:
57  size_t idx;
58  bool doGenMesh;
59  protected:
60  NodePtrArray3d ttzNodes;
61  ElemPtrArray3d ttzElements;
62  friend class Set;
63  friend class SetMeshComp;
64  friend class MultiBlockTopology;
65  virtual void update_topology(void)= 0;
66  void create_nodes(const Pos3dArray3d &);
67  Node *create_node(const Pos3d &pos,size_t i=1,size_t j=1, size_t k=1);
68  bool create_elements(meshing_dir dm);
69  Pnt *create_point(const Pos3d &);
70  void create_points(const Pos3dArray &);
71  SetEstruct *create_row_set(const Array3dRange &,const std::string &);
72 
73  void clearAll(void);
74  public:
75  EntMdlr(Preprocessor *m,const size_t &i= 0);
76  EntMdlr(const std::string &nombre= "",const size_t &i= 0,Preprocessor *m= nullptr);
77  EntMdlr(const EntMdlr &);
78  EntMdlr &operator=(const EntMdlr &);
79 
80  virtual void set_index(const size_t &i);
82  inline size_t getIdx(void) const
83  { return idx; }
84 
85  virtual bool In(const GeomObj3d &, const double &tol= 0.0) const;
86  virtual bool Out(const GeomObj3d &, const double &tol= 0.0) const;
87 
88  inline bool hasNodes(void) const
89  { return !ttzNodes.empty(); }
90  virtual size_t getNumNodeLayers(void) const
91  { return ttzNodes.getNumberOfLayers(); }
92  virtual size_t getNumNodeRows(void) const
93  { return ttzNodes.getNumberOfRows(); }
94  virtual size_t getNumNodeColumns(void) const
95  { return ttzNodes.getNumberOfColumns(); }
96  virtual size_t getNumElementLayers(void) const
97  { return ttzElements.getNumberOfLayers(); }
98  virtual size_t getNumElementRows(void) const
99  { return ttzElements.getNumberOfRows(); }
100  virtual size_t getNumElementColumns(void) const
101  { return ttzElements.getNumberOfColumns(); }
102 
103  virtual Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1);
104  virtual const Node *getNode(const size_t &i=1,const size_t &j=1,const size_t &k=1) const;
105  Node *getNearestNode(const Pos3d &p);
106  const Node *getNearestNode(const Pos3d &p) const;
107  ID getNodeIndices(const Node *) const;
108  virtual Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1);
109  virtual const Element *getElement(const size_t &i=1,const size_t &j=1,const size_t &k=1) const;
110  Node *findNode(const int &tag);
111  const Node *findNode(const int &tag) const;
112 
113  Element *findElement(const int &);
114  const Element *findElement(const int &) const;
115  Element *getNearestElement(const Pos3d &p);
116  const Element *getNearestElement(const Pos3d &p) const;
117 
118  NodePtrArray3d &getTtzNodes(void)
119  { return ttzNodes; }
120  const NodePtrArray3d &getTtzNodes(void) const
121  { return ttzNodes; }
122  ElemPtrArray3d &getTtzElements(void)
123  { return ttzElements; }
124  const ElemPtrArray3d &getTtzElements(void) const
125  { return ttzElements; }
127  virtual unsigned short int GetDimension(void) const= 0;
128  virtual BND3d Bnd(void) const= 0;
129 
130  IRowSet getVarRefIRow(size_t f=1,size_t c=1,const std::string &nmb="tmp");
131  IRowSet getVarRefIRow(const RangoIndice &layer_range,size_t f,size_t c,const std::string &nmb="tmp");
132  IRowSet getVarRefIRow(const Array3dRange &rango,const std::string &nmb="tmp");
133 
134  JRowSet getVarRefJRow(size_t layer=1,size_t c=1,const std::string &nmb="tmp");
135  JRowSet getVarRefJRow(size_t layer,const RangoIndice &row_range,size_t c,const std::string &nmb="tmp");
136  JRowSet getVarRefJRow(const Array3dRange &rango,const std::string &nmb="tmp");
137 
138  KRowSet getVarRefKRow(size_t layer=1,size_t f=1,const std::string &nmb="tmp");
139  KRowSet getVarRefKRow(size_t layer,size_t f,const RangoIndice &column_range,const std::string &nmb="tmp");
140  KRowSet getVarRefKRow(const Array3dRange &rango,const std::string &nmb="tmp");
141 
142  void fix(const SFreedom_Constraint &);
143 
144  virtual int getVtkCellType(void) const;
145 
146  void setGenMesh(bool m);
147  const bool &getGenMesh(void) const;
148 
149  virtual std::set<SetBase *> get_sets(void) const= 0;
150 
151  virtual double getSquaredDistanceTo(const Pos3d &pt) const;
152  virtual double getDistanceTo(const Pos3d &pt) const;
153 
154  Vector getSimpsonWeights(const std::string &,const std::string &,const size_t &f=1,const size_t &c=1, const size_t &n= 10) const;
155 
156  void BorraPtrNodElem(void);
157 
158  virtual Pos3d getCentroid(void) const;
159 
160  virtual ~EntMdlr(void);
161  };
162 
163 } //end of XC namespace
164 
165 #endif
void create_points(const Pos3dArray &)
Creates points at the positions being passed as parameters.
Definition: EntMdlr.cc:371
Float vector abstraction.
Definition: Vector.h:93
bool create_elements(meshing_dir dm)
Creates elements on the nodes created in create_nodes.
Definition: EntMdlr.cc:311
Set of objects in a row.
Definition: KRowSet.h:50
virtual bool Out(const GeomObj3d &, const double &tol=0.0) const
Returns true if the object lies outside the geometric object.
Definition: EntMdlr.cc:105
virtual ~EntMdlr(void)
Destructor.
Definition: EntMdlr.cc:443
virtual bool In(const GeomObj3d &, const double &tol=0.0) const
Returns true if the object lies inside the geometric object.
Definition: EntMdlr.cc:92
Finite element model generation tools.
Definition: Preprocessor.h:58
virtual Pos3d getCentroid(void) const
Return the centroid of the object.
Definition: EntMdlr.cc:435
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:133
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:274
const bool & getGenMesh(void) const
Returns true if the points begins or ends in the line.
Definition: EntMdlr.cc:363
EntMdlr & operator=(const EntMdlr &)
Assignment operator.
Definition: EntMdlr.cc:63
Vector of integers.
Definition: ID.h:93
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:367
Three-dimensional array of pointers to elements.
Definition: ElemPtrArray3d.h:43
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 paremeters.
Definition: EntMdlr.cc:176
void create_nodes(const Pos3dArray3d &)
Creates nodes at the positions being passed as parameters.
Definition: EntMdlr.cc:282
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:260
Base class for the finite elements.
Definition: Element.h:109
Set of objecst in a row.
Definition: IRowSet.h:50
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:58
Node * findNode(const int &tag)
Returns a pointer to the node cuyo identifier is being passed as parameter.
Definition: EntMdlr.cc:209
Element * findElement(const int &)
Returns a pointer to the element identified by the tag being passed as parameter. ...
Definition: EntMdlr.cc:218
virtual int getVtkCellType(void) const
Interfaz con VTK.
Definition: EntMdlr.cc:79
Node * getNearestNode(const Pos3d &p)
Return the node closest to the point being passed as parameter.
Definition: EntMdlr.cc:156
Single freedom constraint.
Definition: SFreedom_Constraint.h:84
Object set.
Definition: Set.h:56
EntMdlr(Preprocessor *m, const size_t &i=0)
Constructor.
Definition: EntMdlr.cc:47
ID getNodeIndices(const Node *) const
Return the indexes of the node being passed as parameter.
Definition: EntMdlr.cc:167
Objects in a row.
Definition: JRowSet.h:50
Point (KPoint).
Definition: Pnt.h:49
Multiblock topology object (point, line, face, block,...).
Definition: EntMdlr.h:54
structured set, i.
Definition: SetEstruct.h:45
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:50
virtual void set_index(const size_t &i)
Assigns the objects index for its use in VTK arrays(see numera in Set).
Definition: EntMdlr.cc:75
void BorraPtrNodElem(void)
Clears pointer to nodes and elements.
Definition: EntMdlr.cc:121
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Element * getNearestElement(const Pos3d &p)
Return the element closest to the point being passed as parameter.
Definition: EntMdlr.cc:198
virtual double getDistanceTo(const Pos3d &pt) const
Return the distance to the position being passed as parameter.
Definition: EntMdlr.cc:426
Mesh node.
Definition: Node.h:110
void clearAll(void)
Clears object contents.
Definition: EntMdlr.cc:114
size_t getIdx(void) const
Returns the index of the object for it use in VTK arrays.
Definition: EntMdlr.h:82
void fix(const SFreedom_Constraint &)
Fixes the nodes of the set.
Definition: EntMdlr.cc:430
SetEstruct * create_row_set(const Array3dRange &, const std::string &)
Creates a set that corresponds to a row of nodes and elements.
Definition: EntMdlr.cc:227
void setGenMesh(bool m)
Returns true if the points begins or ends in the line.
Definition: EntMdlr.cc:359
virtual double getSquaredDistanceTo(const Pos3d &pt) const
Return the squared distance to the position being passed as parameter.
Definition: EntMdlr.cc:418