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 
51 class NodePtrArray3d: public PtrArray3dBase<NodePtrArray>
52  {
53  public:
54  NodePtrArray3d(const size_t n_layers= 0);
55  NodePtrArray3d(const size_t ,const size_t ,const size_t );
56 
57  Node *findNode(const int &tag);
58  const Node *findNode(const int &tag) const;
59  Node *getNearestNode(const Pos3d &p);
60  const Node *getNearestNode(const Pos3d &p) const;
61  ID getNodeIndices(const Node *) const;
62  std::deque<const Node *> getNodePtrs(void) const;
63  boost::python::list getPyNodeList(void) const;
64  bool removeNode(Node *);
65  bool removeNode(const int &);
66 
67  template <class F>
68  std::deque<double> RowSimpsonIntegration(const F &,const std::string &,const size_t &,const ExprAlgebra &,const size_t &) const;
69  Vector IRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
70  Vector JRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
71  Vector KRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
72 
73  void fix(const SFreedom_Constraint &) const;
74 
75  std::vector<int> getTags(void) const;
76 
77 
78  void Print(std::ostream &os) const;
79  };
80 
81 
82 std::ostream &operator<<(std::ostream &os,const NodePtrArray3d &);
83 
84 template <class F>
85 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
86  {
87  const size_t sz= f.Size();
88  std::deque<double> retval;
89  if(sz<2) return retval;
90  const Vector *p0= &(f(1)->getCrds());
91  if(!p0) return retval;
92  double s0= (*p0)(num_coo);
93  for(size_t i=2;i<=sz;i++)
94  {
95  const Vector *p1= &(f(i)->getCrds());
96  if(!p1) return retval;
97  double s1= ((*p0)(num_coo)+(*p1)(num_coo))/2.0;
98  Intervalo1D iv(coo_name,ExprAlgebra(s0),ExprAlgebra(s1),n);
99  retval.push_back(e.IntegSimpson(iv).ToNum());
100  s0= s1;
101  p0= p1;
102  }
103  const Vector *p1= &(f(sz)->getCrds());
104  if(!p1) return retval;
105  double s1= (*p1)(num_coo);
106  Intervalo1D iv(coo_name,ExprAlgebra(s0),ExprAlgebra(s1),n);
107  retval.push_back(e.IntegSimpson(iv).ToNum());
108  return retval;
109  }
110 
111 inline void fix(const NodePtrArray3d &ttz,const SFreedom_Constraint &spc)
112  { ttz.fix(spc); }
113 void fix(const NodePtrArray3d::box_var_ref &box_ref,const SFreedom_Constraint &spc);
114 
115 std::vector<int> getNodeIdsQuad4N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
116 std::vector<int> getNodeIdsQuad9N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
117 
118 } //end of XC namespace.
119 
120 #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
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:241
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:51
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
Mesh node.
Definition: Node.h:111
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