xc
ShapeFunction.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. PĂ©rez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //ShapeFunction.h
22 // ORIGINAL: shape.h Copyright (c) 1999, A.H. van den Boogaard
23 //FeaTure is put on the internet as free software. I would very
24 //much like to hear your feedback and if possible improvements. See
25 //also the 'Future plans' part in the manual.
26 //Modified by LCPT to integrate it in XC.
27 
28 #ifndef SHAPEFUNCTION_H
29 #define SHAPEFUNCTION_H
30 
31 #include <cstddef>
32 #include "utility/matrices/m_double.h"
33 
38 
39 
40 class IntegrationPoints;
41 
46  {
47  protected:
50 
51  public:
53  virtual ~ShapeFunction(){}
56  virtual m_double get_N_vec(const m_double &natcor) const=0;
60  virtual m_double getPartialDerivatives(const m_double &natcor) const=0;
62  virtual IntegrationPoints get_integ_points(void) const=0;
64  virtual size_t get_nr_integ_points() const=0;
65 
68  virtual IntegrationPoints get_face_integ_points(size_t face_nr) const=0;
70  virtual m_double dVdA(size_t face_nr) const=0;
71  };
72 
76 class Segmento: public ShapeFunction
77  {
78  private:
79  size_t int_scheme;
80 
81  protected:
83  Segmento(size_t intscheme)
84  :int_scheme(intscheme){}
85  public:
90  size_t get_nr_integ_points(void) const { return int_scheme; }
91 
92  m_double dVdA(size_t face_nr) const;
93  IntegrationPoints get_face_integ_points(size_t face_nr) const;
94  };
95 
99 class Seg_lin:public Segmento
100  {
101  public:
103  Seg_lin(size_t nxi)
104  : Segmento(nxi){}
107  m_double get_N_vec(const m_double &natcor) const;
108  m_double getPartialDerivatives(const m_double &natcor) const;
109  };
110 
115  {
116  private:
117  size_t int_scheme;
118 
119  protected:
121  Triangular(size_t intscheme)
122  :int_scheme(intscheme){}
123  public:
128  size_t get_nr_integ_points(void) const { return int_scheme; }
129 
130  m_double dVdA(size_t face_nr) const;
131  IntegrationPoints get_face_integ_points(size_t face_nr) const;
132  };
133 
137 class Tri_lin:public Triangular
138  {
139  public:
141  Tri_lin(size_t intscheme)
142  : Triangular(intscheme){}
145  m_double get_N_vec(const m_double &natcor) const;
146  m_double getPartialDerivatives(const m_double &natcor) const;
147  };
148 
152 class Tri_quad:public Triangular
153  {
154  public:
156  Tri_quad(size_t intscheme)
157  : Triangular(intscheme){}
160  m_double get_N_vec(const m_double &natcor) const;
161  m_double getPartialDerivatives(const m_double &natcor) const;
162  };
163 
168  {
169  public:
171  Tri_quad_alt(size_t intscheme):Triangular(intscheme){}
174  m_double get_N_vec(const m_double &natcor) const;
175  m_double getPartialDerivatives(const m_double &natcor) const;
176  };
177 
182  {
183  private:
184  size_t int_scheme[2];
185 
186  protected:
188  Quadrilateral(size_t nxi, size_t neta)
189  { int_scheme[0]=nxi; int_scheme[1]=neta; }
190 
191  public:
196  size_t get_nr_integ_points() const
197  { return int_scheme[0]*int_scheme[1]; }
198 
199  m_double dVdA(size_t face_nr) const;
200  IntegrationPoints get_face_integ_points(size_t face_nr) const;
201  };
202 
207  {
208  public:
210  Quad_lin(size_t nxi, size_t neta)
211  : Quadrilateral(nxi, neta){}
214  m_double get_N_vec(const m_double &natcor) const;
215  m_double getPartialDerivatives(const m_double &natcor) const;
216  };
217 
222  {
223  public:
225  Quad_quad(size_t nxi, size_t neta)
226  : Quadrilateral(nxi, neta){}
229  m_double get_N_vec(const m_double &natcor) const;
230  m_double getPartialDerivatives(const m_double &natcor) const;
231  };
232 
237  {
238  public:
240  Quad_quad_alt(size_t nxi, size_t neta)
241  : Quadrilateral(nxi, neta){}
244  m_double get_N_vec(const m_double &natcor) const;
245  m_double getPartialDerivatives(const m_double &natcor) const;
246  };
247 
252  {
253  private:
254  size_t int_scheme[3];
255 
256  protected:
258  Hexaedrico(size_t nxi, size_t neta, size_t nzeta)
259  { int_scheme[0]=nxi; int_scheme[1]=neta; int_scheme[2]=nzeta; }
260 
261  public:
266  size_t get_nr_integ_points() const
267  { return int_scheme[0]*int_scheme[1]*int_scheme[2]; }
268 
269  m_double dVdA(size_t face_nr) const;
270  IntegrationPoints get_face_integ_points(size_t face_nr) const;
271  };
272 
276 class Hex_lin:public Hexaedrico
277  {
278  public:
280  Hex_lin(size_t nxi, size_t neta, size_t nzeta)
281  : Hexaedrico(nxi, neta, nzeta){}
284  m_double get_N_vec(const m_double &natcor) const;
285  m_double getPartialDerivatives(const m_double &natcor) const;
286  };
287 
288 #endif // SHAPEFUNCTION_H
virtual IntegrationPoints get_integ_points(void) const =0
Return the integration points for the shape functions domain.
virtual m_double dVdA(size_t face_nr) const =0
??
Triangular(size_t intscheme)
Constructor.
Definition: ShapeFunction.h:121
Functiones de forma para segmento lineal (2 nodos).
Definition: ShapeFunction.h:99
Shape functions for another quadratic triangle (6 nodes).
Definition: ShapeFunction.h:167
~Segmento()
Destructor.
Definition: ShapeFunction.h:87
virtual m_double get_N_vec(const m_double &natcor) const =0
Return the values of the shape functions at the point.
~Quadrilateral()
Destructor.
Definition: ShapeFunction.h:193
Quad_quad(size_t nxi, size_t neta)
Constructor.
Definition: ShapeFunction.h:225
size_t get_nr_integ_points() const
Return the numberof integration points.
Definition: ShapeFunction.h:266
virtual size_t get_nr_integ_points() const =0
Return the integration points for the shape functions domain.
Shape functions for linear triangles (3 nodes).
Definition: ShapeFunction.h:137
Base class for shape functions.
Definition: ShapeFunction.h:45
~Hex_lin()
Destructor.
Definition: ShapeFunction.h:283
~Tri_quad_alt()
Destructor.
Definition: ShapeFunction.h:173
~Quad_quad()
Destructor.
Definition: ShapeFunction.h:228
ShapeFunction()
Constructor por defecto.
Definition: ShapeFunction.h:49
size_t get_nr_integ_points(void) const
Return the number of integration points.
Definition: ShapeFunction.h:128
Clase base para dominios de tipo segmento.
Definition: ShapeFunction.h:76
Quadrilateral(size_t nxi, size_t neta)
Constructor.
Definition: ShapeFunction.h:188
Base class for shape functions over hexahedrons.
Definition: ShapeFunction.h:251
~Quad_quad_alt()
Destructor.
Definition: ShapeFunction.h:243
~Hexaedrico()
Destructor.
Definition: ShapeFunction.h:263
virtual m_double getPartialDerivatives(const m_double &natcor) const =0
Return the values of the partial derivatives of the shape functions at the point which natural coordi...
Quad_lin(size_t nxi, size_t neta)
Constructor.
Definition: ShapeFunction.h:210
~Quad_lin()
Destructor.
Definition: ShapeFunction.h:213
~Triangular()
Destructor.
Definition: ShapeFunction.h:125
Shape functions for another quadratic quad (8 nodes).
Definition: ShapeFunction.h:236
Shape functions for quadratic triangles (6 nodes).
Definition: ShapeFunction.h:152
Tri_lin(size_t intscheme)
Constructor.
Definition: ShapeFunction.h:141
Tri_quad_alt(size_t intscheme)
Constructor.
Definition: ShapeFunction.h:171
Clase base para dominios triangulares.
Definition: ShapeFunction.h:114
size_t get_nr_integ_points(void) const
Return the number of integration points.
Definition: ShapeFunction.h:90
Segmento(size_t intscheme)
Constructor.
Definition: ShapeFunction.h:83
Shape functions for linear quads (4 nodes).
Definition: ShapeFunction.h:206
Integration points container.
Definition: IntegrationPoints.h:42
~Tri_quad()
Destructor.
Definition: ShapeFunction.h:159
Base class for quadrilateral domains.
Definition: ShapeFunction.h:181
Shape functions for linear hexahedrons (8 nodes).
Definition: ShapeFunction.h:276
Shape functions for quadratic quads (8 nodes).
Definition: ShapeFunction.h:221
Tri_quad(size_t intscheme)
Constructor.
Definition: ShapeFunction.h:156
Hexaedrico(size_t nxi, size_t neta, size_t nzeta)
Constructor.
Definition: ShapeFunction.h:258
~Seg_lin()
Destructor.
Definition: ShapeFunction.h:106
Hex_lin(size_t nxi, size_t neta, size_t nzeta)
Constructor.
Definition: ShapeFunction.h:280
virtual IntegrationPoints get_face_integ_points(size_t face_nr) const =0
Return the integration points for a side (2D domains) or a face (3D domains) of the shape functions...
size_t get_nr_integ_points() const
Return the number of integration points.
Definition: ShapeFunction.h:196
~Tri_lin()
Destructor.
Definition: ShapeFunction.h:144
Quad_quad_alt(size_t nxi, size_t neta)
Constructor.
Definition: ShapeFunction.h:240
Seg_lin(size_t nxi)
Constructor.
Definition: ShapeFunction.h:103
virtual ~ShapeFunction()
Destructor.
Definition: ShapeFunction.h:53