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 5.62 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// ============================================================================
// ==                                                                        ==
// == 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

// ============================================================================
// ===== includes =============================================================
// ============================================================================

#include "Global.h"
#include "Mesh.h"
#include "ProblemStatBase.h"

namespace AMDiS {

  // ============================================================================
  // ===== forward declarations =================================================
  // ============================================================================

  class Element;
  class Line;
  class Triangle;
  class Tetrahedron;
  class RCNeighbourList;
  class ElInfo;
  class TraverseStack;

  // ============================================================================
  // ===== class CoarseningManager ==============================================
  // ============================================================================

  /** \ingroup Adaption
   * \brief
   * Base class of CoarseningManager1d, CoarseningManager2d, CoarseningManager3d.
   * A CoarseningManager contains all functionality to perform coarsening
   * operations on the mesh. 
   */
  class CoarseningManager
  {
  public:
    /** \brief
     * constructs a CoarseningManager which belongs to aMesh 
     */
    CoarseningManager() 
      : mesh(NULL),  stack(NULL), globalMark(0), doMore(0) 
    {};

    /** \brief
     * destructor
     */
    virtual ~CoarseningManager() {};

    /** \brief
     * Returns the Mesh the CoarseningManager belongs to.
     */
    inline Mesh* getMesh() { return mesh; };

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

    /** \brief
     * Used while traversal in spreadCoarsenMark
     */
    static int spreadCoarsenMarkFunction(ElInfo* el_info);

    /** \brief
     *Used while traversal in cleanUpAfterCoarsen
     */
    static int cleanUpAfterCoarsenFunction(ElInfo* el_info);

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

    /** \brief
     * Resets the element marks
     */
    void cleanUpAfterCoarsen();

  protected:
    /** \brief
     * the Mesh this CoarseningManager belongs to
     */
    Mesh   *mesh;

    /** \brief
     * Used for non recursive mesh traversal.
     */
    TraverseStack *stack;

    /** \brief
     * Used by globalCoarsen to remember the given mark value
     */
    int  globalMark;

    /** \brief
     * Spezifies whether the coarsening operation is still in progress
     */
    bool doMore;

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

    /** \brief
     * 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