File: FE_Interpolate.h

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (263 lines) | stat: -rw-r--r-- 8,576 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#ifndef FE_INTERPOLATE_H
#define FE_INTERPOLATE_H

#include "MatrixLibrary.h"
#include "ATC_TypeDefs.h"

#include <vector>
#include <map>

namespace ATC {

  struct FE_Quadrature;
  class FE_Element;

  /**
   *  @class  FE_Interpolate
   *  @brief  Base class for computing shape functions, nested inside FE_Element
   */
  class FE_Interpolate {

  public:
    FE_Interpolate(FE_Element *feElement);

    virtual ~FE_Interpolate();

    /** compute the quadrature for a given element type */
    void set_quadrature(FeEltGeometry geo, FeIntQuadrature quad);

    /** store N_ and dNdr_ (and eventually dNdrFace_) the given
     *  quadrature */
    virtual void precalculate_shape_functions();

    /** compute the shape functions at the given point;
     *  we use CLON_VECs */
    virtual void compute_N(const VECTOR &point,
                           VECTOR &N) = 0;

    // middle args get no names because they won't be used by some
    // child classes.
    /** compute the shape function derivatives at the given point;
     *  generic, so can work for 2D or 3D case */
    virtual void compute_dNdr(const VECTOR &point,
                              const int,
                              const int,
                              const double,
                              DENS_MAT &dNdr) = 0;

    /** compute both shape functions and derivatives, using the
     *  fastest, shortcuttiest methods available for batch use */
    virtual void compute_N_dNdr(const VECTOR &point,
                                VECTOR &N,
                                DENS_MAT &dNdr) const = 0;

    /** compute shape functions at a single point, given the local
     *    coordinates; eltCoords needed for derivatives:
     *  indexed: N(node)
     *           dN[nsd](node) */
    virtual void shape_function(const VECTOR &xi,
                                DENS_VEC &N);

    virtual void shape_function(const DENS_MAT &eltCoords,
                                const VECTOR &xi,
                                DENS_VEC &N,
                                DENS_MAT &dNdx);
    virtual void shape_function_derivatives(const DENS_MAT &eltCoords,
                                const VECTOR &xi,
                                DENS_MAT &dNdx);

    /** compute shape functions at all ip's:
     *  indexed: N(ip,node)
     *           dN[nsd](ip,node)
     *           weights(ip) */
    virtual void shape_function(const DENS_MAT &eltCoords,
                                DENS_MAT &N,
                                std::vector<DENS_MAT> &dN,
                                DIAG_MAT &weights);

    /** compute shape functions at all face ip's:
     *  indexed: N(ip,node)
     *           dN[nsd](ip,node)
     *           n(ip,node)/Nn[nsd](ip,node)
     *           weights(ip) */
    virtual void face_shape_function(const DENS_MAT &eltCoords,
                                     const DENS_MAT &faceCoords,
                                     const int faceID,
                                     DENS_MAT &N,
                                     DENS_MAT &n,
                                     DIAG_MAT &weights);

    virtual void face_shape_function(const DENS_MAT &eltCoords,
                                     const DENS_MAT &faceCoords,
                                     const int faceID,
                                     DENS_MAT &N,
                                     std::vector<DENS_MAT> &dN,
                                     std::vector<DENS_MAT> &Nn,
                                     DIAG_MAT &weights);

    /** compute unit normal vector for a face:
     *  indexed: N(ip,node)
     *           dN[nsd](ip,node)
     *           n(ip,node)/Nn[nsd](ip,node)
     *           weights(ip) */
    virtual double face_normal(const DENS_MAT &faceCoords,
                               int ip,
                               DENS_VEC &normal);

    /** compute tangents to coordinate lines
     *  indexed:             */
    virtual void tangents(const DENS_MAT &eltCoords,
                          const VECTOR &localCoords,
                          DENS_MAT &dxdr) const;
    virtual void tangents(const DENS_MAT &eltCoords,
                          const VECTOR &localCoords,
                          std::vector<DENS_VEC> &t,
                          const bool normalize = false) const;
    /** get number of ips in scheme */
    int num_ips() const;

