DirichletBC.h 3.85 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
25
26
// ==                                                                        ==
// ============================================================================

/** \file DirichletBC.h */

#ifndef AMDIS_DIRICHLETBC_H
#define AMDIS_DIRICHLETBC_H

#include "BoundaryCondition.h"
#include "AbstractFunction.h"
27
#include "AMDiS_fwd.h"
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

namespace AMDiS {

  /**
   * \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:
43
    /// Constructor.
44
    DirichletBC(BoundaryType type,
45
		AbstractFunction<double, WorldVector<double> > *fct,
46
		FiniteElemSpace *rowFESpace,
47
48
		FiniteElemSpace *colFESpace = NULL,
		bool apply = true);
49

50
    /// Constructor.
51
    DirichletBC(BoundaryType type,
52
53
		DOFVectorBase<double> *vec,
		bool apply = true);
54

55
    /// Implementation of BoundaryCondition::fillBoundaryCondition().
56
57
    void fillBoundaryCondition(DOFMatrix* matrix,
			       ElInfo* elInfo,
58
			       const DegreeOfFreedom* dofIndices,
59
60
			       const BoundaryType* localBound,
			       int nBasFcts);
61
  
62
    /// Implementation of BoundaryCondition::fillBoundaryCondition().
63
64
    void fillBoundaryCondition(DOFVectorBase<double>* vector, 
			       ElInfo* elInfo,
65
			       const DegreeOfFreedom* dofIndices,
66
67
			       const BoundaryType* localBound,
			       int nBasFcts);
68

69
    /// Implementation of BoundaryCondition::boundResidual().
70
71
    double boundResidual(ElInfo*, 
			 DOFMatrix *,
72
73
74
75
			 const DOFVectorBase<double>*) 
    { 
      return 0.0; 
    }
76

77
78
79
    /// Because this is a Dirichlet boundary condition, always return true.
    bool isDirichlet() 
    { 
80
81
      return true; 
    }
82

83
84
85
86
87
88
89
90
    /// Returns \ref applyBC.
    bool applyBoundaryCondition() 
    {
      return applyBC;
    }

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

94
95
    inline DOFVectorBase<double> *getDOFVector() 
    {
96
      return dofVec;
97
    }
98
99

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

103
    ///
104
105
    std::vector<WorldVector<double> > worldCoords;

106
    /// DOFVector containing the boundary values
107
    DOFVectorBase<double> *dofVec;
108
109
110
111
112
113

    /** \brief
     * Defines, if the boundary condition must be applied to the matrix. See
     * comment of \ref BoundaryCondition::applyBoundaryCondition.
     */
    bool applyBC;
114
115
116
117
118
  };

}

#endif