DualTraverse.h 4.33 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
    
Thomas Witkowski's avatar
Thomas Witkowski committed
69
70
    virtual bool skipEl1(ElInfo *elInfo) 
    {
71
72
      return false;
    }
Naumann, Andreas's avatar
Naumann, Andreas committed
73

Thomas Witkowski's avatar
Thomas Witkowski committed
74
75
    virtual bool skipEl2(ElInfo *elInfo) 
    {
76
77
      return false;
    }
Naumann, Andreas's avatar
Naumann, Andreas committed
78
    
Thomas Witkowski's avatar
Thomas Witkowski committed
79
80
    inline void setFillSubElemMat(bool b, const BasisFunction *fcts) 
    {
81
      fillSubElemMat = b;
82
      basisFcts = fcts;
83
84
    }
      
85
86
87
88
89
90
91
92
93
94
  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);

95
96
97
98
99
    void fillSubElInfo(ElInfo *elInfo1, 
		       ElInfo *elInfo2,
		       ElInfo *elInfoSmall,
		       ElInfo *elInfoLarge);

100
  protected:
101
    /// Stack for mesh 1
102
103
    TraverseStack stack1;

104
    /// Stack for mesh 2
105
106
107
108
109
110
    TraverseStack stack2;

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

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

116
    /// true if element 2 should be incremented (set in prepareNextStep())
117
    bool inc2;
118

119
    /// for level traverse of mesh 1
120
121
    int level1_;

122
    /// for level traverse of mesh 2
123
124
    int level2_;

125
    /// for leaf element level traverse of mesh 1
126
127
    bool callLeafElLevel1_;

128
    /// for leaf element level traverse of mesh 2
129
    bool callLeafElLevel2_;
130

131
132
133
134
135
136
    /** \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;
137
138
139
140
141
142

    /** \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;
143
144
145
146
147
148
  };

}

#endif