FirstOrderAssembler.h 6.46 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
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==  http://www.amdis-fem.org                                              ==
// ==                                                                        ==
// ============================================================================
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.



/** \file FirstOrderAssembler.h */

23
24
25
#ifndef AMDIS_FIRST_ORDER_ASSEMBLER_H
#define AMDIS_FIRST_ORDER_ASSEMBLER_H

26
#include "AMDiS_fwd.h"
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#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
53
54
    /// Destructor.
    virtual ~FirstOrderAssembler() {}
55
56

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
57
    /// Constructor.
58
59
60
61
62
63
64
65
    FirstOrderAssembler(Operator *op,
			Assembler *assembler,
			Quadrature *quadrat,
			bool optimized,
			FirstOrderType type);


  protected:
66
67
68
69
70
71
    /** \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
72
    /// List of all yet created optimized zero order assemblers for grdPsi.
73
74
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi;

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
81
    /// List of all yet created standard zero order assemblers for grdPhi.
82
83
84
85
86
87
88
89
90
91
92
93
94
    static std::vector<SubAssembler*> standardSubAssemblersGrdPhi;
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
101
    /// Implements SubAssembler::calculateElementVector().
102
    void calculateElementVector(const ElInfo *, ElementVector&);
Thomas Witkowski's avatar
Thomas Witkowski committed
103
104
105

  protected:
    const BasisFunction *psi, *phi;
106
107
108
109
110
111
112
113
114
115
116
117
  };


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

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

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

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

    const BasisFunction *psi, *phi;
134
135
136
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
152
    /// Implements SubAssembler::calculateElementVector().
153
    void calculateElementVector(const ElInfo *, ElementVector&);
154
155
  };

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
171
    /// Implements SubAssembler::calculateElementVector().
172
173
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
174
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
175
    }
176
177
178
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
194
    /// Implements SubAssembler::calculateElementVector().
195
    void calculateElementVector(const ElInfo*, ElementVector&);
196
197

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
198
    /// Integral of the product of the derivative of psi and phi.
199
200
    const Q10PsiPhi *q10;

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

    friend class FirstOrderAssembler;
  };


Thomas Witkowski's avatar
Thomas Witkowski committed
208
209
210
211
  /**
   * \ingroup Assembler
   *
   * \brief
212
213
214
215
216
   *  First order assembler for grdPhi using precalculated integrals
   */
  class Pre01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
217
    /// Constructor.
218
219
    Pre01(Operator *op, Assembler *assembler, Quadrature *quad);

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

Thomas Witkowski's avatar
Thomas Witkowski committed
223
    /// Implements SubAssembler::calculateElementVector().
224
225
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
226
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
227
    }
228
229

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
230
    /// Integral of the product of psi and the derivative of phi.
231
232
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
233
    /// Integral of the derivative of phi.
234
235
236
237
238
239
240
241
242
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H