    /** get number of ips per face */
    int num_face_ips() const;

  protected:
    // owner element
    FE_Element *feElement_;

    // Number of dimensions
    int nSD_;

    std::map<FeIntQuadrature,FE_Quadrature *> feQuadList_;
    FE_Quadrature *feQuad_;

    // matrix of shape functions at ip's: N_(ip, node)
    DENS_MAT N_;


    std::vector<DENS_MAT> dNdr_;

    // matrix of shape functions at ip's: N_(ip, node)
    std::vector<DENS_MAT> NFace_;

    // matrix of generic face shape function derivatives
    std::vector<std::vector<DENS_MAT> > dNdrFace_;

    // matrix of generic face shape function derivatives
    std::vector<DENS_MAT> dNdrFace2D_;

  };


  /**********************************************
   * Class for linear interpolation functions with
   * Cartesian coordinates
   **********************************************/
  class FE_InterpolateCartLagrange : public FE_Interpolate {

  public:
    FE_InterpolateCartLagrange(FE_Element *feElement);

    virtual ~FE_InterpolateCartLagrange();

    virtual void compute_N(const VECTOR &point,
                           VECTOR &N);

    virtual void compute_dNdr(const VECTOR &point,
                              const int numNodes,
                              const int nD,
                              const double,
                              DENS_MAT &dNdr);

    virtual void compute_N_dNdr(const VECTOR &point,
                                VECTOR &N,
                                DENS_MAT &dNdr) const;

  };


  /**********************************************
   * Class for linear elements with
   * Cartesian coordinates
   **********************************************/
  class FE_InterpolateCartLin : public FE_Interpolate {

  public:
    FE_InterpolateCartLin(FE_Element *feElement);

    virtual ~FE_InterpolateCartLin();

    virtual void compute_N(const VECTOR &point,
                           VECTOR &N);

    virtual void compute_dNdr(const VECTOR &point,
                              const int numNodes,
                              const int nD,
                              const double vol,
                              DENS_MAT &dNdr);

    virtual void compute_N_dNdr(const VECTOR &point,
                                VECTOR &N,
                                DENS_MAT &dNdr) const;

  };


  /**********************************************
   * Class for quadratic serendipity elements with
   * Cartesian coordinates
   **********************************************/
  class FE_InterpolateCartSerendipity : public FE_Interpolate {

  public:
    FE_InterpolateCartSerendipity(FE_Element *feElement);

    virtual ~FE_InterpolateCartSerendipity();

    virtual void compute_N(const VECTOR &point,
                           VECTOR &N);

    virtual void compute_dNdr(const VECTOR &point,
                              const int numNodes,
                              const int nD,
                              const double vol,
                              DENS_MAT &dNdr);

    virtual void compute_N_dNdr(const VECTOR &point,
                                VECTOR &N,
                                DENS_MAT &dNdr) const;

  };


  /**********************************************
   * Class for linear interpolation functions with
   * volumetric coordinates
   **********************************************/
  class FE_InterpolateSimpLin : public FE_Interpolate {

  public:
    // "Simp"ly overrides all standard shape function methods
    FE_InterpolateSimpLin(FE_Element *feElement);

    virtual ~FE_InterpolateSimpLin();

    virtual void compute_N(const VECTOR &point,
                           VECTOR &N);

    // middle args get no names because they won't be used by some
    // child classes.
    virtual void compute_dNdr(const VECTOR &,
                              const int,
                              const int,
                              const double,
                              DENS_MAT &dNdr);

    virtual void compute_N_dNdr(const VECTOR &point,
                                VECTOR &N,
                                DENS_MAT &dNdr) const;

  };


}; // namespace ATC

#endif // FE_INTERPOLATE_H