// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // == http://www.amdis-fem.org == // == == // ============================================================================ // // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. /** \file DirichletBC.h */ #ifndef AMDIS_DIRICHLETBC_H #define AMDIS_DIRICHLETBC_H #include "AMDiS_fwd.h" #include "BoundaryCondition.h" #include "AbstractFunction.h" #include "FixVec.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<double, WorldVector<double> > *fct, FiniteElemSpace *rowFeSpace, FiniteElemSpace *colFeSpace = NULL, bool apply = true); /// Constructor. DirichletBC(BoundaryType type, DOFVectorBase<double> *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<double>* vector, ElInfo* elInfo, const DegreeOfFreedom* dofIndices, const BoundaryType* localBound, int nBasFcts); /// Implementation of BoundaryCondition::boundResidual(). double boundResidual(ElInfo*, DOFMatrix *, const DOFVectorBase<double>*) { 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<double, WorldVector<double> > *getF() { return f; } inline DOFVectorBase<double> *getDOFVector() { return dofVec; } protected: /// Function which is evaluated at world coords of Dirichlet dofs. AbstractFunction<double, WorldVector<double> > *f; /// WorldVector<double> worldCoords; /// DOFVector containing the boundary values DOFVectorBase<double> *dofVec; /** \brief * Defines, if the boundary condition must be applied to the matrix. See * comment of \ref BoundaryCondition::applyBoundaryCondition. */ bool applyBC; }; } #endif