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 CoarseningManager.h */
#ifndef AMDIS_COARSENINGMANAGER_H
#define AMDIS_COARSENINGMANAGER_H
#include "Global.h"
#include "Mesh.h"
#include "ProblemStatBase.h"
#include "AMDiS_fwd.h"
namespace AMDiS {
/** \ingroup Adaption
* \brief
* Base class of CoarseningManager1d, CoarseningManager2d, CoarseningManager3d.
* A CoarseningManager contains all functionality to perform coarsening
* operations on the mesh.
*/
class CoarseningManager
{
public:
/// Constructs a CoarseningManager which belongs to aMesh
: mesh(NULL),
stack(NULL),
doMore(0)
{}
/// destructor
virtual ~CoarseningManager() {}
/// Returns the Mesh the CoarseningManager belongs to.
/** \brief
* Tries to coarsen every element of mesh at least mark times. First
* all elements are marked for coarsening and then coarsenMesh will
* be called.
*/
Flag globalCoarsen(Mesh *aMesh, int mark);
/** \brief
* Traversal routine for recursiv coarsening of a triangulation. It has
* a default definition in CoarseningManager but it can be overriden
* by sub classes (like in CoarseningManager1d), if another implementation
* is needed.
*/
virtual Flag coarsenMesh(Mesh *aMesh);
protected:
/// Defines the way how one element of the mesh is coarsen.
virtual void coarsenFunction(ElInfo *) {}
/** \brief
* Propagate coarsening information over the whole hierarchy
* by POSTORDER traversal of the hierarchy tree.
* leaves: 'increment' coarsening mark,
* inner nodes: set coarsening mark to
* min(0,child[0].mark+1,child[1].mark+1)
*/
void spreadCoarsenMark();
/// Resets the element marks
void cleanUpAfterCoarsen();
protected:
/// The Mesh this CoarseningManager belongs to.
Mesh *mesh;
/// Used for non recursive mesh traversal.
/// Spezifies whether the coarsening operation is still in progress
/// Spezifies how many DOFVectors should restricted while coarsening
int callCoarseRestrict;
friend class RCNeighbourList;
};
}
#include "CoarseningManager1d.h"
#include "CoarseningManager2d.h"
#include "CoarseningManager3d.h"
#endif // AMDIS_COARSENINGMANAGER_H