XC Open source finite element analysis program
SetMeshComp.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 // You should have received a copy of the GNU General Public License
23 // along with this program.
24 // If not, see <http://www.gnu.org/licenses/>.
25 //----------------------------------------------------------------------------
26 //SetMeshComp.h
27 
28 #ifndef SETMESHCOMP_H
29 #define SETMESHCOMP_H
30 
31 #include "SetBase.h"
32 #include "DqPtrs.h"
33 #include "DqPtrsNode.h"
34 #include "DqPtrsElem.h"
35 #include "DqPtrsConstraint.h"
36 #include <set>
37 
38 class Pos3d;
39 class SVD3d;
40 class Plano3d;
41 
42 namespace XC {
43 class TrfGeom;
44 class SFreedom_Constraint;
45 class ID;
46 class Element;
47 class Node;
48 class Constraint;
49 
58 class SetMeshComp: public SetBase
59  {
60  protected:
61  template <class L>
62  static void numera_lista(L &l);
63  void numera(void);
64  public:
65  //Nodes.
66  typedef DqPtrsNode::iterator nod_iterator;
67  typedef DqPtrsNode::const_iterator nod_const_iterator;
68 
69  //Elements.
70  typedef DqPtrsElem::iterator elem_iterator;
71  typedef DqPtrsElem::const_iterator elem_const_iterator;
72 
73  //Constraints.
75  typedef DqPtrsConstraint::iterator constraint_iterator;
76  typedef DqPtrsConstraint::const_iterator constraint_const_iterator;
77 
78  private:
79  DqPtrsNode nodes;
80  DqPtrsElem elements;
81  lst_ptr_constraints constraints;
82  protected:
83  void clearAll(void);
84  void copia_listas(const SetMeshComp &);
85  void extend_lists(const SetMeshComp &);
86  void extend_lists_cond(const SetMeshComp &,const std::string &);
87 
88  DbTagData &getDbTagData(void) const;
89  int sendData(CommParameters &);
90  int recvData(const CommParameters &);
91 
92 
93  void calc_resisting_force(void);
94 
95  void mueve(const Vector3d &);
96  public:
97  SetMeshComp(const std::string &nmb="",Preprocessor *preprocessor= nullptr);
98  SetMeshComp(const SetMeshComp &otro);
99  SetMeshComp &operator=(const SetMeshComp &otro);
100 
102  size_t getNumberOfNodes(void) const
103  { return nodes.size(); }
105  void addNode(Node *nPtr);
107  virtual const DqPtrsNode &GetNodos(void) const
108  { return nodes; }
110  virtual DqPtrsNode &GetNodos(void)
111  { return nodes; }
113  void clearNodos(void)
114  { nodes.clearAll(); }
115  void sel_nodes_from_list(const ID &);
116  bool In(const Node *) const;
117 
119  size_t getNumberOfElements(void) const
120  { return elements.size(); }
122  void addElement(Element *ePtr);
124  virtual const DqPtrsElem &getElements(void) const
125  { return elements; }
127  virtual DqPtrsElem &getElements(void)
128  { return elements; }
130  void clearElements(void)
131  { elements.clearAll(); }
132  void sel_elements_from_list(const ID &tags);
133  bool In(const Element *) const;
134 
136  virtual const DqPtrsConstraint &GetConstraints(void) const
137  { return constraints; }
140  { return constraints; }
142  void clearConstraints(void)
143  { constraints.clearAll(); }
144  void sel_constraints_from_list(const ID &tags);
145 
146  void appendFromGeomEntity(const SetBase &);
147 
148  void clear(void);
149 
150  void fix(const SFreedom_Constraint &);
151 
152  //nod_iterator nodos_begin(void);
153  nod_const_iterator nodos_begin(void) const;
154  //nod_iterator nodos_end(void);
155  nod_const_iterator nodos_end(void) const;
156  Node *buscaNodo(const int &tag);
157  const Node *buscaNodo(const int &tag) const;
158  bool InNodeTag(const int) const;
159  bool InNodeTags(const ID &) const;
160  std::set<int> getNodeTags(void) const;
161  std::set<int> getElementTags(void) const;
162  std::set<int> getConstraintTags(void) const;
163  Node *getNearestNode(const Pos3d &p);
164  const Node *getNearestNode(const Pos3d &p) const;
165 
166 
167  elem_iterator elem_begin(void);
168  elem_const_iterator elem_begin(void) const;
169  elem_iterator elem_end(void);
170  elem_const_iterator elem_end(void) const;
171  Element *findElement(const int &);
172  const Element *findElement(const int &) const;
173  Element *getNearestElement(const Pos3d &);
174  const Element *getNearestElement(const Pos3d &) const;
175 
176  void kill_elements(void);
177  void alive_elements(void);
178  size_t getNumDeadElements(void) const;
179  size_t getNumLiveElements(void) const;
180  size_t getNumDeadNodes(void) const;
181  size_t getNumLiveNodes(void) const;
182 
183  constraint_iterator constraints_begin(void);
184  constraint_const_iterator constraints_begin(void) const;
185  constraint_iterator constraints_end(void);
186  constraint_const_iterator constraints_end(void) const;
187  Constraint *buscaConstraint(const int &tag);
188  const Constraint *buscaConstraint(const int &tag) const;
189 
190  void CompletaHaciaArriba(void);
191  void CompletaHaciaAbajo(void);
192 
193  virtual void Transforma(const TrfGeom &trf);
194  virtual void Transforma(const size_t &indice_trf);
195 
196  SVD3d getResistingSVD3d(const Plano3d &,const Pos3d &,const double &,const bool &) const;
197 
198  virtual int sendSelf(CommParameters &);
199  virtual int recvSelf(const CommParameters &);
200 
201 
202  ~SetMeshComp(void);
203  };
204 
206 template <class L>
208  {
209  size_t idx= 0;
210  typedef typename L::iterator iterator;
211  typedef typename L::reference reference;
212  for(iterator i= l.begin();i!=l.end();i++,idx++)
213  {
214  reference ptr= *i;
215  ptr->set_indice(idx);
216  }
217  }
218 
219 } //end of XC namespace
220 #endif
virtual DqPtrsConstraint & GetConstraints(void)
Return the constraints container.
Definition: SetMeshComp.h:139
size_t getNumLiveNodes(void) const
Returns the número de active nodes.
Definition: SetMeshComp.cc:290
DqPtrsElem::const_iterator elem_const_iterator
Iterator over the element set.
Definition: SetMeshComp.h:71
void clear(void)
Clears all the objectsof the lists.
Definition: SetMeshComp.cc:111
void clearAll(void)
Clears out the list of pointers and erases the properties of the object (if any). ...
Definition: DqPtrsElem.cc:100
void clearElements(void)
Clears out the elements.
Definition: SetMeshComp.h:130
DqPtrsNode::iterator nod_iterator
Iterator over the node set.
Definition: SetMeshComp.h:66
void clearAll(void)
Clears all objects from the set.
Definition: SetMeshComp.cc:120
std::set< int > getConstraintTags(void) const
Returns the tags de los constraints.
Definition: SetMeshComp.cc:395
Node * getNearestNode(const Pos3d &p)
Returns the node closest to the point being passed as parameter.
Definition: SetMeshComp.cc:368
constraint_iterator constraints_end(void)
Returns an iterator apuntando tras el final de la lista de constraints.
Definition: SetMeshComp.cc:223
bool InNodeTag(const int) const
Returns true if the node with the tag being passed as parameter, belongs to the set.
Definition: SetMeshComp.cc:355
Vector que almacena los dbTags de los miembros de la clase.
Definition: DbTagData.h:43
virtual int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: SetMeshComp.cc:537
void kill_elements(void)
Deactivates the elements.
Definition: SetMeshComp.cc:299
void CompletaHaciaArriba(void)
Appends to this set the objects that make reference to one or more of the objects that already are in...
Definition: SetMeshComp.cc:421
virtual DqPtrsElem & getElements(void)
Returns the elements container.
Definition: SetMeshComp.h:127
Constraint * buscaConstraint(const int &tag)
Returns, if it exists, a pointer to the constraint which tag is being passed as parameter.
Definition: SetMeshComp.cc:241
SVD3d getResistingSVD3d(const Plano3d &, const Pos3d &, const double &, const bool &) const
Return the resultant of the forces over the nodes near to the plane, of the elements behind the plane...
Definition: SetMeshComp.cc:312
void sel_nodes_from_list(const ID &)
Select the nodes identified by the tags being passed as parameters.
Definition: SetMeshComp.cc:428
Node * buscaNodo(const int &tag)
Returns (if it exists) a pointer to the node cuyo tag is being passed as parameter.
Definition: SetMeshComp.cc:195
size_t getNumberOfNodes(void) const
Returns the number of nodes.
Definition: SetMeshComp.h:102
Base class for model constraints.
Definition: Constraint.h:49
size_t getNumDeadElements(void) const
Returns the number of inactive elements.
Definition: SetMeshComp.cc:286
Mesh node.
Definition: Node.h:99
virtual const DqPtrsElem & getElements(void) const
Returns the element container.
Definition: SetMeshComp.h:124
void clearConstraints(void)
Clears out the constraints.
Definition: SetMeshComp.h:142
DqPtrsConstraint::iterator constraint_iterator
Iterator over the set de constraints.
Definition: SetMeshComp.h:75
std::set< int > getElementTags(void) const
Returns the tags de los elements.
Definition: SetMeshComp.cc:380
DqPtrsNode::const_iterator nod_const_iterator
Iterator over the node set.
Definition: SetMeshComp.h:67
void alive_elements(void)
Reactivates the elements.
Definition: SetMeshComp.cc:303
void extend_lists(const SetMeshComp &)
Appends to this set the objects from the set being passed as parameter.
Definition: SetMeshComp.cc:80
size_t getNumDeadNodes(void) const
Returns the number of inactive nodes.
Definition: SetMeshComp.cc:295
SetMeshComp(const std::string &nmb="", Preprocessor *preprocessor=nullptr)
Constructor.
Definition: SetMeshComp.cc:51
Base calass for the finite elements.
Definition: Element.h:104
bool InNodeTags(const ID &) const
Returns true if the nodes, with the tags being passed as parameter, belongs to the set...
Definition: SetMeshComp.cc:360
Finite element model generation tools.
Definition: Preprocessor.h:58
~SetMeshComp(void)
Destructor.
Definition: SetMeshComp.cc:519
DqPtrsConstraint::const_iterator constraint_const_iterator
Iterator over the set de constraints.
Definition: SetMeshComp.h:76
Definition: ID.h:77
Element * findElement(const int &)
Returns (if it exists) a pointer to the node identified by the tag being passed as parameter...
Definition: SetMeshComp.cc:231
Constraint pointers deque.
Definition: DqPtrsConstraint.h:45
void sel_constraints_from_list(const ID &tags)
Selecciona las coacciones cuyos tags being passed as parameters.
Definition: SetMeshComp.cc:460
SetMeshComp & operator=(const SetMeshComp &otro)
Assignment operator.
Definition: SetMeshComp.cc:60
virtual const DqPtrsConstraint & GetConstraints(void) const
Return the constraints container.
Definition: SetMeshComp.h:136
Definition: TrfGeom.h:49
virtual const DqPtrsNode & GetNodos(void) const
Return the node container.
Definition: SetMeshComp.h:107
void addElement(Element *ePtr)
Adds an element.
Definition: SetMeshComp.cc:133
Pointer to element container.
Definition: DqPtrsElem.h:45
bool In(const Node *) const
Returns true if the node belongs to the set.
Definition: SetMeshComp.cc:137
void clearAll(void)
Clears out the list of pointers and erases the properties of the object (if any). ...
Definition: DqPtrs.h:163
void appendFromGeomEntity(const SetBase &)
Appends to this set the objects the nodes and elements from the set being passed as parameter...
Definition: SetMeshComp.cc:89
void calc_resisting_force(void)
Calcula los esfuerzos en cada uno de los elements.
Definition: SetMeshComp.cc:307
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:58
void sel_elements_from_list(const ID &tags)
Selects the elements identified by the tags being passed as parameters.
Definition: SetMeshComp.cc:444
Contenedor de pointers to nodes.
Definition: DqPtrsNode.h:47
void fix(const SFreedom_Constraint &)
Applies the single freedom constraint being passed as parameter to the nodes.
Definition: SetMeshComp.cc:170
void numera(void)
Assigns index to each object in the set (nodes,elements,points...) to be able to use them in VTK...
Definition: SetMeshComp.cc:146
size_t getNumLiveElements(void) const
Returns the number of active elements.
Definition: SetMeshComp.cc:282
void mueve(const Vector3d &)
Moves the nodes.
Definition: SetMeshComp.cc:154
constraint_iterator constraints_begin(void)
Returns an iterator which points to principio de la lista de constraints.
Definition: SetMeshComp.cc:217
void clearNodos(void)
Clears out the nodes.
Definition: SetMeshComp.h:113
nod_const_iterator nodos_end(void) const
Returns an iterator that points to the past-the-end item in the node container.
Definition: SetMeshComp.cc:190
DbTagData & getDbTagData(void) const
Returns a vector para almacenar los dbTags de los miembros de la clase.
Definition: SetMeshComp.cc:488
virtual int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: SetMeshComp.cc:523
nod_const_iterator nodos_begin(void) const
Returns an iterator that points to the first item of the node container.
Definition: SetMeshComp.cc:184
Single freedom constraint.
Definition: SFreedom_Constraint.h:79
int recvData(const CommParameters &)
Receives members through the channel being passed as parameter.
Definition: SetMeshComp.cc:505
void CompletaHaciaAbajo(void)
Appends to the set being passed as parameter the nodes that touch any of the elements of the set...
Definition: SetMeshComp.cc:406
Communication parameters between processes.
Definition: CommParameters.h:65
DqPtrsElem::iterator elem_iterator
Iterator over the element set.
Definition: SetMeshComp.h:70
int sendData(CommParameters &)
Send members through the channel being passed as parameter.
Definition: SetMeshComp.cc:495
================================================================================
Definition: ContinuaReprComponent.h:34
virtual void Transforma(const TrfGeom &trf)
Aplies the transformation to the positions of the nodes.
Definition: SetMeshComp.cc:158
void copia_listas(const SetMeshComp &)
Copy (into this set) the lists from the set being passed as parameter.
Definition: SetMeshComp.cc:68
virtual DqPtrsNode & GetNodos(void)
Return the nodes container.
Definition: SetMeshComp.h:110
static void numera_lista(L &l)
Set indices to the object to allow its use in VTK.
Definition: SetMeshComp.h:207
void clearAll(void)
Clears out the list of pointers and erases the properties of the object (if any). ...
Definition: DqPtrsNode.cc:98
void addNode(Node *nPtr)
Appends a node.
Definition: SetMeshComp.cc:129
std::set< int > getNodeTags(void) const
Returns node tags.
Definition: SetMeshComp.cc:364
Element * getNearestElement(const Pos3d &)
Returns the element closest to the point being passed as parameter.
Definition: SetMeshComp.cc:384
size_t getNumberOfElements(void) const
Returns the number of elements.
Definition: SetMeshComp.h:119
Base de las clases Set y SetEstruct.
Definition: SetBase.h:50
DqPtrsConstraint lst_ptr_constraints
Set of constraints.
Definition: SetMeshComp.h:74