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.54 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
53
    /// Returns the Mesh the CoarseningManager belongs to.
    inline Mesh* getMesh() { return mesh; }
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

    /** \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. 
     */
    virtual int coarsenFunction(ElInfo *) { return 0; };

    /** \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
    /// Used while traversal in spreadCoarsenMark
90
91
    static int spreadCoarsenMarkFunction(ElInfo* el_info);

92
    /// Used while traversal in cleanUpAfterCoarsen
93
94
    static int cleanUpAfterCoarsenFunction(ElInfo* el_info);

95
    /// Sets the mark on all elements that have to be coarsend 
96
97
    static int coarsenMarkFunction(ElInfo *el_info);

98
    /// Resets the element marks
99
100
101
    void cleanUpAfterCoarsen();

  protected:
102
103
    /// The Mesh this CoarseningManager belongs to.
    Mesh *mesh;
104

105
    /// Used for non recursive mesh traversal.
106
107
    TraverseStack *stack;

108
109
    /// Used by globalCoarsen to remember the given mark value
    int globalMark;
110

111
    /// Spezifies whether the coarsening operation is still in progress
112
113
114
115
116
117
118
119
    bool doMore;

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

120
    /// Spezifies how many DOFVectors should restricted while coarsening
121
122
123
124
125
126
127
128
129
130
131
132
    int callCoarseRestrict;

    friend class RCNeighbourList;
  };

}

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

#endif // AMDIS_COARSENINGMANAGER_H