xc
NodePtrs.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //NodePtrs.h
29 
30 #ifndef NodePtrs_h
31 #define NodePtrs_h
32 
33 #include "utility/kernel/CommandEntity.h"
34 #include "domain/mesh/node/Node.h"
35 #include <list>
36 #include <vector>
37 
38 class Pos3d;
39 class HalfSpace3d;
40 class Plane;
41 class GeomObj2d;
42 class GeomObj3d;
43 class BND3d;
44 
45 
46 namespace XC {
47 class Element;
48 class Domain;
49 class ID;
50 class Matrix;
51 class Vector;
52 class SetBase;
53 
57 //
59 //
61 class NodePtrs: public CommandEntity, public std::vector<Node *>
62  {
63  public:
64  typedef std::vector<Node *> vector_ptr_nodes;
65  typedef vector_ptr_nodes::const_reference const_reference;
66  typedef vector_ptr_nodes::reference reference;
67  typedef vector_ptr_nodes::iterator iterator;
68  typedef vector_ptr_nodes::const_iterator const_iterator;
71 
72  protected:
73  void disconnect(void);
74  void setPtrs(Domain *theDomain, const ID &theNodeTags);
75 
76  public:
77  NodePtrs(Element *owr,const size_t &sz);
78  NodePtrs(const NodePtrs &);
79  NodePtrs &operator=(const NodePtrs &);
80  ~NodePtrs(void);
81 
82  void inic(void);
83 
84  iterator find(const int &);
85  const_iterator find(const int &) const;
86  int find(const Node *) const;
87 
88  Node *getNodePtr(const size_t &);
89  const_reference operator()(const size_t &i) const;
90  void set_node(const size_t &i,Node *);
91 
92  bool hasNull(void) const;
93 
94  ID getNumDOFs(void) const;
95  int getTotalDOFs(void) const;
96  Vector getDistributionFactor(int mode) const;
97  Matrix getNodeVectors(const Vector &) const;
98  double MaxCooNod(int i) const;
99  double MinCooNod(int i) const;
100  std::vector<int> getIdx(void) const;
101  bool checkDimension(const size_t &dim) const;
102  size_t getDimension(void) const;
103  BND3d Bnd(const double &) const;
104  const Matrix &getCoordinates(void) const;
105  Pos3d getPosNode(const size_t &i,bool initialGeometry= true) const;
106  std::deque<Pos3d> getPositions(bool initialGeometry= true) const;
107  Pos3d getCenterOfMassPosition(bool initialGeometry= true) const;
108  Node *getNearestNode(const Pos3d &p,bool initialGeometry= true);
109  const Node *getNearestNode(const Pos3d &p,bool initialGeometry= true) const;
110  bool In(const GeomObj3d &,const double &factor= 1.0, const double &tol= 0.0) const;
111  bool Out(const GeomObj3d &,const double &factor= 1.0, const double &tol= 0.0) const;
112  bool In(const GeomObj2d &,const double &factor= 1.0, const double &tol= 0.0) const;
113  bool Out(const GeomObj2d &,const double &factor= 1.0, const double &tol= 0.0) const;
114  bool Corta(const Plane &,bool initialGeometry= true) const;
115  bool Crosses(const GeomObj3d &,const double &factor= 1.0, const double &tol= 0.0) const;
116  bool Crosses(const GeomObj2d &,const double &factor= 1.0, const double &tol= 0.0) const;
117 
118  void resetTributaries(void) const;
119  void dumpTributaries(const std::vector<double> &) const;
120 
121  const std::vector<int> &getTags(void) const;
122  int getNodeIndex(const Node *) const;
123  int getNodeIndex(const int &tag) const;
124 
125  void reverse(void);
126 
127  ElementConstPtrSet getConnectedElements(void) const;
128  ElementPtrSet getConnectedElements(void);
129  boost::python::list getConnectedElementsPy(void);
130  boost::python::list getConnectedElementTags(void) const;
131 
132  ElementConstPtrSet getConnectedElements(const SetBase *) const;
133  ElementPtrSet getConnectedElements(const SetBase *);
134  boost::python::list getConnectedElementsPy(const SetBase *);
135  boost::python::list getConnectedElementTags(const SetBase *) const;
136  };
137 } // end of XC namespace
138 
139 #endif
140 
boost::python::list getConnectedElementsPy(void)
Return a python list of pointers to the elements that are connected with this node.
Definition: NodePtrs.cc:712
Node::ElementConstPtrSet ElementConstPtrSet
Container of const element pointers.
Definition: NodePtrs.h:70
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:285
void reverse(void)
Reverse the node sequence.
Definition: NodePtrs.cc:636
Float vector abstraction.
Definition: Vector.h:94
Pos3d getPosNode(const size_t &i, bool initialGeometry=true) const
Return the position of the i-th node.
Definition: NodePtrs.cc:354
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:591
const std::vector< int > & getTags(void) const
Returns a vector con los tags of the nodes.
Definition: NodePtrs.cc:263
NodePtrs(Element *owr, const size_t &sz)
Constructor.
Definition: NodePtrs.cc:49
bool Corta(const Plane &, bool initialGeometry=true) const
Returns true if there are nodes in both sides of the plane.
Definition: NodePtrs.cc:456
Pos3d getCenterOfMassPosition(bool initialGeometry=true) const
Returns the centroid of the node positions.
Definition: NodePtrs.cc:404
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:193
Node * getNodePtr(const size_t &)
Returns a pointer to the node at the position being passed as parameter.
Definition: NodePtrs.cc:188
Vector of integers.
Definition: ID.h:95
Plane in a three-dimensional space.
Definition: Plane.h:49
void set_node(const size_t &i, Node *)
Asigna the pointer to node i.
Definition: NodePtrs.cc:197
iterator find(const int &)
Returns an iterator to the node identified by the tag being passed as parameter.
Definition: NodePtrs.cc:153
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:434
Base de las clases Set y SetEstruct.
Definition: SetBase.h:51
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:601
ElementConstPtrSet getConnectedElements(void) const
Return a set of pointers to the elements that are connected with this node.
Definition: NodePtrs.cc:641
Base class for the finite elements.
Definition: Element.h:112
int getNodeIndex(const Node *) const
Return the index of the node pointer in the array.
Definition: NodePtrs.cc:553
Base class for the two-dimensional geometric objects.
Definition: GeomObj2d.h:37
void inic(void)
Pone a cero los pointers to node.
Definition: NodePtrs.cc:104
BND3d Bnd(const double &) const
Returns the boundary of the nodes.
Definition: NodePtrs.cc:383
boost::python::list getConnectedElementTags(void) const
Return a python list containing the tags of the elements that are connected with this node...
Definition: NodePtrs.cc:742
void resetTributaries(void) const
Resets tributary areas (or lengths or volumes) of connected nodes.
Definition: NodePtrs.cc:582
int getTotalDOFs(void) const
Return the total number of DOFs.
Definition: NodePtrs.cc:229
~NodePtrs(void)
Destructor.
Definition: NodePtrs.cc:85
Element pointers to nodes.
Definition: NodePtrs.h:61
ID getNumDOFs(void) const
Returns a vector with the number of DOFs for each node.
Definition: NodePtrs.cc:219
const Matrix & getCoordinates(void) const
Returns a matrix with the coordinates of the nodes by rows.
Definition: NodePtrs.cc:335
size_t getDimension(void) const
Returns the dimension of the node coordinates.
Definition: NodePtrs.cc:313
Objet that can execute python scripts.
Definition: CommandEntity.h:40
"boundary" en tres dimensiones.
Definition: BND3d.h:34
bool hasNull(void) const
Returns true ifalguno de los pointers es nulo.
Definition: NodePtrs.cc:113
std::deque< Pos3d > getPositions(bool initialGeometry=true) const
Returns a list with the node positions.
Definition: NodePtrs.cc:373
std::set< Element * > ElementPtrSet
Container of element pointers.
Definition: Node.h:116
std::set< const Element * > ElementConstPtrSet
Container of const element pointers.
Definition: Node.h:117
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:420
void setPtrs(Domain *theDomain, const ID &theNodeTags)
Sets the node pointers from the node identifiers.
Definition: NodePtrs.cc:129
double MaxCooNod(int i) const
Returns the maximum value of the i-th coordinate of the nodes.
Definition: NodePtrs.cc:239
Posición en tres dimensiones.
Definition: Pos3d.h:44
Node::ElementPtrSet ElementPtrSet
Container of element pointers.
Definition: NodePtrs.h:69
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Matrix of floats.
Definition: Matrix.h:111
Node * getNearestNode(const Pos3d &p, bool initialGeometry=true)
Returns the node closest to the point being passed as parameter.
Definition: NodePtrs.cc:522
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
Mesh node.
Definition: Node.h:112
The points of the half space are those that line at the back of the plane, this being understood as t...
Definition: HalfSpace3d.h:42
bool Crosses(const GeomObj3d &, const double &factor=1.0, const double &tol=0.0) const
Returns true if some nodes are inside the object and others are outside.
Definition: NodePtrs.cc:471
Matrix getNodeVectors(const Vector &) const
Returns the vectors correspondientes a each node disposed in rows.
Definition: NodePtrs.cc:618
double MinCooNod(int i) const
Returns the minimum value of the i-th coordinate of the nodes.
Definition: NodePtrs.cc:251
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43