Am Montag, 13. Mai 2022, finden Wartungsarbeiten am Gitlab-Server (Update auf neue Version statt). Der Dienst wird daher am Montag für einige Zeit nicht verfügbar sein.
On Monday, May 13th 2022, the Gitlab server will be updated. The service will therefore not be accessible for some time on Monday.

CoarseningManager.h 4.57 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file CoarseningManager.h */

#ifndef AMDIS_COARSENINGMANAGER_H
#define AMDIS_COARSENINGMANAGER_H

#include "Global.h"
#include "Mesh.h"
#include "ProblemStatBase.h"
28
#include "AMDiS_fwd.h"
29
30
31
32
33
34
35
36
37
38
39
40

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:
41
    /// Constructs a CoarseningManager which belongs to aMesh 
42
    CoarseningManager() 
43
44
45
46
47
      : mesh(NULL), 
	stack(NULL), 
	globalMark(0), 
	doMore(0) 
    {}
48

49
50
    /// destructor
    virtual ~CoarseningManager() {}
51

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

    /** \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:
    /** \brief
     * If the mesh is coarsened by non recurisive traversal, this method 
     * spezifies
     * how one element of the mesh is coarsened. The method can be overriden
     * by sub classes, if used. 
     */
Thomas Witkowski's avatar
Thomas Witkowski committed
81
82
83
84
    virtual int coarsenFunction(ElInfo *) 
    { 
      return 0; 
    }
85
86
87
88
89
90
91
92
93
94

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

95
    /// Used while traversal in spreadCoarsenMark
96
97
    static int spreadCoarsenMarkFunction(ElInfo* el_info);

98
    /// Used while traversal in cleanUpAfterCoarsen
99
100
    static int cleanUpAfterCoarsenFunction(ElInfo* el_info);

101
    /// Sets the mark on all elements that have to be coarsend 
102
103
    static int coarsenMarkFunction(ElInfo *el_info);

104
    /// Resets the element marks
105
106
107
    void cleanUpAfterCoarsen();

  protected:
108
109
    /// The Mesh this CoarseningManager belongs to.
    Mesh *mesh;
110

111
    /// Used for non recursive mesh traversal.
112
113
    TraverseStack *stack;

114
115
    /// Used by globalCoarsen to remember the given mark value
    int globalMark;
116

117
    /// Spezifies whether the coarsening operation is still in progress
118
119
120
121
122
123
124
125
    bool doMore;

    /** \brief
     * Used while mesh traversal to have a pointer to this CoarseningManager
     * from a static method
     */
    static CoarseningManager* traversePtr;

126
    /// Spezifies how many DOFVectors should restricted while coarsening
127
128
129
130
131
132
133
134
135
136
137
138
    int callCoarseRestrict;

    friend class RCNeighbourList;
  };

}

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

#endif // AMDIS_COARSENINGMANAGER_H