Newer
Older
// ============================================================================
// == ==
// == AMDiS - Adaptive multidimensional simulations ==
// == ==

Thomas Witkowski
committed
// == http://www.amdis-fem.org ==
// == ==
// ============================================================================

Thomas Witkowski
committed
//
// 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 BoundaryCondition.h */
#ifndef AMDIS_BOUNDARYCONDITION_H
#define AMDIS_BOUNDARYCONDITION_H
#include "Boundary.h"
#include "FiniteElemSpace.h"
#include "AMDiS_fwd.h"
namespace AMDiS {
/**
* \ingroup Assembler
*
* \brief
* Sub class of BoundaryCondition. Local boundary conditions are filled
* while mesh traversal.
*/
class BoundaryCondition
/// Constructor.
BoundaryCondition(BoundaryType type,
const FiniteElemSpace *rowFeSpace_,
const FiniteElemSpace *colFeSpace_ = NULL)
rowFeSpace(rowFeSpace_),
colFeSpace(colFeSpace_)
if (!colFeSpace)
colFeSpace = rowFeSpace;
/// Returns \ref boundaryType.
inline BoundaryType getBoundaryType()
{
return boundaryType;
}
/// Returns \ref rowFeSpace.
inline const FiniteElemSpace *getRowFeSpace()
return rowFeSpace;
/// Returns \ref rowFeSpace.
inline const FiniteElemSpace *getColFeSpace()
return colFeSpace;
virtual void initMatrix(DOFMatrix*) {}
virtual void exitMatrix(DOFMatrix*) {}
virtual void initVector(DOFVectorBase<double>*) {}
virtual void exitVector(DOFVectorBase<double>*) {}
/// Destructor.
virtual ~BoundaryCondition() {}
/** \brief
* Adds the local boundary condition for elInfo to object.
* The dofIndices and localBound as well as nBasFcts are determined by
* the calling BoundaryManager.
*/
virtual void fillBoundaryCondition(DOFMatrix *matrix,
ElInfo *elInfo,
const DegreeOfFreedom *dofIndices,
const BoundaryType *localBound,
int nBasFcts) {}
/** \brief
* Adds the local boundary condition for elInfo to vector.
* The dofIndices and localBound as well as nBasFcts are determined by
* the calling BoundaryManager.
*/
virtual void fillBoundaryCondition(DOFVectorBase<double> *vector,
ElInfo *elInfo,
const DegreeOfFreedom *dofIndices,
const BoundaryType *localBound,
int nBasFcts) {}
/// Returns the boundary residual for the given element. Called by estimator.
virtual double boundResidual(ElInfo *elInfo,
DOFMatrix *matrix,
const DOFVectorBase<double> *dv)
{
return 0.0;
}
* Returns whether the condition must be treated as Dirichlet condition
* while assemblage.
*/
virtual bool isDirichlet()
{
return false;
}
/// Returns whether the boundary condition is a periodic condition or not.
virtual bool isPeriodic()
{
return false;
}
/** \brief
* In some situations it may be required to set Dirichlet boundary conditions,
* but not to apply them to the matrix. This is for example the case, if the
* boundary condition is set to a couple matrix. Then, the boundary conditions
* must be applied to the couple matrix, but they are set to all matrices in this
* row (to ensure that there are no other element entries in the Dirichlet boundary
* condition rows).
*/
virtual bool applyBoundaryCondition()
{
return true;
}
protected:
/** \brief
* Speciefies for which parts of the boundary the condition holds.
* This id corresponds to the boundary numbers spcified in the
* macro file.
*/
BoundaryType boundaryType;
/// FiniteElemSpace for this BoundaryCondition.
const FiniteElemSpace *rowFeSpace;
/// FiniteElemSpace for this BoundaryCondition.
const FiniteElemSpace *colFeSpace;
};
}
#endif