XC Open source finite element analysis program
TritrizPtrNod.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 //TritrizPtrNod.h
28 //Vector de matrices de puntos
29 
30 #ifndef TRITRIZPTRNOD_H
31 #define TRITRIZPTRNOD_H
32 
33 #include "xc_utils/src/nucleo/EntCmd.h"
34 #include "xc_basic/src/funciones/algebra/ExprAlgebra.h"
35 #include "MatrizPtrNod.h"
36 #include "TritrizPtrBase.h"
37 #include "utility/matrix/Vector.h"
38 
39 
40 class ExprAlgebra;
41 class Intervalo1D;
42 class Lista;
43 class RangoIndice;
44 class RangoTritriz;
45 
46 namespace XC{
47 
51 class TritrizPtrNod: public TritrizPtrBase<MatrizPtrNod>
52  {
53  protected:
54 
55  public:
56 
57  TritrizPtrNod(const size_t capas= 0);
58  TritrizPtrNod(const size_t ,const size_t ,const size_t );
59 
60  Node *buscaNodo(const int &tag);
61  const Node *buscaNodo(const int &tag) const;
62  Node *getNearestNode(const Pos3d &p);
63  const Node *getNearestNode(const Pos3d &p) const;
64  ID getNodeIndices(const Node *) const;
65 
66  template <class F>
67  std::deque<double> IntegSimpsonFila(const F &,const std::string &,const size_t &,const ExprAlgebra &,const size_t &) const;
68  Vector IntegSimpsonFilaI(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
69  Vector IntegSimpsonFilaJ(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
70  Vector IntegSimpsonFilaK(const size_t &,const size_t &,const ExprAlgebra &,const size_t &n= 10) const;
71 
72  void fix(const SFreedom_Constraint &) const;
73 
74  std::vector<int> getTags(void) const;
75 
76 
77  void Print(std::ostream &os) const;
78  };
79 
80 
81 std::ostream &operator<<(std::ostream &os,const TritrizPtrNod &);
82 
83 template <class F>
84 std::deque<double> TritrizPtrNod::IntegSimpsonFila(const F &f,const std::string &nmb_coo,const size_t &num_coo,const ExprAlgebra &e,const size_t &n) const
85  {
86  const size_t sz= f.Size();
87  std::deque<double> retval;
88  if(sz<2) return retval;
89  const Vector *p0= &(f(1)->getCrds());
90  if(!p0) return retval;
91  double s0= (*p0)(num_coo);
92  for(size_t i=2;i<=sz;i++)
93  {
94  const Vector *p1= &(f(i)->getCrds());
95  if(!p1) return retval;
96  double s1= ((*p0)(num_coo)+(*p1)(num_coo))/2.0;
97  Intervalo1D iv(nmb_coo,ExprAlgebra(s0),ExprAlgebra(s1),n);
98  retval.push_back(e.IntegSimpson(iv).ToNum());
99  s0= s1;
100  p0= p1;
101  }
102  const Vector *p1= &(f(sz)->getCrds());
103  if(!p1) return retval;
104  double s1= (*p1)(num_coo);
105  Intervalo1D iv(nmb_coo,ExprAlgebra(s0),ExprAlgebra(s1),n);
106  retval.push_back(e.IntegSimpson(iv).ToNum());
107  return retval;
108  }
109 
110 inline void fix(const TritrizPtrNod &ttz,const SFreedom_Constraint &spc)
111  { ttz.fix(spc); }
112 void fix(const TritrizPtrNod::var_ref_caja &ref_caja,const SFreedom_Constraint &spc);
113 
114 std::vector<int> getIdNodosQuad4N(const TritrizPtrNod::const_ref_capa_i_cte &nodos,const size_t &j,const size_t &k);
115 std::vector<int> getIdNodosQuad9N(const TritrizPtrNod::const_ref_capa_i_cte &nodos,const size_t &j,const size_t &k);
116 
117 } //end of XC namespace.
118 
119 #endif
"Tritriz" of pointers to elements.
Definition: TritrizPtrNod.h:51
Definition: Vector.h:82
std::vector< int > getIdNodosQuad9N(const TritrizPtrNod::const_ref_capa_i_cte &nodos, const size_t &j, const size_t &k)
Returns the indexes of the nodes (j,k),(j+1,k),(j+1,k+1),(j,k+1).
Definition: TritrizPtrNod.cc:350
Mesh node.
Definition: Node.h:99
ID getNodeIndices(const Node *) const
Returns the indexes of the node identified by the pointer being passed as parameter.
Definition: TritrizPtrNod.cc:105
std::vector< int > getIdNodosQuad4N(const TritrizPtrNod::const_ref_capa_i_cte &nodos, const size_t &j, const size_t &k)
Returns the indexes of the nodes (j,k),(j+1,k),(j+1,k+1),(j,k+1).
Definition: TritrizPtrNod.cc:256
Definition: ID.h:77
Node * getNearestNode(const Pos3d &p)
Returns the node closest to the point being passed as parameter.
Definition: TritrizPtrNod.cc:78
Single freedom constraint.
Definition: SFreedom_Constraint.h:79
Node * buscaNodo(const int &tag)
Returns (if it exists) a pointer to the node cuyo tag is being passed as parameter.
Definition: TritrizPtrNod.cc:57
================================================================================
Definition: ContinuaReprComponent.h:34
"Tritriz" de pointers to objetos.
Definition: TritrizPtrBase.h:55
void fix(const SFreedom_Constraint &) const
Impone desplazamiento nulo en los nodos de this set.
Definition: TritrizPtrNod.cc:178
TritrizPtrNod(const size_t capas=0)
Default constructor.
Definition: TritrizPtrNod.cc:45