FirstOrderAssembler.h 6.9 KB
Newer Older
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
#ifndef AMDIS_FIRST_ORDER_ASSEMBLER_H
#define AMDIS_FIRST_ORDER_ASSEMBLER_H

#include "SubAssembler.h"

namespace AMDiS {

  class Q10PsiPhi;
  class Q01PsiPhi;
  class Q1Psi;

  /**
   * \ingroup Assembler
   * 
   * \brief
   * SubAssembler for first order terms.
   */
  class FirstOrderAssembler : public SubAssembler
  {
  public:
    /** \brief
     * Creates and returns the FirstOrderAssembler for Operator op and
     * the given assembler. If all terms are piecewise constant precalculated 
     * integrals can be used while assembling and the returned 
     * ZeroOrderAssembler is of type Pre0. Otherwise a Quad0 object will
     * be returned.
     */
    static FirstOrderAssembler* getSubAssembler(Operator *op,
						Assembler *assembler,
						Quadrature *quadrat,
						FirstOrderType type,
						bool optimized);
  
Thomas Witkowski's avatar
Thomas Witkowski committed
34
35
    /// Destructor.
    virtual ~FirstOrderAssembler() {}
36
37

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
38
    /// Constructor.
39
40
41
42
43
44
45
46
    FirstOrderAssembler(Operator *op,
			Assembler *assembler,
			Quadrature *quadrat,
			bool optimized,
			FirstOrderType type);


  protected:
47
48
49
50
51
52
    /** \brief
     * Thread safe temporary vector of DimMats for calculation in 
     * function calculateElementMatrix().
     */
    std::vector<VectorOfFixVecs<DimVec<double> > > tmpLb;

Thomas Witkowski's avatar
Thomas Witkowski committed
53
    /// List of all yet created optimized zero order assemblers for grdPsi.
54
55
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi;

Thomas Witkowski's avatar
Thomas Witkowski committed
56
    /// List of all yet created standard zero order assemblers for grdPsi.
57
58
    static std::vector<SubAssembler*> standardSubAssemblersGrdPsi;

Thomas Witkowski's avatar
Thomas Witkowski committed
59
    /// List of all yet created optimized zero order assemblers for grdPhi.
60
61
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPhi;

Thomas Witkowski's avatar
Thomas Witkowski committed
62
    /// List of all yet created standard zero order assemblers for grdPhi.
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    static std::vector<SubAssembler*> standardSubAssemblersGrdPhi;
  };


  /**
   * \ingroup Assembler
   * 
   * \brief
   * Standard first order assembler for grdPsi.
   */
  class Stand10 : public FirstOrderAssembler
  {
  public:
    MEMORY_MANAGED(Stand10);

78
    /// Constructor
79
80
    Stand10(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
81
    /// Implements SubAssembler::calculateElementMatrix().
82
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
83

Thomas Witkowski's avatar
Thomas Witkowski committed
84
    ///
85
86
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
87
88
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
89
				ElementMatrix& mat);
90

Thomas Witkowski's avatar
Thomas Witkowski committed
91
    /// Implements SubAssembler::calculateElementVector().
92
    void calculateElementVector(const ElInfo *, ElementVector&);
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  };


