xc
NodePtrArray3d.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 //NodePtrArray3d.h
28 //Pointers to nodes in an array of matrices.
29 
30 #ifndef NODEPTRARRAY3D_H
31 #define NODEPTRARRAY3D_H
32 
33 #include "xc_utils/src/kernel/CommandEntity.h"
34 #include "xc_basic/src/funciones/algebra/ExprAlgebra.h"
35 #include "NodePtrArray.h"
36 #include "PtrArray3dBase.h"
37 #include "utility/matrix/Vector.h"
38 
39 
40 class ExprAlgebra;
41 class Intervalo1D;
42 class RangoIndice;
43 class Array3dRange;
44 
45 namespace XC{
46 
50 class NodePtrArray3d: public PtrArray3dBase<NodePtrArray>
51  {
52  protected:
53 
54  public:
55 
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 
65  template <class F>
66  std::deque<double> RowSimpsonIntegration(const F &,const std::string &,const size_t &,const ExprAlgebra &,const size_t &) const;
67  Vector IRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
68  Vector JRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
69  Vector KRowSimpsonIntegration(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
70 
71  void fix(const SFreedom_Constraint &) const;
72 
73  std::vector<int> getTags(void) const;
74 
75 
76  void Print(std::ostream &os) const;
77  };
78 
79 
80 std::ostream &operator<<(std::ostream &os,const NodePtrArray3d &);
81 
82 template <class F>
83 std::deque<double> NodePtrArray3d::RowSimpsonIntegration(const F &f,const std::string &nmb_coo,const size_t &num_coo,const ExprAlgebra &e,const size_t &n) const
84  {
85  const size_t sz= f.Size();
86  std::deque<double> retval;
87  if(sz<2) return retval;
88  const Vector *p0= &(f(1)->getCrds());
89  if(!p0) return retval;
90  double s0= (*p0)(num_coo);
91  for(size_t i=2;i<=sz;i++)
92  {
93  const Vector *p1= &(f(i)->getCrds());
94  if(!p1) return retval;
95  double s1= ((*p0)(num_coo)+(*p1)(num_coo))/2.0;
96  Intervalo1D iv(nmb_coo,ExprAlgebra(s0),ExprAlgebra(s1),n);
97  retval.push_back(e.IntegSimpson(iv).ToNum());
98  s0= s1;
99  p0= p1;
100  }
101  const Vector *p1= &(f(sz)->getCrds());
102  if(!p1) return retval;
103  double s1= (*p1)(num_coo);
104  Intervalo1D iv(nmb_coo,ExprAlgebra(s0),ExprAlgebra(s1),n);
105  retval.push_back(e.IntegSimpson(iv).ToNum());
106  return retval;
107  }
108 
109 inline void fix(const NodePtrArray3d &ttz,const SFreedom_Constraint &spc)
110  { ttz.fix(spc); }
111 void fix(const NodePtrArray3d::box_var_ref &box_ref,const SFreedom_Constraint &spc);
112 
113 std::vector<int> getNodeIdsQuad4N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
114 std::vector<int> getNodeIdsQuad9N(const NodePtrArray3d::constant_i_layer_const_ref &nodes,const size_t &j,const size_t &k);
115 
116 } //end of XC namespace.
117 
118 #endif
Float vector abstraction.
Definition: Vector.h:93
ID getNodeIndices(const Node *) const
Returns the indexes of the node identified by the pointer being passed as parameter.
Definition: NodePtrArray3d.cc:106
Vector of integers.
Definition: ID.h:93
Node * findNode(const int &tag)
Returns (if it exists) a pointer to the node which tag is being passed as parameter.
Definition: NodePtrArray3d.cc:57
void fix(const SFreedom_Constraint &) const
Impone desplazamiento nulo en the nodes de this set.
Definition: NodePtrArray3d.cc:179
Node * getNearestNode(const Pos3d &p)
Returns the node closest to the point being passed as parameter.
Definition: NodePtrArray3d.cc:78
Single freedom constraint.
Definition: SFreedom_Constraint.h:84
Three-dimensional array of pointers to nodes.
Definition: NodePtrArray3d.h:50
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
NodePtrArray3d(const size_t n_layers=0)
Default constructor.
Definition: NodePtrArray3d.cc:45
Mesh node.
Definition: Node.h:110
Three-dimensional array of object pointers.
Definition: PtrArray3dBase.h:55