CoarseningManager.h 3.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
 * 
 ******************************************************************************/
20
21


22
23
24
25
26
27
28
29
30

/** \file CoarseningManager.h */

#ifndef AMDIS_COARSENINGMANAGER_H
#define AMDIS_COARSENINGMANAGER_H

#include "Global.h"
#include "Mesh.h"
#include "ProblemStatBase.h"
31
#include "AMDiS_fwd.h"
32
33
34
35
36
37
38
39
40
41
42
43

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:
44
    /// Constructs a CoarseningManager which belongs to aMesh 
45
    CoarseningManager() 
46
47
      : mesh(nullptr), 
	stack(nullptr), 
48
49
	doMore(0) 
    {}
50

51
52
    /// destructor
    virtual ~CoarseningManager() {}
53

54
    /// Returns the Mesh the CoarseningManager belongs to.
Thomas Witkowski's avatar
Thomas Witkowski committed
55
56
57
58
    inline Mesh* getMesh() 
    { 
      return mesh; 
    }
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

    /** \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:
77
78
    /// Defines the way how one element of the mesh is coarsen.
    virtual void coarsenFunction(ElInfo *) {}
79
80
81
82
83
84
85
86
87
88

    /** \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();

89
    /// Resets the element marks
90
91
92
    void cleanUpAfterCoarsen();

  protected:
93
94
    /// The Mesh this CoarseningManager belongs to.
    Mesh *mesh;
95

96
    /// Used for non recursive mesh traversal.
97
98
    TraverseStack *stack;

99
    /// Spezifies whether the coarsening operation is still in progress
100
101
    bool doMore;

102
    /// Spezifies how many DOFVectors should restricted while coarsening
103
104
105
106
107
108
109
110
111
112
113
114
    int callCoarseRestrict;

    friend class RCNeighbourList;
  };

}

#include "CoarseningManager1d.h"
#include "CoarseningManager2d.h"
#include "CoarseningManager3d.h"

#endif // AMDIS_COARSENINGMANAGER_H