XC Open source finite element analysis program
NodePtrs.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 //NodePtrs.h
28 
29 #ifndef NodePtrs_h
30 #define NodePtrs_h
31 
32 #include "xc_utils/src/nucleo/EntCmd.h"
33 #include <list>
34 
35 class Pos3d;
36 class SemiEspacio3d;
37 class Plano3d;
38 
39 namespace XC {
40 class Element;
41 class Node;
42 class Domain;
43 class ID;
44 class Matrix;
45 class Vector;
46 
48 //
50 //
52 //
54 class NodePtrs: public EntCmd
55  {
56  public:
57  typedef std::vector<Node *> vector_ptr_nodes;
58  typedef vector_ptr_nodes::const_reference const_reference;
59  typedef vector_ptr_nodes::reference reference;
60  typedef vector_ptr_nodes::iterator iterator;
61  typedef vector_ptr_nodes::const_iterator const_iterator;
62 
63  private:
64  vector_ptr_nodes theNodes;
65  protected:
66  void disconnect(void);
67  void setPtrs(Domain *theDomain, const ID &theNodeTags);
68 
69  public:
70  NodePtrs(Element *owr,const size_t &sz);
71  NodePtrs(const NodePtrs &otro);
72  NodePtrs &operator=(const NodePtrs &otro);
73  ~NodePtrs(void);
74 
75  void inic(void);
76 
77  inline size_t size(void) const
78  { return theNodes.size(); }
79  inline const_reference front() const
80  { return theNodes.front(); }
81  inline reference front()
82  { return theNodes.front(); }
83  inline const_reference back() const
84  { return theNodes.back(); }
85  inline reference back()
86  { return theNodes.back(); }
87  inline const_iterator begin() const
88  { return theNodes.begin(); }
89  inline iterator begin()
90  { return theNodes.begin(); }
91  inline const_iterator end() const
92  { return theNodes.end(); }
93  inline iterator end()
94  { return theNodes.end(); }
95  iterator find(const int &);
96  const_iterator find(const int &) const;
97  int find(const Node *) const;
98 
99  Node *getNodePtr(const size_t &);
100  const_reference operator()(const size_t &i) const;
101  const_reference operator[](const size_t &i) const;
102  void set_node(const size_t &i,Node *);
103 
104  bool hasNull(void) const;
105 
106  ID getNumDOFs(void) const;
107  int getTotalDOFs(void) const;
108  Vector getDistributionFactor(int mode) const;
109  Matrix getNodeVectors(const Vector &) const;
110  double MaxCooNod(int i) const;
111  double MinCooNod(int i) const;
112  std::vector<int> getIdx(void) const;
113  bool checkDimension(const size_t &dim) const;
114  size_t getDimension(void) const;
115  const Matrix &getCoordinates(void) const;
116  Pos3d getPosNodo(const size_t &i,bool initialGeometry= true) const;
117  std::list<Pos3d> getPosiciones(bool initialGeometry= true) const;
118  Pos3d getPosCdg(bool initialGeometry= true) const;
119  Node *getNearestNode(const Pos3d &p,bool initialGeometry= true);
120  const Node *getNearestNode(const Pos3d &p,bool initialGeometry= true) const;
121  bool In(const SemiEspacio3d &semiEsp,const double &tol= 0.0,bool initialGeometry= true) const;
122  bool Out(const SemiEspacio3d &semiEsp,const double &tol= 0.0,bool initialGeometry= true) const;
123  bool Corta(const Plano3d &,bool initialGeometry= true) const;
124 
125  void resetTributarias(void) const;
126  void vuelcaTributarias(const std::vector<double> &) const;
127 
128  const std::vector<int> &getTags(void) const;
129  int getIndiceNodo(const Node *) const;
130 
131 
132  };
133 } // end of XC namespace
134 
135 #endif
136 
int getTotalDOFs(void) const
Return the total number of DOFs.
Definition: NodePtrs.cc:227
void inic(void)
Pone a cero los pointers to node.
Definition: NodePtrs.cc:99
NodePtrs(Element *owr, const size_t &sz)
Constructor.
Definition: NodePtrs.cc:44
Node * getNodePtr(const size_t &)
Returns a pointer to the node at the position being passed as parameter.
Definition: NodePtrs.cc:181
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:98
Definition: Vector.h:82
bool Out(const SemiEspacio3d &semiEsp, const double &tol=0.0, bool initialGeometry=true) const
Returns true if the node are outside the halfspace.
Definition: NodePtrs.cc:398
Mesh node.
Definition: Node.h:99
const std::vector< int > & getTags(void) const
Returns a vector con los tags of the nodes.
Definition: NodePtrs.cc:261
Vector getDistributionFactor(int mode) const
Returns a vector that contains the distribution factors of each node for the mode being passed as par...
Definition: NodePtrs.cc:479
void setPtrs(Domain *theDomain, const ID &theNodeTags)
Sets the node pointers from the node identifiers.
Definition: NodePtrs.cc:124
bool hasNull(void) const
Returns true ifalguno de los pointers es nulo.
Definition: NodePtrs.cc:108
const_reference operator[](const size_t &i) const
Returns a const reference to the node at the position being passed as parameter.
Definition: NodePtrs.cc:191
bool Corta(const Plano3d &, bool initialGeometry=true) const
Returns true if there are nodes in both sides of the plane.
Definition: NodePtrs.cc:406
const_reference operator()(const size_t &i) const
Returns a const reference to the node at the position being passed as parameter.
Definition: NodePtrs.cc:186
~NodePtrs(void)
Destructor.
Definition: NodePtrs.cc:80
Base calass for the finite elements.
Definition: Element.h:104
Definition: ID.h:77
void set_node(const size_t &i, Node *)
Asigna the pointer to node i.
Definition: NodePtrs.cc:195
bool checkDimension(const size_t &dim) const
Checks that the dimensions of the node coordinates are all equal to the number being passed as parame...
Definition: NodePtrs.cc:283
Pointers to nodes.
Definition: NodePtrs.h:54
ID getNumDOFs(void) const
Returns a vector with the number of DOFs for each node.
Definition: NodePtrs.cc:217
void vuelcaTributarias(const std::vector< double > &) const
Adds to the la magnitud tributaria de cada node i la componente i del vector being passed as paramete...
Definition: NodePtrs.cc:469
iterator find(const int &)
Returns an iterator to the node identified by the tag being passed as parameter.
Definition: NodePtrs.cc:146
Matrix getNodeVectors(const Vector &) const
Returns the vectors correspondientes a cada node colocados por filas.
Definition: NodePtrs.cc:496
Definition: Matrix.h:82
size_t getDimension(void) const
Returns the dimension of the node coordinates.
Definition: NodePtrs.cc:311
void resetTributarias(void) const
Resets tributary areas (or lengths or volumes) of connected nodes.
Definition: NodePtrs.cc:460
double MinCooNod(int i) const
Returns the minimum value de la coordenada i of the nodes.
Definition: NodePtrs.cc:249
Node * getNearestNode(const Pos3d &p, bool initialGeometry=true)
Returns the node closest to the point being passed as parameter.
Definition: NodePtrs.cc:414
std::list< Pos3d > getPosiciones(bool initialGeometry=true) const
Returns a matriz con las posiciones of the nodes.
Definition: NodePtrs.cc:361
int getIndiceNodo(const Node *) const
Return the index of the node pointer in the array.
Definition: NodePtrs.cc:445
bool In(const SemiEspacio3d &semiEsp, const double &tol=0.0, bool initialGeometry=true) const
Returns true if the node are in the halfspace.
Definition: NodePtrs.cc:387
const Matrix & getCoordinates(void) const
Returns a matriz con las coordinates of the nodes.
Definition: NodePtrs.cc:333
================================================================================
Definition: ContinuaReprComponent.h:34
Pos3d getPosNodo(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node.
Definition: NodePtrs.cc:352
double MaxCooNod(int i) const
Returns the maximum value de la coordenada i of the nodes.
Definition: NodePtrs.cc:237
Pos3d getPosCdg(bool initialGeometry=true) const
Returns the centro de gravedad de las posiciones of the nodes.
Definition: NodePtrs.cc:371