FirstOrderAssembler.h 5.45 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&);
81
82
83
84
85
86
87
88
89
90
91
92
  };


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

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

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


Thomas Witkowski's avatar
Thomas Witkowski committed
106
107
108
109
  /**
   * \ingroup Assembler
   * 
   * \brief
110
111
112
113
114
   * First order assembler for grdPsi using fast quadratures.
   */
  class Quad10 : public FirstOrderAssembler
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
115
    /// Constructor.
116
117
    Quad10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
121
    /// Implements SubAssembler::calculateElementVector().
122
    void calculateElementVector(const ElInfo *, ElementVector&);
123
124
  };

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
140
    /// Implements SubAssembler::calculateElementVector().
141
    void calculateElementVector(const ElInfo*, ElementVector&) {
142
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
143
    }
144
145
146
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
147
148
149
150
  /**
   * \ingroup Assembler
   *
   * \brief
151
152
153
154
155
   * First order assembler for grdPsi using precalculated integrals
   */
  class Pre10 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
156
    /// Constructor.
157
158
    Pre10(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
162
    /// Implements SubAssembler::calculateElementVector().
163
    void calculateElementVector(const ElInfo*, ElementVector&);
164
165

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
166
    /// Integral of the product of the derivative of psi and phi.
167
168
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
169
    /// Integral of the derivative of psi.
170
171
172
173
174
175
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
176
177
178
179
  /**
   * \ingroup Assembler
   *
   * \brief
180
181
182
183
184
   *  First order assembler for grdPhi using precalculated integrals
   */
  class Pre01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
185
    /// Constructor.
186
187
    Pre01(Operator *op, Assembler *assembler, Quadrature *quad);

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

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

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
197
    /// Integral of the product of psi and the derivative of phi.
198
199
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
200
    /// Integral of the derivative of phi.
201
202
203
204
205
206
207
208
209
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H