xc
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/kernel/CommandEntity.h"
33 #include <list>
34 #include <vector>
35 
36 class Pos3d;
37 class HalfSpace3d;
38 class Plane;
39 class GeomObj2d;
40 class GeomObj3d;
41 class BND3d;
42 
43 
44 namespace XC {
45 class Element;
46 class Node;
47 class Domain;
48 class ID;
49 class Matrix;
50 class Vector;
51 
55 //
57 //
59 class NodePtrs: public CommandEntity, public std::vector<Node *>
60  {
61  public:
62  typedef std::vector<Node *> vector_ptr_nodes;
63  typedef vector_ptr_nodes::const_reference const_reference;
64  typedef vector_ptr_nodes::reference reference;
65  typedef vector_ptr_nodes::iterator iterator;
66  typedef vector_ptr_nodes::const_iterator const_iterator;
67 
68  protected:
69  void disconnect(void);
70  void setPtrs(Domain *theDomain, const ID &theNodeTags);
71 
72  public:
73  NodePtrs(Element *owr,const size_t &sz);
74  NodePtrs(const NodePtrs &);
75  NodePtrs &operator=(const NodePtrs &);
76  ~NodePtrs(void);
77 
78  void inic(void);
79 
80  iterator find(const int &);
81  const_iterator find(const int &) const;
82  int find(const Node *) const;
83 
84  Node *getNodePtr(const size_t &);
85  const_reference operator()(const size_t &i) const;
86  void set_node(const size_t &i,Node *);
87 
88  bool hasNull(void) const;
89 
90  ID getNumDOFs(void) const;
91  int getTotalDOFs(void) const;
92  Vector getDistributionFactor(int mode) const;
93  Matrix getNodeVectors(const Vector &) const;
94  double MaxCooNod(int i) const;
95  double MinCooNod(int i) const;
96  std::vector<int> getIdx(void) const;
97  bool checkDimension(const size_t &dim) const;
98  size_t getDimension(void) const;
99  BND3d Bnd(const double &) const;
100  const Matrix &getCoordinates(void) const;
101  Pos3d getPosNode(const size_t &i,bool initialGeometry= true) const;
102  std::list<Pos3d> getPositions(bool initialGeometry= true) const;
103  Pos3d getCenterOfMassPosition(bool initialGeometry= true) const;
104  Node *getNearestNode(const Pos3d &p,bool initialGeometry= true);
105  const Node *getNearestNode(const Pos3d &p,bool initialGeometry= true) const;
106  bool In(const GeomObj3d &,const double &factor= 1.0, const double &tol= 0.0) const;
107  bool Out(const GeomObj3d &,const double &factor= 1.0, const double &tol= 0.0) const;
108  bool In(const GeomObj2d &,const double &factor= 1.0, const double &tol= 0.0) const;
109  bool Out(const GeomObj2d &,const double &factor= 1.0, const double &tol= 0.0) const;
110  bool Corta(const Plane &,bool initialGeometry= true) const;
111 
112  void resetTributaries(void) const;
113  void dumpTributaries(const std::vector<double> &) const;
114 
115  const std::vector<int> &getTags(void) const;
116  int getNodeIndex(const Node *) const;
117  };
118 } // end of XC namespace
119 
120 #endif
121 
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:280
std::list< Pos3d > getPositions(bool initialGeometry=true) const
Returns a list with the node positions.
Definition: NodePtrs.cc:358
Float vector abstraction.
Definition: Vector.h:93
Pos3d getPosNode(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node.
Definition: NodePtrs.cc:349
void dumpTributaries(const std::vector< double > &) const
Adds to the tributary quantity of each node i the i component of the vector being passed as parameter...
Definition: NodePtrs.cc:510
const std::vector< int > & getTags(void) const
Returns a vector con los tags of the nodes.
Definition: NodePtrs.cc:258
NodePtrs(Element *owr, const size_t &sz)
Constructor.
Definition: NodePtrs.cc:45
bool Corta(const Plane &, bool initialGeometry=true) const
Returns true if there are nodes in both sides of the plane.
Definition: NodePtrs.cc:441
Pos3d getCenterOfMassPosition(bool initialGeometry=true) const
Returns the centroid of the node positions.
Definition: NodePtrs.cc:389
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:188
Node * getNodePtr(const size_t &)
Returns a pointer to the node at the position being passed as parameter.
Definition: NodePtrs.cc:183
Vector of integers.
Definition: ID.h:93
void set_node(const size_t &i, Node *)
Asigna the pointer to node i.
Definition: NodePtrs.cc:192
iterator find(const int &)
Returns an iterator to the node identified by the tag being passed as parameter.
Definition: NodePtrs.cc:148
bool Out(const GeomObj3d &, const double &factor=1.0, const double &tol=0.0) const
Returns true if the node are outside the object.
Definition: NodePtrs.cc:419
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:520
Base class for the finite elements.
Definition: Element.h:109
int getNodeIndex(const Node *) const
Return the index of the node pointer in the array.
Definition: NodePtrs.cc:486
void inic(void)
Pone a cero los pointers to node.
Definition: NodePtrs.cc:100
BND3d Bnd(const double &) const
Returns the boundary of the nodes.
Definition: NodePtrs.cc:368
void resetTributaries(void) const
Resets tributary areas (or lengths or volumes) of connected nodes.
Definition: NodePtrs.cc:501
int getTotalDOFs(void) const
Return the total number of DOFs.
Definition: NodePtrs.cc:224
~NodePtrs(void)
Destructor.
Definition: NodePtrs.cc:81
Pointers to nodes.
Definition: NodePtrs.h:59
ID getNumDOFs(void) const
Returns a vector with the number of DOFs for each node.
Definition: NodePtrs.cc:214
const Matrix & getCoordinates(void) const
Returns a matrix with the coordinates of the nodes by rows.
Definition: NodePtrs.cc:330
size_t getDimension(void) const
Returns the dimension of the node coordinates.
Definition: NodePtrs.cc:308
bool hasNull(void) const
Returns true ifalguno de los pointers es nulo.
Definition: NodePtrs.cc:109
bool In(const GeomObj3d &, const double &factor=1.0, const double &tol=0.0) const
Returns true if all the nodes are inside the object.
Definition: NodePtrs.cc:405
void setPtrs(Domain *theDomain, const ID &theNodeTags)
Sets the node pointers from the node identifiers.
Definition: NodePtrs.cc:125
double MaxCooNod(int i) const
Returns the maximum value de la coordenada i of the nodes.
Definition: NodePtrs.cc:234
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Matrix of floats.
Definition: Matrix.h:108
Node * getNearestNode(const Pos3d &p, bool initialGeometry=true)
Returns the node closest to the point being passed as parameter.
Definition: NodePtrs.cc:455
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:116
Mesh node.
Definition: Node.h:110
Matrix getNodeVectors(const Vector &) const
Returns the vectors correspondientes a each node disposed in rows.
Definition: NodePtrs.cc:537
double MinCooNod(int i) const
Returns the minimum value de la coordenada i of the nodes.
Definition: NodePtrs.cc:246