FirstOrderAssembler.h 5.62 KB
Newer Older
1
2
3
#ifndef AMDIS_FIRST_ORDER_ASSEMBLER_H
#define AMDIS_FIRST_ORDER_ASSEMBLER_H

4
#include "AMDiS_fwd.h"
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
#include "SubAssembler.h"

namespace AMDiS {

  /**
   * \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
31
32
    /// Destructor.
    virtual ~FirstOrderAssembler() {}
33
34

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


  protected:
44
45
46
47
48
49
    /** \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
50
    /// List of all yet created optimized zero order assemblers for grdPsi.
51
52
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi;

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

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

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


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
79
    /// Implements SubAssembler::calculateElementVector().
80
    void calculateElementVector(const ElInfo *, ElementVector&);
Thomas Witkowski's avatar
Thomas Witkowski committed
81
82
83

  protected:
    const BasisFunction *psi, *phi;
84
85
86
87
88
89
90
91
92
93
94
95
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
102
    /// Implements SubAssembler::calculateElementVector().
103
104
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
105
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
106
    }
107
108
109

  protected:
    std::vector<VectorOfFixVecs<DimVec<double> > > tmpGrdPhi;
Thomas Witkowski's avatar
Thomas Witkowski committed
110
111

    const BasisFunction *psi, *phi;
112
113
114
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
115
116
117
118
  /**
   * \ingroup Assembler
   * 
   * \brief
119
120
121
122
123
   * First order assembler for grdPsi using fast quadratures.
   */
  class Quad10 : public FirstOrderAssembler
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
124
    /// Constructor.
125
126
    Quad10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
130
    /// Implements SubAssembler::calculateElementVector().
131
    void calculateElementVector(const ElInfo *, ElementVector&);
132
133
  };

Thomas Witkowski's avatar
Thomas Witkowski committed
134
135
136
137
  /**
   * \ingroup Assembler
   * 
   * \brief
138
139
140
141
142
   * First order assembler for grdPhi using fast quadratures.
   */
  class Quad01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
143
    /// Constructor.
144
145
    Quad01(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
149
    /// Implements SubAssembler::calculateElementVector().
150
151
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
152
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
153
    }
154
155
156
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
157
158
159
160
  /**
   * \ingroup Assembler
   *
   * \brief
161
162
163
164
165
   * First order assembler for grdPsi using precalculated integrals
   */
  class Pre10 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
166
    /// Constructor.
167
168
    Pre10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
172
    /// Implements SubAssembler::calculateElementVector().
173
    void calculateElementVector(const ElInfo*, ElementVector&);
174
175

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
176
    /// Integral of the product of the derivative of psi and phi.
177
178
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
179
    /// Integral of the derivative of psi.
180
181
182
183
184
185
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
201
    /// Implements SubAssembler::calculateElementVector().
202
203
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
204
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
205
    }
206
207

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
208
    /// Integral of the product of psi and the derivative of phi.
209
210
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
211
    /// Integral of the derivative of phi.
212
213
214
215
216
217
218
219
220
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H