DirichletBC.h 3.83 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);

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

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

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

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

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

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

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

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

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

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

}

#endif