FirstOrderAssembler.h 5.53 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
101
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
102
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
103
    }
104
105
106

  protected:
    std::vector<VectorOfFixVecs<DimVec<double> > > tmpGrdPhi;
107
108
109
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
125
    /// Implements SubAssembler::calculateElementVector().
126
    void calculateElementVector(const ElInfo *, ElementVector&);
127
128
  };

Thomas Witkowski's avatar
Thomas Witkowski committed
129
130
131
132
  /**
   * \ingroup Assembler
   * 
   * \brief
133
134
135
136
137
   * First order assembler for grdPhi using fast quadratures.
   */
  class Quad01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
138
    /// Constructor.
139
140
    Quad01(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
    /// Implements SubAssembler::calculateElementVector().
145
    void calculateElementVector(const ElInfo*, ElementVector&) {
146
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
147
    }
148
149
150
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
166
    /// Implements SubAssembler::calculateElementVector().
167
    void calculateElementVector(const ElInfo*, ElementVector&);
168
169

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
170
    /// Integral of the product of the derivative of psi and phi.
171
172
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
173
    /// Integral of the derivative of psi.
174
175
176
177
178
179
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


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

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

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

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
201
    /// Integral of the product of psi and the derivative of phi.
202
203
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
204
    /// Integral of the derivative of phi.
205
206
207
208
209
210
211
212
213
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H