-
Thomas Witkowski authoredThomas Witkowski authored
DualTraverse.h 4.32 KiB
// ============================================================================
// == ==
// == 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"
#include "AMDiS_fwd.h"
namespace AMDiS {
/// Parallel traversal of two meshes.
class DualTraverse
{
public:
DualTraverse()
: fillSubElemMat(false),
basisFcts(NULL)
{}
virtual ~DualTraverse() {}
/// Start dual traversal
bool traverseFirst(Mesh *mesh1,
Mesh *mesh2,
int level1,
int level2,
Flag flag1,
Flag flag2,
ElInfo **elInfo1,
ElInfo **elInfo2,
ElInfo **elInfoSmall,
ElInfo **elInfoLarge);
/// Get next ElInfo combination
bool traverseNext(ElInfo **elInfoNext1,
ElInfo **elInfoNext2,
ElInfo **elInfoSmall,
ElInfo **elInfoLarge);
bool check(ElInfo **elInfo1,
ElInfo **elInfo2,
ElInfo **elInfoSmall,
ElInfo **elInfoLarge)
{
prepareNextStep(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
return true;
}
virtual bool skipEl1(ElInfo *elInfo) {
return false;
}
virtual bool skipEl2(ElInfo *elInfo) {
return false;
}
inline void setFillSubElemMat(bool b, const BasisFunction *fcts) {
fillSubElemMat = b;
basisFcts = fcts;
}
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);
void fillSubElInfo(ElInfo *elInfo1,
ElInfo *elInfo2,
ElInfo *elInfoSmall,
ElInfo *elInfoLarge);
protected:
/// Stack for mesh 1
TraverseStack stack1;
/// Stack for mesh 2
TraverseStack stack2;
/** \brief
* used to determine whether all small elements belonging to the large
* element are traversed.
*/
double rest;
/// true if element 1 should be incremented (set in prepareNextStep())
bool inc1;
/// true if element 2 should be incremented (set in prepareNextStep())
bool inc2;
/// for level traverse of mesh 1
int level1_;
/// for level traverse of mesh 2
int level2_;
/// for leaf element level traverse of mesh 1
bool callLeafElLevel1_;
/// for leaf element level traverse of mesh 2
bool callLeafElLevel2_;
/** \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;
/** \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;
};
}
#endif