FirstOrderAssembler.h 6.73 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
    static std::vector<SubAssembler*> standardSubAssemblersGrdPhi;
  };


  /**
   * \ingroup Assembler
   * 
   * \brief
   * Standard first order assembler for grdPsi.
   */
  class Stand10 : public FirstOrderAssembler
  {
  public:
76
    /// Constructor
77
78
    Stand10(Operator *op, Assembler *assembler, Quadrature *quad);

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

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

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


  /**
   * \ingroup Assembler
   * 
   * \brief
   * Standard first order assembler for grdPhi.
   */
  class Stand01 : public FirstOrderAssembler
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
103
    /// Constructor.
104
105
    Stand01(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
109
    /// 
110
111
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
112
113
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
114
				ElementMatrix& mat);
115

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


Thomas Witkowski's avatar
Thomas Witkowski committed
123
124
125
126
  /**
   * \ingroup Assembler
   * 
   * \brief
127
128
129
130
131
   * First order assembler for grdPsi using fast quadratures.
   */
  class Quad10 : public FirstOrderAssembler
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
132
    /// Constructor.
133
134
    Quad10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
138
    ///
139
140
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
141
142
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
143
				ElementMatrix& mat) 
144
145
146
147
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
148
    /// Implements SubAssembler::calculateElementVector().
149
    void calculateElementVector(const ElInfo *, ElementVector&);
150
151
  };

Thomas Witkowski's avatar
Thomas Witkowski committed
152
153
154
155
  /**
   * \ingroup Assembler
   * 
   * \brief
156
157
158
159
160
   * First order assembler for grdPhi using fast quadratures.
   */
  class Quad01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
161
    /// Constructor.
162
163
    Quad01(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
167
    ///
168
169
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
170
171
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
172
				ElementMatrix& mat) 
173
174
175
176
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
177
    /// Implements SubAssembler::calculateElementVector().
178
    void calculateElementVector(const ElInfo*, ElementVector&) {
179
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
180
    }
181
182
183
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
184
185
186
187
  /**
   * \ingroup Assembler
   *
   * \brief
188
189
190
191
192
   * First order assembler for grdPsi using precalculated integrals
   */
  class Pre10 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
193
    /// Constructor.
194
195
    Pre10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
199
    ///
200
201
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
202
203
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
204
				ElementMatrix& mat) 
205
206
207
208
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
209
    /// Implements SubAssembler::calculateElementVector().
210
    void calculateElementVector(const ElInfo*, ElementVector&);
211
212

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
213
    /// Integral of the product of the derivative of psi and phi.
214
215
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
216
    /// Integral of the derivative of psi.
217
218
219
220
221
222
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
223
224
225
226
  /**
   * \ingroup Assembler
   *
   * \brief
227
228
229
230
231
   *  First order assembler for grdPhi using precalculated integrals
   */
  class Pre01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
232
    /// Constructor.
233
234
    Pre01(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
238
    ///
239
240
    void calculateElementMatrix(const ElInfo *rowElInfo,
				const ElInfo *colElInfo,
241
242
				const ElInfo *smallElInfo,
				const ElInfo *largeElInfo,
243
				ElementMatrix& mat)
244
245
246
247
    {
      ERROR_EXIT("CEM not yet\n");
    }

Thomas Witkowski's avatar
Thomas Witkowski committed
248
    /// Implements SubAssembler::calculateElementVector().
249
    void calculateElementVector(const ElInfo*, ElementVector&) {
250
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
251
    }
252
253

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
254
    /// Integral of the product of psi and the derivative of phi.
255
256
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
257
    /// Integral of the derivative of phi.
258
259
260
261
262
263
264
265
266
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H