xc
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 SlidingVectorsSystem3d;
40 class Plane;
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  void extend_lists(const SetMeshComp &);
83  void substract_lists(const SetMeshComp &);
84  void intersect_lists(const SetMeshComp &);
85  void copy_lists(const SetMeshComp &);
86 
87  protected:
88  void clearAll(void);
89 
90  DbTagData &getDbTagData(void) const;
91  int sendData(CommParameters &);
92  int recvData(const CommParameters &);
93 
94 
95  void calc_resisting_force(void);
96 
97  void mueve(const Vector3d &);
98  public:
99  SetMeshComp(const std::string &nmb="",Preprocessor *preprocessor= nullptr);
100  SetMeshComp(const SetMeshComp &);
105 
107  size_t getNumberOfNodes(void) const
108  { return nodes.size(); }
110  void addNode(Node *nPtr);
112  virtual const DqPtrsNode &getNodes(void) const
113  { return nodes; }
115  virtual DqPtrsNode &getNodes(void)
116  { return nodes; }
118  void setNodes(const DqPtrsNode &nds)
119  { nodes= nds; }
121  void clearNodes(void)
122  { nodes.clearAll(); }
123  void sel_nodes_from_list(const ID &);
124  bool In(const Node *) const;
125  SetMeshComp pickNodesInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
126  BND3d Bnd(const double &) const;
127 
129  size_t getNumberOfElements(void) const
130  { return elements.size(); }
132  void addElement(Element *ePtr);
134  virtual const DqPtrsElem &getElements(void) const
135  { return elements; }
137  virtual DqPtrsElem &getElements(void)
138  { return elements; }
140  void setElements(const DqPtrsElem &els)
141  { elements= els; }
143  void clearElements(void)
144  { elements.clearAll(); }
145  void sel_elements_from_list(const ID &tags);
146  bool In(const Element *) const;
147  SetMeshComp pickElemsInside(const std::string &, const GeomObj3d &, const double &tol= 0.0);
148  SetMeshComp pickElemsOfType(const std::string &, const std::string &);
149  SetMeshComp pickElemsOfDimension(const std::string &, const size_t &);
150  inline boost::python::list getElementTypesPy(void) const
151  { return elements.getTypesPy(); }
152  inline boost::python::list getElementDimensionsPy(void) const
153  { return elements.getDimensionsPy(); }
154  inline boost::python::list getElementMaterialNamesPy(void) const
155  { return elements.getMaterialNamesPy(); }
156  SetMeshComp pickElemsOfMaterial(const std::string &, const std::string &);
157 
159  virtual const DqPtrsConstraint &GetConstraints(void) const
160  { return constraints; }
163  { return constraints; }
166  { constraints= cts; }
168  void clearConstraints(void)
169  { constraints.clearAll(); }
170  void sel_constraints_from_list(const ID &tags);
171 
172  void appendFromGeomEntity(const SetBase &);
173 
174  void clear(void);
175 
176  void fix(const SFreedom_Constraint &);
177 
178  //nod_iterator nodes_begin(void);
179  nod_const_iterator nodes_begin(void) const;
180  //nod_iterator nodes_end(void);
181  nod_const_iterator nodes_end(void) const;
182  Node *findNode(const int &tag);
183  const Node *findNode(const int &tag) const;
184  bool InNodeTag(const int) const;
185  bool InNodeTags(const ID &) const;
186  std::set<int> getNodeTags(void) const;
187  std::set<int> getElementTags(void) const;
188  std::set<int> getConstraintTags(void) const;
189  Node *getNearestNode(const Pos3d &p);
190  const Node *getNearestNode(const Pos3d &p) const;
191 
192 
193  elem_iterator elem_begin(void);
194  elem_const_iterator elem_begin(void) const;
195  elem_iterator elem_end(void);
196  elem_const_iterator elem_end(void) const;
197  Element *findElement(const int &);
198  const Element *findElement(const int &) const;
199  Element *getNearestElement(const Pos3d &);
200  const Element *getNearestElement(const Pos3d &) const;
201 
202  void kill_elements(void);
203  void alive_elements(void);
204  size_t getNumDeadElements(void) const;
205  size_t getNumLiveElements(void) const;
206  size_t getNumDeadNodes(void) const;
207  size_t getNumLiveNodes(void) const;
208 
209  constraint_iterator constraints_begin(void);
210  constraint_const_iterator constraints_begin(void) const;
211  constraint_iterator constraints_end(void);
212  constraint_const_iterator constraints_end(void) const;
213  Constraint *buscaConstraint(const int &tag);
214  const Constraint *buscaConstraint(const int &tag) const;
215 
216  void fillUpwards(void);
217  void fillDownwards(void);
218 
219  virtual void Transforma(const TrfGeom &trf);
220  virtual void Transforma(const size_t &indice_trf);
221 
222  SlidingVectorsSystem3d getResistingSlidingVectorsSystem3d(const Plane &,const Pos3d &,const double &,const bool &) const;
223 
224  virtual int sendSelf(CommParameters &);
225  virtual int recvSelf(const CommParameters &);
226 
227 
228  ~SetMeshComp(void);
229  };
230 
234 
236 template <class L>
238  {
239  size_t idx= 0;
240  typedef typename L::iterator iterator;
241  typedef typename L::reference reference;
242  for(iterator i= l.begin();i!=l.end();i++,idx++)
243  {
244  reference ptr= *i;
245  ptr->set_index(idx);
246  }
247  }
248 
249 } //end of XC namespace
250 #endif
Element * findElement(const int &)
Returns (if it exists) a pointer to the node identified by the tag being passed as parameter...
Definition: SetMeshComp.cc:264
Node * getNearestNode(const Pos3d &p)
Returns the node closest to the point being passed as parameter.
Definition: SetMeshComp.cc:401
void alive_elements(void)
Reactivates the elements.
Definition: SetMeshComp.cc:336
Pointers to node container.
Definition: DqPtrsNode.h:49
Element * getNearestElement(const Pos3d &)
Returns the element closest to the point being passed as parameter.
Definition: SetMeshComp.cc:417
SetMeshComp & operator*=(const SetMeshComp &)
*= operator (intersection).
Definition: SetMeshComp.cc:85
~SetMeshComp(void)
Destructor.
Definition: SetMeshComp.cc:631
void kill_elements(void)
Deactivates the elements.
Definition: SetMeshComp.cc:332
FiberSet operator*(const FiberSet &, const FiberSet &)
Return the fibers in a that are also in b.
Definition: FiberSet.cc:87
virtual const DqPtrsConstraint & GetConstraints(void) const
Return the constraints container.
Definition: SetMeshComp.h:159
void mueve(const Vector3d &)
Moves the nodes.
Definition: SetMeshComp.cc:187
SetMeshComp pickElemsInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the elements that lie insiof the geometric object. ...
Definition: SetMeshComp.cc:526
Finite element model generation tools.
Definition: Preprocessor.h:58
constraint_iterator constraints_begin(void)
Returns an iterator which points to principio de la lista de constraints.
Definition: SetMeshComp.cc:250
void clearNodes(void)
Clears out the nodes.
Definition: SetMeshComp.h:121
boost::python::list getDimensionsPy(void) const
Return the dimensions of the elements.
Definition: DqPtrsElem.cc:329
void setElements(const DqPtrsElem &els)
Sets the elements.
Definition: SetMeshComp.h:140
BND3d Bnd(const double &) const
Return the nodes current position boundary.
Definition: SetMeshComp.cc:493
size_t getNumLiveElements(void) const
Returns the number of active elements.
Definition: SetMeshComp.cc:315
int sendData(CommParameters &)
Send members through the channel being passed as parameter.
Definition: SetMeshComp.cc:607
SetMeshComp pickElemsOfMaterial(const std::string &, const std::string &)
Return a new set that contains the elements who have the material being passed as parameter...
Definition: SetMeshComp.cc:562
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:43
SetMeshComp pickElemsOfType(const std::string &, const std::string &)
Return a new set that contains the elements that match the type.
Definition: SetMeshComp.cc:538
void clearAll(void)
Clears out the list of pointers and erases the properties of the object (if any). ...
Definition: DqPtrsKDTree.h:163
void fix(const SFreedom_Constraint &)
Applies the single freedom constraint being passed as parameter to the nodes.
Definition: SetMeshComp.cc:203
static void numera_lista(L &l)
Set indices to the object to allow its use in VTK.
Definition: SetMeshComp.h:237
Vector of integers.
Definition: ID.h:93
Base de las clases Set y SetEstruct.
Definition: SetBase.h:49
Base class for the finite elements.
Definition: Element.h:109
FiberSet operator+(const FiberSet &, const FiberSet &)
Return the union of both containers.
Definition: FiberSet.cc:65
size_t getNumDeadNodes(void) const
Returns the number of inactive nodes.
Definition: SetMeshComp.cc:328
Set of mesh components (nodes, elements and constraints).
Definition: SetMeshComp.h:58
SetMeshComp pickNodesInside(const std::string &, const GeomObj3d &, const double &tol=0.0)
Return a new set that contains the nodes that lie insiof the geometric object.
Definition: SetMeshComp.cc:482
DqPtrsConstraint::const_iterator constraint_const_iterator
Iterator over the set de constraints.
Definition: SetMeshComp.h:76
DqPtrsElem::const_iterator elem_const_iterator
Iterator over the element set.
Definition: SetMeshComp.h:71
void appendFromGeomEntity(const SetBase &)
Appends to this set the objects the nodes and elements from the set being passed as parameter...
Definition: SetMeshComp.cc:131
Constraint * buscaConstraint(const int &tag)
Returns, if it exists, a pointer to the constraint which tag is being passed as parameter.
Definition: SetMeshComp.cc:274
bool In(const Node *) const
Returns true if the node belongs to the set.
Definition: SetMeshComp.cc:170
void clearAll(void)
Clears all objects from the set.
Definition: SetMeshComp.cc:153
bool InNodeTag(const int) const
Returns true if the node with the tag being passed as parameter, belongs to the set.
Definition: SetMeshComp.cc:388
nod_const_iterator nodes_begin(void) const
Returns an iterator that points to the first item of the node container.
Definition: SetMeshComp.cc:217
void sel_nodes_from_list(const ID &)
Select the nodes identified by the tags being passed as parameters.
Definition: SetMeshComp.cc:461
bool InNodeTags(const ID &) const
Returns true if the nodes, with the tags being passed as parameter, belongs to the set...
Definition: SetMeshComp.cc:393
virtual const DqPtrsElem & getElements(void) const
Returns the element container.
Definition: SetMeshComp.h:134
virtual const DqPtrsNode & getNodes(void) const
Return the node container.
Definition: SetMeshComp.h:112
Single freedom constraint.
Definition: SFreedom_Constraint.h:84
constraint_iterator constraints_end(void)
Returns an iterator apuntando tras el final de la lista de constraints.
Definition: SetMeshComp.cc:256
void fillUpwards(void)
Appends to this set the objects that make reference to one or more of the objects that already are in...
Definition: SetMeshComp.cc:454
SetMeshComp pickElemsOfDimension(const std::string &, const size_t &)
Return a new set that contains the elements of the specified dimension.
Definition: SetMeshComp.cc:550
DqPtrsNode::iterator nod_iterator
Iterator over the node set.
Definition: SetMeshComp.h:66
virtual int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: SetMeshComp.cc:635
void setNodes(const DqPtrsNode &nds)
Sets the nodes.
Definition: SetMeshComp.h:118
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of the class members.
Definition: SetMeshComp.cc:600
void clearElements(void)
Clears out the elements.
Definition: SetMeshComp.h:143
std::set< int > getNodeTags(void) const
Returns node tags.
Definition: SetMeshComp.cc:397
nod_const_iterator nodes_end(void) const
Returns an iterator that points to the past-the-end item in the node container.
Definition: SetMeshComp.cc:223
int recvData(const CommParameters &)
Receives members through the channel being passed as parameter.
Definition: SetMeshComp.cc:617
void clearAll(void)
Clears out the list of pointers and erases the properties of the object (if any). ...
Definition: DqPtrs.h:172
void addNode(Node *nPtr)
Appends a node.
Definition: SetMeshComp.cc:162
SetMeshComp & operator-=(const SetMeshComp &)
-= operator.
Definition: SetMeshComp.cc:77
void addElement(Element *ePtr)
Adds an element.
Definition: SetMeshComp.cc:166
SetMeshComp(const std::string &nmb="", Preprocessor *preprocessor=nullptr)
Constructor.
Definition: SetMeshComp.cc:52
void fillDownwards(void)
Appends to the set being passed as parameter the nodes that touch any of the elements of the set...
Definition: SetMeshComp.cc:439
size_t getNumLiveNodes(void) const
Returns the number of active nodes.
Definition: SetMeshComp.cc:323
Geometric transformation that can be applied to the components of a set.
Definition: TrfGeom.h:49
DqPtrsConstraint lst_ptr_constraints
Set of constraints.
Definition: SetMeshComp.h:74
Node * findNode(const int &tag)
Returns (if it exists) a pointer to the node which tag is being passed as parameter.
Definition: SetMeshComp.cc:228
virtual DqPtrsElem & getElements(void)
Returns the elements container.
Definition: SetMeshComp.h:137
boost::python::list getTypesPy(void) const
Return the types (class names) of the elements.
Definition: DqPtrsElem.cc:305
boost::python::list getMaterialNamesPy(void) const
Return the names of the materials in a python list.
Definition: DqPtrsElem.cc:282
std::set< int > getElementTags(void) const
Returns the tags de los elements.
Definition: SetMeshComp.cc:413
void calc_resisting_force(void)
Calcula los esfuerzos on each uno de los elements.
Definition: SetMeshComp.cc:340
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:179
std::set< int > getConstraintTags(void) const
Returns the tags de los constraints.
Definition: SetMeshComp.cc:428
void clearConstraints(void)
Clears out the constraints.
Definition: SetMeshComp.h:168
void sel_constraints_from_list(const ID &tags)
Select the constraints identified by the tags.
Definition: SetMeshComp.cc:572
size_t getNumberOfElements(void) const
Returns the number of elements.
Definition: SetMeshComp.h:129
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
FiberSet operator-(const FiberSet &, const FiberSet &)
Return the fibers in a that are not in b.
Definition: FiberSet.cc:73
size_t getNumberOfNodes(void) const
Returns the number of nodes.
Definition: SetMeshComp.h:107
Communication parameters between processes.
Definition: CommParameters.h:65
Constraint pointers deque.
Definition: DqPtrsConstraint.h:45
void clear(void)
Clears all the objectsof the lists.
Definition: SetMeshComp.cc:144
virtual DqPtrsConstraint & GetConstraints(void)
Return the constraints container.
Definition: SetMeshComp.h:162
virtual DqPtrsNode & getNodes(void)
Return the nodes container.
Definition: SetMeshComp.h:115
Base class for model constraints.
Definition: Constraint.h:49
void sel_elements_from_list(const ID &tags)
Selects the elements identified by the tags being passed as parameters.
Definition: SetMeshComp.cc:505
SlidingVectorsSystem3d getResistingSlidingVectorsSystem3d(const Plane &, 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:345
size_t getNumDeadElements(void) const
Returns the number of inactive elements.
Definition: SetMeshComp.cc:319
Mesh node.
Definition: Node.h:110
SetMeshComp & operator=(const SetMeshComp &)
Assignment operator.
Definition: SetMeshComp.cc:61
DqPtrsConstraint::iterator constraint_iterator
Iterator over the set de constraints.
Definition: SetMeshComp.h:75
void setConstraints(const DqPtrsConstraint &cts)
Sets the constraints.
Definition: SetMeshComp.h:165
Pointer to element container.
Definition: DqPtrsElem.h:47
virtual void Transforma(const TrfGeom &trf)
Aplies the transformation to the positions of the nodes.
Definition: SetMeshComp.cc:191
SetMeshComp & operator+=(const SetMeshComp &)
+= operator.
Definition: SetMeshComp.cc:69
DqPtrsElem::iterator elem_iterator
Iterator over the element set.
Definition: SetMeshComp.h:70
virtual int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: SetMeshComp.cc:649
DqPtrsNode::const_iterator nod_const_iterator
Iterator over the node set.
Definition: SetMeshComp.h:67