BoundaryCondition.h 4.9 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
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file BoundaryCondition.h */

#ifndef AMDIS_BOUNDARYCONDITION_H
#define AMDIS_BOUNDARYCONDITION_H

#include "Boundary.h"
#include "FiniteElemSpace.h"

namespace AMDiS {

  class DOFMatrix;
  template<typename T> class DOFVectorBase;
  class Estimator;
  class ElInfo;

  // ============================================================================
  // ===== class BoundaryCondition ==============================================
  // ============================================================================

  /**
   * \ingroup Assembler
   *
   * \brief
   * Sub class of BoundaryCondition. Local boundary conditions are filled
   * while mesh traversal.
   */
  class BoundaryCondition //: public BoundaryCondition
  {
  public:
    /** \brief
     * Constructor.
     */
    BoundaryCondition(BoundaryType type, 
		      const FiniteElemSpace *rowFESpace_,
		      const FiniteElemSpace *colFESpace_ = NULL) 
      : boundaryType(type),
	rowFESpace(rowFESpace_),
	colFESpace(colFESpace_)
    {
59
60
      if (!colFESpace) 
	colFESpace = rowFESpace;
61
62
63
64
65
    };

    /** \brief
     * Returns \ref boundaryType.
     */
66
67
68
    inline BoundaryType getBoundaryType() { 
      return boundaryType; 
    };
69
70
71
72

    /** \brief
     * Returns \ref rowFESpace.
     */
73
74
75
    inline const FiniteElemSpace *getRowFESpace() { 
      return rowFESpace; 
    };
76
77
78
79

    /** \brief
     * Returns \ref rowFESpace.
     */
80
81
82
    inline const FiniteElemSpace *getColFESpace() { 
      return colFESpace; 
    };
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

    virtual void initMatrix(DOFMatrix*) {};

    virtual void exitMatrix(DOFMatrix*) {};

    virtual void initVector(DOFVectorBase<double>*) {};

    virtual void exitVector(DOFVectorBase<double>*) {};

    /** \brief
     * Destructor.
     */
    virtual ~BoundaryCondition() {};

    /** \brief
     * Adds the local boundary condition for elInfo to object.
     * The dofIndices and localBound as well as nBasFcts are determined by
     * the calling BoundaryManager.
     */
    virtual void fillBoundaryCondition(DOFMatrix             *matrix,
				       ElInfo                *elInfo,
				       const DegreeOfFreedom *dofIndices,
				       const BoundaryType    *localBound,
				       int                    nBasFcts) {};
  
    /** \brief
     * Adds the local boundary condition for elInfo to vector.
     * The dofIndices and localBound as well as nBasFcts are determined by
     * the calling BoundaryManager.
     */
    virtual void fillBoundaryCondition(DOFVectorBase<double>     *vector, 
				       ElInfo                *elInfo,
				       const DegreeOfFreedom *dofIndices,
				       const BoundaryType    *localBound,
				       int                    nBasFcts) {};
  
    /** \brief
     * Returns the boundary residual for the given element. Called by estimator.
     */
    virtual double boundResidual(ElInfo *elInfo, 
				 DOFMatrix *matrix,
				 const DOFVectorBase<double> *dv) { return 0.0; };

    /** \brief
     * Returns whether the condition must be treated as dirichlet condition
     * while assemblage.
     */
130
131
132
    virtual bool isDirichlet() { 
      return false; 
    };
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

  protected:
    /** \brief
     * Speciefies for which parts of the boundary the condition holds.
     * This id corresponds to the boundary numbers spcified in the
     * macro file. 
     */
    BoundaryType boundaryType;

    /** \brief
     * FiniteElemSpace for this BoundaryCondition.
     */
    const FiniteElemSpace *rowFESpace;

    /** \brief
     * FiniteElemSpace for this BoundaryCondition.
     */
    const FiniteElemSpace *colFESpace;
  };

}

#endif