xc
NodePtrArray3d.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 //NodePtrArray3d.h
29 //Pointers to nodes in an array of matrices.
30 
31 #ifndef NODEPTRARRAY3D_H
32 #define NODEPTRARRAY3D_H
33 
34 #include "utility/kernel/CommandEntity.h"
35 #include "utility/functions/algebra/ExprAlgebra.h"
36 #include "NodePtrArray.h"
37 #include "PtrArray3dBase.h"
38 #include "utility/matrix/Vector.h"
39 
40 
41 class ExprAlgebra;
42 class Intervalo1D;
43 class RangoIndice;
44 class Array3dRange;
45 
46 namespace XC{
47 
48 class Element;
49 
53 class NodePtrArray3d: public PtrArray3dBase<NodePtrArray>
54  {
55  public:
56  NodePtrArray3d(const size_t n_layers= 0);
57  NodePtrArray3d(const size_t ,const size_t ,const size_t );
58 
59  Node *findNode(const int &tag);
60  const Node *findNode(const int &tag) const;
61  Node *getNearestNode(const Pos3d &p);
62  const Node *getNearestNode(const Pos3d &p) const;
63  ID getNodeIndices(const Node *) const;
64  std::deque<const Node *> getNodePtrs(void) const;
65  boost::python::list getPyNodeList(void) const;
66  bool removeNode(Node *);
67  bool removeNode(const int &);
68 
69  std::set<const Element *> getConnectedElements(void) const;
70  std::set<Element *> getConnectedElements(void);
71  boost::python::list getConnectedElementsPy(void);
72 
73  template <class F>
74  std::deque<double> RowSimpsonIntegration(const F &,const std::string &,const size_t &,const ExprAlgebra &,const size_t &) const;
75  Vector IRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
76  Vector JRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
77  Vector KRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
78 
79  void fix(const SFreedom_Constraint &) const;
80 
81  std::vector<int> getTags(void) const;
82 
83 
84  void Print(std::ostream &os) const;
85  };
86 
87 
88 std::ostream &operator<<(std::ostream &os,const NodePtrArray3d &);
89 
90 template <class F>
91 std::deque<double> NodePtrArray3d::RowSimpsonIntegration(const F &f,const std::string &coo_name,const size_t &num_coo,const ExprAlgebra &e,const size_t &n) const
92  {
93  const size_t sz= f.Size();
94  std::deque<double> retval;
95  if(sz<2) return retval;
96  const Vector *p0= &(f(1)->getCrds());
97  if(!p0) return retval;
98  double s0= (*p0)(num_coo);
99  for(size_t i=2;i<=sz;i++)
100  {
101  const Vector *p1= &(f(i)->getCrds());
102  if(!p1) return retval;
103  double s1= ((*p0)(num_coo)+(*p1)(num_coo))/2.0;
104  Intervalo1D iv(coo_name,ExprAlgebra(s0),ExprAlgebra(s1),n);
105  retval.push_back(e.IntegSimpson(iv).ToNum());
106  s0= s1;
107  p0= p1;
108  }
109  const Vector *p1= &(f(sz)->getCrds());
110  if(!p1) return retval;
111  double s1= (*p1)(num_coo);
112  Intervalo1D iv(coo_name,ExprAlgebra(s0),ExprAlgebra(s1),n);
113  retval.push_back(e.IntegSimpson(iv).ToNum());
114  return retval;
115  }
116 
117 inline void fix(const NodePtrArray3d &ttz,const SFreedom_Constraint &spc)
118  { ttz.fix(spc); }
119 void fix(const NodePtrArray3d::box_var_ref &box_ref,const SFreedom_Constraint &spc);
120 
121 std::vector<int> getNodeIdsQuad4N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
122 std::vector<int> getNodeIdsQuad9N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
123 
124 } //end of XC namespace.
125 
126 #endif
Float vector abstraction.
Definition: Vector.h:94
ID getNodeIndices(const Node *) const
Returns the indexes of the node identified by the pointer being passed as parameter.
Definition: NodePtrArray3d.cc:107
ExprAlgebra IntegSimpson(const Intervalo1D &i) const
Integrates the expresion using the Simpson rule.
Definition: ExprAlgebra.cc:155
bool removeNode(Node *)
Remove the given node from the array.
Definition: NodePtrArray3d.cc:183
Vector of integers.
Definition: ID.h:95
boost::python::list getConnectedElementsPy(void)
Return the elements connected to any of the nodes of this entity.
Definition: NodePtrArray3d.cc:237
Node * findNode(const int &tag)
Returns (if it exists) a pointer to the node which tag is being passed as parameter.
Definition: NodePtrArray3d.cc:58
Integration interval in one dimension.
Definition: num_integration.h:32
void fix(const SFreedom_Constraint &) const
Impone desplazamiento nulo en the nodes de this set.
Definition: NodePtrArray3d.cc:284
Node * getNearestNode(const Pos3d &p)
Returns the node closest to the point being passed as parameter.
Definition: NodePtrArray3d.cc:79
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
Reference to a "sub-array".
Definition: Array3dBoxVarRef.h:33
std::deque< const Node * > getNodePtrs(void) const
Returns the pointers to the nodes of this array.
Definition: NodePtrArray3d.cc:154
Reference to a layer of the array which points have constant I index.
Definition: ConstantILayerConstRef.h:34
Posición en tres dimensiones.
Definition: Pos3d.h:44
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:53
Expresión algebraica.
Definition: ExprAlgebra.h:32
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Rangos de variación de tres índices, se emplea en BoxConstRef.
Definition: Array3dRange.h:32
boost::python::list getPyNodeList(void) const
Returns a Python list containing the nodes of this array.
Definition: NodePtrArray3d.cc:168
NodePtrArray3d(const size_t n_layers=0)
Default constructor.
Definition: NodePtrArray3d.cc:46
std::set< const Element * > getConnectedElements(void) const
Return the elements connected to any of the nodes of this entity.
Definition: NodePtrArray3d.cc:208
Mesh node.
Definition: Node.h:112
Rango de variación de un índice, se emplea en BoxConstRef.
Definition: RangoIndice.h:30
Three-dimensional array of object pointers.
Definition: PtrArray3dBase.h:43