RefinementManager.h 4.06 KB
Newer Older
1
2
3
4
5
6
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
7
// ==  TU Dresden                                                            ==
8
// ==                                                                        ==
9
10
11
// ==  Institut fr Wissenschaftliches Rechnen                               ==
// ==  Zellescher Weg 12-14                                                  ==
// ==  01069 Dresden                                                         ==
12
13
14
15
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
16
// ==  https://gforge.zih.tu-dresden.de/projects/amdis/                      ==
17
18
19
20
21
22
23
24
25
26
// ==                                                                        ==
// ============================================================================

/** \file RefinementManager.h */

#ifndef AMDIS_REFINEMENTMANAGER_H
#define AMDIS_REFINEMENTMANAGER_H

#include "Global.h"
#include "Flag.h"
27
#include "AMDiS_fwd.h"
28
29
30
31
32
33
34
35
36
37
38
39

namespace AMDiS {

  /** \ingroup Adaption 
   * \brief
   * Base class of RefinementManager1d, RefinementManager2d, RefinementManager3d.
   * A RefinementManager contains all functionality to perform refinement
   * operations on the mesh.
   */
  class RefinementManager
  {
  public:
40
    /// Constructs a RefinementManager which belongs to aMesh 
41
    RefinementManager()
42
43
      : mesh(NULL), 
	newCoords(false),
44
	stack(NULL)
45
    {}
46

47
48
    /// Destructor
    virtual ~RefinementManager() {}
49
50
51
52
53

    /** \brief
     * Generates new coordinates on curved boundaries. Can be overriden by
     * sub classes if used.
     */
54
    virtual void setNewCoords(int macroEl = -1) 
55
    {
56
57
      FUNCNAME("RefinementManager::setNewCoords");
      ERROR_EXIT("called for base class!\n");
58
    }
59
60
61
62
63
64
65
66
67
68

    /** \brief
     * Fulfills the refinement for all positive marked elements of the mesh.
     * The default implementation of the base class uses \ref refineFunction
     * for the refinement of a single element while traversing the mesh.
     * Sub classes can overload refineMesh and/or refineFunction to implement
     * their own refinement routines. 
     */
    virtual Flag refineMesh(Mesh *aMesh);

69
    void refineMacroElement(Mesh *amesh, int macroElIndex);
70

71
    /// All elements of the mesh will be refined.
72
73
    Flag globalRefine(Mesh *aMesh, int mark);

74
    /// Set \ref newCoords
75
76
    inline void newCoord(bool nc) 
    { 
77
      newCoords = nc; 
78
    }
79

80
81
    inline bool newCoord() 
    { 
82
      return newCoords; 
83
    }
84
85
86
87
88

    /** \brief
     * Implements the refinement of el_info->el. Can be overriden by sub
     * classes if used.
     */
89
90
    virtual ElInfo* refineFunction(ElInfo*) 
    {
91
      FUNCNAME("RefinementManager::refineFunction()");
92
93
      ERROR_EXIT("called for base class!\n");
      return NULL;
94
    }
95

96
97
    inline void setMesh(Mesh *m) 
    {
98
      mesh = m;
99
    }
100

101
102
    inline void setStack(TraverseStack *s) 
    {
103
      stack = s; 
104
    }
105

106
107
    inline TraverseStack *getStack() 
    { 
108
      return stack; 
109
    }
110
111

  protected:
112
    /// The Mesh to be refined
113
114
    Mesh *mesh;

115
    /// Number of new vertices on a boundary edge
116
117
    bool newCoords;

118
    /// Still more refinement to do?
119
120
    static bool doMoreRecursiveRefine;

121
    /// Number of DOFVectors which must be interpolated during refinement
122
123
    static int callRefineInterpol;
  
124
    /// Used for non recursive traversal
125
126
127
128
129
130
131
132
133
134
    TraverseStack* stack;
  };

}

#include "RefinementManager1d.h"
#include "RefinementManager2d.h"
#include "RefinementManager3d.h"

#endif // AMDIS_REFINEMENTMANAGER_H