// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == TU Dresden == // == == // == Institut für Wissenschaftliches Rechnen == // == Zellescher Weg 12-14 == // == 01069 Dresden == // == germany == // == == // ============================================================================ // == == // == https://gforge.zih.tu-dresden.de/projects/amdis/ == // == == // ============================================================================ /** \file DirichletBC.h */ #ifndef AMDIS_DIRICHLETBC_H #define AMDIS_DIRICHLETBC_H #include "BoundaryCondition.h" #include "AbstractFunction.h" #include "AMDiS_fwd.h" 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: /// Constructor. DirichletBC(BoundaryType type, AbstractFunction > *fct, FiniteElemSpace *rowFESpace, FiniteElemSpace *colFESpace = NULL, bool apply = true); /// Constructor. DirichletBC(BoundaryType type, DOFVectorBase *vec, bool apply = true); /// Implementation of BoundaryCondition::fillBoundaryCondition(). void fillBoundaryCondition(DOFMatrix* matrix, ElInfo* elInfo, const DegreeOfFreedom* dofIndices, const BoundaryType* localBound, int nBasFcts); /// Implementation of BoundaryCondition::fillBoundaryCondition(). void fillBoundaryCondition(DOFVectorBase* vector, ElInfo* elInfo, const DegreeOfFreedom* dofIndices, const BoundaryType* localBound, int nBasFcts); /// Implementation of BoundaryCondition::boundResidual(). double boundResidual(ElInfo*, DOFMatrix *, const DOFVectorBase*) { return 0.0; } /// Because this is a Dirichlet boundary condition, always return true. bool isDirichlet() { return true; } /// Returns \ref applyBC. bool applyBoundaryCondition() { return applyBC; } inline AbstractFunction > *getF() { return f; } inline DOFVectorBase *getDOFVector() { return dofVec; } protected: /// Function which is evaluated at world coords of Dirichlet dofs. AbstractFunction > *f; /// std::vector > worldCoords; /// DOFVector containing the boundary values DOFVectorBase *dofVec; /** \brief * Defines, if the boundary condition must be applied to the matrix. See * comment of \ref BoundaryCondition::applyBoundaryCondition. */ bool applyBC; }; } #endif