FirstOrderAssembler.h 6.96 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
34
35
#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:
    MEMORY_MANAGED(FirstOrderAssembler);

    /** \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
36
37
    /// Destructor.
    virtual ~FirstOrderAssembler() {}
38
39

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


  protected:
49
50
51
52
53
54
    /** \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
55
    /// List of all yet created optimized zero order assemblers for grdPsi.
56
57
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi;

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

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

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


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

80
    /// Constructor
81
82
    Stand10(Operator *op, Assembler *assembler, Quadrature *quad);

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

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

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


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

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

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

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

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


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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

    friend class FirstOrderAssembler;
  };


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

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

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

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

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

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

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

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H