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

/** \file DirichletBC.h */

#ifndef AMDIS_DIRICHLETBC_H
#define AMDIS_DIRICHLETBC_H

#include "BoundaryCondition.h"
#include "AbstractFunction.h"
27
#include "OpenMP.h"
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

namespace AMDiS {

  template<typename T> class DOFVectorBase;
  class ElInfo;

  // ============================================================================
  // ===== class DirichletBC ==================================================== 
  // ============================================================================

  /**
   * \ingroup Assembler
   *
   * \brief
   * Sub class of BoundaryCondition. Implements Dirichlet boundary conditions.
   * A DOFVectors is set to a given value at a Dirichlet dof and in a DOFMatrix
   * the row corresponding to a Dirichlet dof is replaced by a row containing
   * only a 1.0 in the diagonal.
   */
  class DirichletBC : public BoundaryCondition
  {
  public:
    /** \brief
     * Constructor.
     */
53
    DirichletBC(BoundaryType type,
54
		AbstractFunction<double, WorldVector<double> > *fct,
55
56
		FiniteElemSpace *rowFESpace,
		FiniteElemSpace *colFESpace = NULL);
57
58
59
60

    /** \brief
     * Constructor.
     */
61
    DirichletBC(BoundaryType type,
62
63
64
65
66
		DOFVectorBase<double> *vec);

    /** \brief
     * Implementation of BoundaryCondition::fillBoundaryCondition().
     */
67
68
    void fillBoundaryCondition(DOFMatrix* matrix,
			       ElInfo* elInfo,
69
			       const DegreeOfFreedom* dofIndices,
70
71
			       const BoundaryType* localBound,
			       int nBasFcts);
72
73
74
75
  
    /** \brief
     * Implementation of BoundaryCondition::fillBoundaryCondition().
     */
76
77
    void fillBoundaryCondition(DOFVectorBase<double>* vector, 
			       ElInfo* elInfo,
78
			       const DegreeOfFreedom* dofIndices,
79
80
			       const BoundaryType* localBound,
			       int nBasFcts);
81
82
83
84
85
86

    /** \brief
     * Implementation of BoundaryCondition::boundResidual().
     */
    double boundResidual(ElInfo*, 
			 DOFMatrix *,
87
88
89
			 const DOFVectorBase<double>*) { 
      return 0.0; 
    };
90

91
92
93
    bool isDirichlet() { 
      return true; 
    };
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

    inline AbstractFunction<double, WorldVector<double> > *getF() {
      return f;
    };

    inline DOFVectorBase<double> *getDOFVector() {
      return dofVec;
    };

  protected:
    /** \brief
     * Function which is evaluated at world coords of Dirichlet dofs.
     */
    AbstractFunction<double, WorldVector<double> > *f;

109
110
    std::vector<WorldVector<double> > worldCoords;

111
112
113
114
115
116
117
118
119
    /** \brief
     * DOFVector containing the boundary values
     */
    DOFVectorBase<double> *dofVec;
  };

}

#endif