SubElementAssembler.h 4.17 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
23
24
25
26
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/** \file SubElementAssembler.h */

#ifndef AMDIS_SUBELEMENTASSEMBLER_H
#define AMDIS_SUBELEMENTASSEMBLER_H

#include "MemoryManager.h"
#include "Assembler.h"
#include "SubElInfo.h"

#include "ScalableQuadrature.h"

class SubPolytope;

using namespace AMDiS;
using namespace std;

// ============================================================================
// ===== class SubElementAssembler ============================================
// ============================================================================
//
// Class Desription:
// The class \ref SubElementAssembler holds the routines for the assemblage on
// subpolytopes and subelements.
// The integration on a subpolytope takes place by integrating on the 
// subelements and afterwards summing up the results.
// If S' is a sublement and S the element containing S', the numerical integration
// on S' is done by integration on the element S with a manipulated quadrature 
// formula and multiplication of the result with a correction term consisting of
// the determinants corresponding to S and S'. That means, the quadrature points
// are manipulated in the following way:
// The original quadrature formula holds quadrature points which are given in
// barycentric coordinates with respect to S'. Now we express these quadrature 
// points in barycentric coordinates with respect to S and obtain the manipulated
// quadrature points we need. Obviously, the corresponding quadrature points 
// in world coordinates coincide. Thus the numerical integration on S with the
// manipulated quadrature formula gives us the same result as the numerical
// integration on S' with the original quadrature formula up to the determinant.
// This method for integration on subelements allows the reuse of the routines for
// the integration on elements.
//
// The manipulation of the quadrature formula takes place for the corresponding
// assembler type (ZeroOrderAssembler, FirstOrderAssemblerGrdPsi, ...).
//
// Main routines:
// SubElementAssembler()  - Creates a scalable quadrature for the appropriate
//                          assembler type and assigns this quadrature to the 
//                          assembler.
// scaleQuadratures()     - Manipulates the scalable quadrature of the 
//                          appropriate assembler type with respect to a 
//                          subelement.
// getSubPolytopeVector() - Calculates the righthandside vector for a polytope.
// getSubPolytopeMatrix() - Calculates the system matrix for a polytope.
// getSubElementVector()  - Calculates the righthandside vector for a subelement.
// getSubElementMatrix()  - Calculates the system matrix for a subelement.
// ============================================================================
class SubElementAssembler : public StandardAssembler
{
 public:
  MEMORY_MANAGED(SubElementAssembler);

  SubElementAssembler(Operator *op, 
		      const FiniteElemSpace *rowFESpace_,
		      const FiniteElemSpace *colFESpace_=NULL);

  virtual ~SubElementAssembler()
  {
    if (zeroOrderScalableQuadrature)
      DELETE zeroOrderScalableQuadrature;
    if (firstOrderGrdPsiScalableQuadrature)
      DELETE firstOrderGrdPsiScalableQuadrature;
    if (firstOrderGrdPhiScalableQuadrature)
      DELETE firstOrderGrdPhiScalableQuadrature;
    if (secondOrderScalableQuadrature) 
      DELETE secondOrderScalableQuadrature;
  };

  void scaleQuadratures(const SubElInfo& subElInfo);

  void getSubElementVector(SubElInfo *subElInfo, 
			   const ElInfo *elInfo, 
			   ElementVector *userVec);

  void getSubElementMatrix(SubElInfo *subElInfo, 
			   const ElInfo *elInfo, 
			   ElementMatrix *userMat);

  void getSubPolytopeVector(SubPolytope *subPolytope,
			    SubElementAssembler *subElementAssembler,
			    const ElInfo *elInfo,
			    ElementVector *userVec);

  void getSubPolytopeMatrix(SubPolytope *subPolytope,
			    SubElementAssembler *subElementAssembler,
			    const ElInfo *elInfo,
			    ElementMatrix *userMat);

protected:
  ScalableQuadrature *zeroOrderScalableQuadrature;
  ScalableQuadrature *firstOrderGrdPsiScalableQuadrature;
  ScalableQuadrature *firstOrderGrdPhiScalableQuadrature;
  ScalableQuadrature *secondOrderScalableQuadrature;
};

#endif  // AMDIS_SUBELEMENTASSEMBLER_H