  /**
   * \ingroup Assembler
   * 
   * \brief
   * Standard first order assembler for grdPhi.
   */
  class Stand01 : public FirstOrderAssembler
  {
  public:
    MEMORY_MANAGED(Stand01);

Thomas Witkowski's avatar
Thomas Witkowski committed
107
    /// Constructor.
108
109
    Stand01(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
110
    /// Implements SubAssembler::calculateElementMatrix().
111
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
112

Thomas Witkowski's avatar
Thomas Witkowski committed
113
    /// 
114
115
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
116
117
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
118
				ElementMatrix& mat);
119

Thomas Witkowski's avatar
Thomas Witkowski committed
120
    /// Implements SubAssembler::calculateElementVector().
121
    void calculateElementVector(const ElInfo*, ElementVector&) {
122
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
123
    }
124
125
126
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
127
128
129
130
  /**
   * \ingroup Assembler
   * 
   * \brief
131
132
133
134
135
136
137
   * First order assembler for grdPsi using fast quadratures.
   */
  class Quad10 : public FirstOrderAssembler
  {
  public:
    MEMORY_MANAGED(Quad10);

Thomas Witkowski's avatar
Thomas Witkowski committed
138
    /// Constructor.
139
140
    Quad10(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
141
    /// Implements SubAssembler::calculateElementMatrix().
142
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
143

Thomas Witkowski's avatar
Thomas Witkowski committed
144
    ///
145
146
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
147
148
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
149
				ElementMatrix& mat) 
150
151
152
153
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
154
    /// Implements SubAssembler::calculateElementVector().
155
    void calculateElementVector(const ElInfo *, ElementVector&);
156
157
  };

Thomas Witkowski's avatar
Thomas Witkowski committed
158
159
160
161
  /**
   * \ingroup Assembler
   * 
   * \brief
162
163
164
165
166
167
168
   * First order assembler for grdPhi using fast quadratures.
   */
  class Quad01 : public FirstOrderAssembler 
  {
  public:
    MEMORY_MANAGED(Quad01);

Thomas Witkowski's avatar
Thomas Witkowski committed
169
    /// Constructor.
170
171
    Quad01(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
172
    /// Implements SubAssembler::calculateElementMatrix().
173
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
174

Thomas Witkowski's avatar
Thomas Witkowski committed
175
    ///
176
177
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
178
179
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
180
				ElementMatrix& mat) 
181
182
183
184
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
185
    /// Implements SubAssembler::calculateElementVector().
186
    void calculateElementVector(const ElInfo*, ElementVector&) {
187
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
188
    }
189
190
191
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
192
193
194
195
  /**
   * \ingroup Assembler
   *
   * \brief
196
197
198
199
200
201
202
   * First order assembler for grdPsi using precalculated integrals
   */
  class Pre10 : public FirstOrderAssembler 
  {
  public:
    MEMORY_MANAGED(Pre10);

Thomas Witkowski's avatar
Thomas Witkowski committed
203
    /// Constructor.
204
205
    Pre10(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
206
    /// Implements SubAssembler::calculateElementMatrix().
207
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
208

Thomas Witkowski's avatar
Thomas Witkowski committed
209
    ///
210
211
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
212
213
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
214
				ElementMatrix& mat) 
215
216
217
218
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
219
    /// Implements SubAssembler::calculateElementVector().
220
    void calculateElementVector(const ElInfo*, ElementVector&);
221
222

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
223
    /// Integral of the product of the derivative of psi and phi.
224
225
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
226
    /// Integral of the derivative of psi.
227
228
229
230
231
232
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
233
234
235
236
  /**
   * \ingroup Assembler
   *
   * \brief
237
238
239
240
241
242
243
   *  First order assembler for grdPhi using precalculated integrals
   */
  class Pre01 : public FirstOrderAssembler 
  {
  public:
    MEMORY_MANAGED(Pre01);

Thomas Witkowski's avatar
Thomas Witkowski committed
244
    /// Constructor.
245
246
    Pre01(Operator *op, Assembler *assembler, Quadrature *quad);

Thomas Witkowski's avatar
Thomas Witkowski committed
247
    /// Implements SubAssembler::calculateElementMatrix().
248
    void calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat);
249

Thomas Witkowski's avatar
Thomas Witkowski committed
250
    ///
251
252
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
253
254
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
255
				ElementMatrix& mat)
256
257
258
259
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
260
    /// Implements SubAssembler::calculateElementVector().
261
    void calculateElementVector(const ElInfo*, ElementVector&) {
262
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
263
    }
264
265

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
266
    /// Integral of the product of psi and the derivative of phi.
267
268
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
269
    /// Integral of the derivative of phi.
270
271
272
273
274
275
276
277
278
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H