Skip to content
Snippets Groups Projects
BoundaryCondition.h 4.46 KiB
Newer Older
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ==                                                                        ==
// ============================================================================
//
// 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"

namespace AMDiS {

  /**
   * \ingroup Assembler
   *
   * \brief
   * Sub class of BoundaryCondition. Local boundary conditions are filled
   * while mesh traversal.
   */
    BoundaryCondition(BoundaryType type, 
		      const FiniteElemSpace *rowFeSpace_,
		      const FiniteElemSpace *colFeSpace_ = NULL) 
      : boundaryType(type),
	rowFeSpace(rowFeSpace_),
	colFeSpace(colFeSpace_)
      if (!colFeSpace) 
	colFeSpace = rowFeSpace;
    inline BoundaryType getBoundaryType() 
    { 
    /// Returns \ref rowFeSpace.
    inline const FiniteElemSpace *getRowFeSpace() 
    /// Returns \ref rowFeSpace.
    inline const FiniteElemSpace *getColFeSpace() 
    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,
  
    /** \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,
    /// 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() 
    { 
    /// 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.
    /// FiniteElemSpace for this BoundaryCondition.