DualTraverse.h 4.32 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
// ============================================================================
// ==                                                                        ==
// == AMDiS - Adaptive multidimensional simulations                          ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  crystal growth group                                                  ==
// ==                                                                        ==
// ==  Stiftung caesar                                                       ==
// ==  Ludwig-Erhard-Allee 2                                                 ==
// ==  53175 Bonn                                                            ==
// ==  germany                                                               ==
// ==                                                                        ==
// ============================================================================
// ==                                                                        ==
// ==  http://www.caesar.de/cg/AMDiS                                         ==
// ==                                                                        ==
// ============================================================================

/** \file DualTraverse.h */

#ifndef AMDIS_DUALTRAVERSE_H
#define AMDIS_DUALTRAVERSE_H

#include "Traverse.h"
#include "Flag.h"
27
#include "AMDiS_fwd.h"
28
29
30

namespace AMDiS {

31
  /// Parallel traversal of two meshes. 
32
33
34
  class DualTraverse
  {
  public:
35
    DualTraverse() 
36
37
      : fillSubElemMat(false),
	basisFcts(NULL)
38
    {}
39

40
    virtual ~DualTraverse() {}
41

42
    /// Start dual traversal
43
44
45
46
47
48
    bool traverseFirst(Mesh *mesh1, 
		       Mesh *mesh2, 
		       int level1, 
		       int level2, 
		       Flag flag1,
		       Flag flag2,
49
50
51
52
53
		       ElInfo **elInfo1,
		       ElInfo **elInfo2,
		       ElInfo **elInfoSmall,
		       ElInfo **elInfoLarge);

54
    /// Get next ElInfo combination
55
56
57
58
59
    bool traverseNext(ElInfo **elInfoNext1,
		      ElInfo **elInfoNext2,
		      ElInfo **elInfoSmall,
		      ElInfo **elInfoLarge);

60
61
62
63
    bool check(ElInfo **elInfo1,
	       ElInfo **elInfo2,
	       ElInfo **elInfoSmall,
	       ElInfo **elInfoLarge) 
64
65
66
    {
      prepareNextStep(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
      return true;
67
    }
Naumann, Andreas's avatar
Naumann, Andreas committed
68
69
    
    virtual bool skipEl1(ElInfo *elInfo) {
70
71
      return false;
    }
Naumann, Andreas's avatar
Naumann, Andreas committed
72
73

    virtual bool skipEl2(ElInfo *elInfo) {
74
75
      return false;
    }
Naumann, Andreas's avatar
Naumann, Andreas committed
76
    
77
    inline void setFillSubElemMat(bool b, const BasisFunction *fcts) {
78
      fillSubElemMat = b;
79
      basisFcts = fcts;
80
81
    }
      
82
83
84
85
86
87
88
89
90
91
  protected:
    /** \brief
     * Determines smaller and larger element, determines which element(s) has to 
     * be incremented in the next step 
     */
    void prepareNextStep(ElInfo **elInfo1,
			 ElInfo **elInfo2,
			 ElInfo **elInfoSmall,
			 ElInfo **elInfoLarge);

92
93
94
95
96
    void fillSubElInfo(ElInfo *elInfo1, 
		       ElInfo *elInfo2,
		       ElInfo *elInfoSmall,
		       ElInfo *elInfoLarge);

97
  protected:
98
    /// Stack for mesh 1
99
100
    TraverseStack stack1;

101
    /// Stack for mesh 2
102
103
104
105
106
107
    TraverseStack stack2;

    /** \brief
     * used to determine whether all small elements belonging to the large
     * element are traversed.
     */
108
    double rest;
109

110
    /// true if element 1 should be incremented (set in prepareNextStep())
111
    bool inc1;
112

113
    /// true if element 2 should be incremented (set in prepareNextStep())
114
    bool inc2;
115

116
    /// for level traverse of mesh 1
117
118
    int level1_;

119
    /// for level traverse of mesh 2
120
121
    int level2_;

122
    /// for leaf element level traverse of mesh 1
123
124
    bool callLeafElLevel1_;

125
    /// for leaf element level traverse of mesh 2
126
    bool callLeafElLevel2_;
127

128
129
130
131
132
133
    /** \brief
     * If true, during dual mesh traverse for the smaller element the transformation
     * matrix will be computed. This matrix defines the transformation mapping for 
     * points defined on the larger element to the coordinates of the smaller element.
     */
    bool fillSubElemMat;
134
135
136
137
138
139

    /** \brief
     * If \ref fillSubElemMat is set to true, the corresponding transformation
     * matrices are computed. These depend on the basis functions that are used.
     */
    const BasisFunction *basisFcts;
140
141
142
143
144
145
  };

}

#endif