FirstOrderAssembler.h 6.37 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
#include "SubAssembler.h"

namespace AMDiS {

  /**
   * \ingroup Assembler
   * 
   * \brief
   * SubAssembler for first order terms.
   */
  class FirstOrderAssembler : public SubAssembler
  {
  public:
40
41
42
43
44
    /// 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.
45
46
47
48
49
50
    static FirstOrderAssembler* getSubAssembler(Operator *op,
						Assembler *assembler,
						Quadrature *quadrat,
						FirstOrderType type,
						bool optimized);
  
Thomas Witkowski's avatar
Thomas Witkowski committed
51
52
    /// Destructor.
    virtual ~FirstOrderAssembler() {}
53
54

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


  protected:
64
65
    /// Vector of DimMats for calculation in function calculateElementMatrix().
    std::vector<mtl::dense_vector<double> > Lb;
66

Thomas Witkowski's avatar
Thomas Witkowski committed
67
    /// List of all yet created optimized zero order assemblers for grdPsi.
68
69
    static std::vector<SubAssembler*> optimizedSubAssemblersGrdPsi;

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
76
    /// List of all yet created standard zero order assemblers for grdPhi.
77
78
79
80
81
82
83
84
85
86
87
88
89
    static std::vector<SubAssembler*> standardSubAssemblersGrdPhi;
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
96
    /// Implements SubAssembler::calculateElementVector().
97
    void calculateElementVector(const ElInfo *, ElementVector&);
Thomas Witkowski's avatar
Thomas Witkowski committed
98
99
100

  protected:
    const BasisFunction *psi, *phi;
101
102
103
104
105
106
107
108
109
110
111
112
  };


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

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

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

  protected:
126
    vector<mtl::dense_vector<double> > grdPhi;
Thomas Witkowski's avatar
Thomas Witkowski committed
127
128

    const BasisFunction *psi, *phi;
129
130
131
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
147
    /// Implements SubAssembler::calculateElementVector().
148
    void calculateElementVector(const ElInfo *, ElementVector&);
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 grdPhi using fast quadratures.
   */
  class Quad01 : public FirstOrderAssembler 
  {
  public:
Thomas Witkowski's avatar
Thomas Witkowski committed
160
    /// Constructor.
161
162
    Quad01(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
168
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
169
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
170
    }
171
172
173
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
189
    /// Implements SubAssembler::calculateElementVector().
190
    void calculateElementVector(const ElInfo*, ElementVector&);
191
192

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
193
    /// Integral of the product of the derivative of psi and phi.
194
195
    const Q10PsiPhi *q10;

Thomas Witkowski's avatar
Thomas Witkowski committed
196
    /// Integral of the derivative of psi.
197
198
199
200
201
202
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
218
    /// Implements SubAssembler::calculateElementVector().
219
220
    void calculateElementVector(const ElInfo*, ElementVector&) 
    {
221
      ERROR_EXIT("should not be called\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
222
    }
223
224

  protected:
Thomas Witkowski's avatar
Thomas Witkowski committed
225
    /// Integral of the product of psi and the derivative of phi.
226
227
    const Q01PsiPhi *q01;

Thomas Witkowski's avatar
Thomas Witkowski committed
228
    /// Integral of the derivative of phi.
229
230
231
232
233
234
235
236
237
    const Q1Psi *q1;

    friend class FirstOrderAssembler;
  };


}

#endif // AMDIS_FIRST_ORDER_ASSEMBLER_H