Commit 6aa136b2 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* On the way to independent meshes

parent f0f8d33c
...@@ -55,13 +55,7 @@ namespace AMDiS { ...@@ -55,13 +55,7 @@ namespace AMDiS {
// call standard traverse // call standard traverse
*elInfo1 = stack1.traverseFirst(mesh1, level1, flag1); *elInfo1 = stack1.traverseFirst(mesh1, level1, flag1);
while (*elInfo1 != NULL && skipEl1(*elInfo1)) {
*elInfo1 = stack1.traverseNext(*elInfo1);
}
*elInfo2 = stack2.traverseFirst(mesh2, level2, flag2); *elInfo2 = stack2.traverseFirst(mesh2, level2, flag2);
while (*elInfo2 != NULL && skipEl2(*elInfo2)) {
*elInfo2 = stack2.traverseNext(*elInfo2);
}
// finished ? // finished ?
if (*elInfo1 == NULL || *elInfo2 == NULL) { if (*elInfo1 == NULL || *elInfo2 == NULL) {
...@@ -71,8 +65,7 @@ namespace AMDiS { ...@@ -71,8 +65,7 @@ namespace AMDiS {
rest = 1.0; rest = 1.0;
bool accepted = check(elInfo1, elInfo2, bool accepted = check(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
elInfoSmall, elInfoLarge);
// check for non domain covering level traverse // check for non domain covering level traverse
if (!accepted || if (!accepted ||
...@@ -95,14 +88,10 @@ namespace AMDiS { ...@@ -95,14 +88,10 @@ namespace AMDiS {
{ {
// call standard traverse // call standard traverse
if (inc1) { if (inc1) {
do {
*elInfo1 = stack1.traverseNext(*elInfo1); *elInfo1 = stack1.traverseNext(*elInfo1);
} while (*elInfo1 != NULL && skipEl1(*elInfo1));
} }
if (inc2) { if (inc2) {
do {
*elInfo2 = stack2.traverseNext(*elInfo2); *elInfo2 = stack2.traverseNext(*elInfo2);
} while (*elInfo2 != NULL && skipEl2(*elInfo2));
} }
// finished ? // finished ?
...@@ -111,8 +100,7 @@ namespace AMDiS { ...@@ -111,8 +100,7 @@ namespace AMDiS {
return false; return false;
} }
bool accepted = check(elInfo1, elInfo2, bool accepted = check(elInfo1, elInfo2, elInfoSmall, elInfoLarge);
elInfoSmall, elInfoLarge);
// check for non domain covering level traverse // check for non domain covering level traverse
if (!accepted || if (!accepted ||
...@@ -144,17 +132,34 @@ namespace AMDiS { ...@@ -144,17 +132,34 @@ namespace AMDiS {
*elInfo2; *elInfo2;
// update rest // update rest
rest -= 1.0 / (1 << ((*elInfoSmall)->getLevel() - (*elInfoLarge)->getLevel())); double newRest = rest - 1.0 / (1 << ((*elInfoSmall)->getLevel() - (*elInfoLarge)->getLevel()));
if (rest < 1e-32) { if (newRest < 1e-32) {
// large element finished -> increment both elements // large element finished -> increment both elements
rest = 1.0; rest = 1.0;
inc1 = true; inc1 = true;
inc2 = true; inc2 = true;
stack1.stopDisplacementCalculation();
stack2.stopDisplacementCalculation();
} else { } else {
// increment only small element // increment only small element
inc1 = (*elInfo1 == *elInfoSmall) ? true : false; inc1 = (*elInfo1 == *elInfoSmall) ? true : false;
inc2 = (*elInfo2 == *elInfoSmall) ? true : false; inc2 = (*elInfo2 == *elInfoSmall) ? true : false;
// If rest is 1, than this is the first element pair with this large
// element. Therefore, fill the displacement stack of the small element
// traverse stack.
if (rest == 1.0) {
if (*elInfo1 == *elInfoSmall) {
stack1.startDisplacementCalculation((*elInfo2)->getLevel());
// (*elInfo1)->setDisplacement(0);
} else {
stack2.startDisplacementCalculation((*elInfo1)->getLevel());
// (*elInfo2)->setDisplacement(0);
}
}
rest = newRest;
} }
} }
...@@ -163,12 +168,17 @@ namespace AMDiS { ...@@ -163,12 +168,17 @@ namespace AMDiS {
ElInfo *elInfoSmall, ElInfo *elInfoSmall,
ElInfo *elInfoLarge) ElInfo *elInfoLarge)
{ {
if (!fillSubElemInfo) if (!fillSubElemMat)
return; return;
VectorOfFixVecs<DimVec<double> > *subCoords = elInfoSmall->getSubElemCoords(); VectorOfFixVecs<DimVec<double> > *subCoords =
if (!subCoords) { NEW VectorOfFixVecs<DimVec<double> >(elInfo1->getMesh()->getDim(),
subCoords = NEW VectorOfFixVecs<DimVec<double> >(1, 2, NO_INIT); elInfo1->getMesh()->getDim() + 1,
NO_INIT);
DimMat<double> *subCoordsMat = elInfoSmall->getSubElemCoordsMat();
if (!subCoordsMat) {
subCoordsMat = NEW DimMat<double>(elInfo1->getMesh()->getDim());
} }
if (elInfo1 == elInfoSmall) { if (elInfo1 == elInfoSmall) {
...@@ -176,6 +186,15 @@ namespace AMDiS { ...@@ -176,6 +186,15 @@ namespace AMDiS {
} else { } else {
stack2.getCoordsInElem(elInfo1, subCoords); stack2.getCoordsInElem(elInfo1, subCoords);
} }
elInfoSmall->setSubElemCoords(subCoords);
for (int i = 0; i < elInfo1->getMesh()->getDim() + 1; i++) {
for (int j = 0; j < elInfo1->getMesh()->getDim() + 1; j++) {
(*subCoordsMat)[j][i] = (*subCoords)[i][j];
}
}
elInfoSmall->setSubElemCoordsMat(subCoordsMat);
DELETE subCoords;
} }
} }
...@@ -44,10 +44,11 @@ namespace AMDiS { ...@@ -44,10 +44,11 @@ namespace AMDiS {
MEMORY_MANAGED(DualTraverse); MEMORY_MANAGED(DualTraverse);
DualTraverse() DualTraverse()
: fillSubElemInfo(false) : fillSubElemMat(false)
{}; {}
~DualTraverse() {}; ~DualTraverse()
{}
/** \brief /** \brief
* Start dual traversal * Start dual traversal
...@@ -71,14 +72,6 @@ namespace AMDiS { ...@@ -71,14 +72,6 @@ namespace AMDiS {
ElInfo **elInfoSmall, ElInfo **elInfoSmall,
ElInfo **elInfoLarge); ElInfo **elInfoLarge);
bool skipEl1(ElInfo *elInfo) {
return false;
}
bool skipEl2(ElInfo *elInfo) {
return false;
}
bool check(ElInfo **elInfo1, bool check(ElInfo **elInfo1,
ElInfo **elInfo2, ElInfo **elInfo2,
ElInfo **elInfoSmall, ElInfo **elInfoSmall,
...@@ -88,8 +81,8 @@ namespace AMDiS { ...@@ -88,8 +81,8 @@ namespace AMDiS {
return true; return true;
} }
inline void setFillSubElemInfo(bool b) { inline void setFillSubElemMat(bool b) {
fillSubElemInfo = b; fillSubElemMat = b;
} }
protected: protected:
...@@ -154,7 +147,12 @@ namespace AMDiS { ...@@ -154,7 +147,12 @@ namespace AMDiS {
*/ */
bool callLeafElLevel2_; bool callLeafElLevel2_;
bool fillSubElemInfo; /** \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;
}; };
} }
......
...@@ -23,7 +23,8 @@ namespace AMDiS { ...@@ -23,7 +23,8 @@ namespace AMDiS {
element_(NULL), element_(NULL),
parent_(NULL), parent_(NULL),
macroElement_(NULL), macroElement_(NULL),
level_(0), level(0),
displacement(0),
iChild(0), iChild(0),
coord_(mesh_->getDim(), NO_INIT), coord_(mesh_->getDim(), NO_INIT),
boundary_(mesh_->getDim(), DEFAULT_VALUE, INTERIOR), boundary_(mesh_->getDim(), DEFAULT_VALUE, INTERIOR),
...@@ -33,7 +34,7 @@ namespace AMDiS { ...@@ -33,7 +34,7 @@ namespace AMDiS {
neighbourCoord_(mesh_->getDim(), NO_INIT), neighbourCoord_(mesh_->getDim(), NO_INIT),
oppVertex_(mesh_->getDim(), NO_INIT), oppVertex_(mesh_->getDim(), NO_INIT),
grdLambda_(mesh_->getDim(), NO_INIT), grdLambda_(mesh_->getDim(), NO_INIT),
subElemCoords(NULL) subElemCoordsMat(NULL)
{ {
projection_.set(NULL); projection_.set(NULL);
...@@ -46,8 +47,8 @@ namespace AMDiS { ...@@ -46,8 +47,8 @@ namespace AMDiS {
ElInfo::~ElInfo() ElInfo::~ElInfo()
{ {
if (subElemCoords) { if (subElemCoordsMat) {
DELETE subElemCoords; DELETE subElemCoordsMat;
} }
} }
......
...@@ -90,7 +90,7 @@ namespace AMDiS { ...@@ -90,7 +90,7 @@ namespace AMDiS {
parent_ = rhs.parent_; parent_ = rhs.parent_;
macroElement_ = rhs.macroElement_; macroElement_ = rhs.macroElement_;
fillFlag_ = rhs.fillFlag_; fillFlag_ = rhs.fillFlag_;
level_ = rhs.level_; level = rhs.level;
iChild = rhs.iChild; iChild = rhs.iChild;
coord_ = rhs.coord_; coord_ = rhs.coord_;
boundary_ = rhs.boundary_; boundary_ = rhs.boundary_;
...@@ -99,7 +99,7 @@ namespace AMDiS { ...@@ -99,7 +99,7 @@ namespace AMDiS {
neighbourCoord_ = rhs.neighbourCoord_; neighbourCoord_ = rhs.neighbourCoord_;
oppVertex_ = rhs.oppVertex_; oppVertex_ = rhs.oppVertex_;
return *this; return *this;
}; }
// ===== getting-methods ====================================================== // ===== getting-methods ======================================================
public: public:
...@@ -112,49 +112,56 @@ namespace AMDiS { ...@@ -112,49 +112,56 @@ namespace AMDiS {
*/ */
inline Mesh* getMesh() const { inline Mesh* getMesh() const {
return mesh_; return mesh_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref macroElement_ * Get ElInfo's \ref macroElement_
*/ */
inline MacroElement* getMacroElement() const { inline MacroElement* getMacroElement() const {
return macroElement_; return macroElement_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref element * Get ElInfo's \ref element
*/ */
inline Element* getElement() const { inline Element* getElement() const {
return element_; return element_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref parent_ * Get ElInfo's \ref parent_
*/ */
inline Element* getParent() const { inline Element* getParent() const {
return parent_; return parent_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref fillFlag_ * Get ElInfo's \ref fillFlag_
*/ */
inline Flag getFillFlag() const { inline Flag getFillFlag() const {
return fillFlag_; return fillFlag_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref level_ * Get ElInfo's \ref level
*/ */
inline unsigned char getLevel() const { inline int getLevel() const {
return level_; return level;
}; }
/** \brief
* Get ElInfo's \ref displacement. Is used only during dual traverse.
*/
inline int getDisplacement() const {
return displacement;
}
/** \brief /** \brief
* Get ElInfo's \ref iChild * Get ElInfo's \ref iChild
*/ */
inline int getIChild() const { inline int getIChild() const {
return iChild; return iChild;
}; }
/** \brief /** \brief
* Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the * Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the
...@@ -162,7 +169,7 @@ namespace AMDiS { ...@@ -162,7 +169,7 @@ namespace AMDiS {
*/ */
inline WorldVector<double>& getCoord(int i) { inline WorldVector<double>& getCoord(int i) {
return coord_[i]; return coord_[i];
}; }
/** \brief /** \brief
* Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the * Get ElInfo's \ref coord_[i]. This is a WorldVector<double> filled with the
...@@ -170,7 +177,7 @@ namespace AMDiS { ...@@ -170,7 +177,7 @@ namespace AMDiS {
*/ */
inline const WorldVector<double>& getCoord(int i) const { inline const WorldVector<double>& getCoord(int i) const {
return coord_[i]; return coord_[i];
}; }
/** \brief /** \brief
* Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the * Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the
...@@ -178,7 +185,7 @@ namespace AMDiS { ...@@ -178,7 +185,7 @@ namespace AMDiS {
*/ */
inline FixVec<WorldVector<double>, VERTEX>& getCoords() { inline FixVec<WorldVector<double>, VERTEX>& getCoords() {
return coord_; return coord_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the * Get ElInfo's \ref coord_. This is a FixVec<WorldVector<double> > filled with the
...@@ -186,7 +193,7 @@ namespace AMDiS { ...@@ -186,7 +193,7 @@ namespace AMDiS {
*/ */
inline const FixVec<WorldVector<double>, VERTEX>& getCoords() const { inline const FixVec<WorldVector<double>, VERTEX>& getCoords() const {
return coord_; return coord_;
}; }
/** \brief /** \brief
* Get ElInfo's \ref oppCoord_[i] * Get ElInfo's \ref oppCoord_[i]
...@@ -200,7 +207,7 @@ namespace AMDiS { ...@@ -200,7 +207,7 @@ namespace AMDiS {
*/ */
inline BoundaryType getBoundary(int i) const { inline BoundaryType getBoundary(int i) const {
return boundary_[i]; return boundary_[i];
}; }
/** \brief /** \brief
* Get boundary type of i-th vertex/edge/face (pos). * Get boundary type of i-th vertex/edge/face (pos).
...@@ -260,8 +267,12 @@ namespace AMDiS { ...@@ -260,8 +267,12 @@ namespace AMDiS {
return parametric_; return parametric_;
} }
inline VectorOfFixVecs<DimVec<double> > *getSubElemCoords() const { /** \brief
return subElemCoords; * Returns the element transformation matrix \ref subElemCoordsMat .
* This value is set only during dual traverse.
*/
inline DimMat<double> *getSubElemCoordsMat() const {
return subElemCoordsMat;
} }
/** \} */ /** \} */
...@@ -277,56 +288,63 @@ namespace AMDiS { ...@@ -277,56 +288,63 @@ namespace AMDiS {
*/ */
inline void setMesh(Mesh* aMesh) { inline void setMesh(Mesh* aMesh) {
mesh_ = aMesh; mesh_ = aMesh;
}; }
/** \brief /** \brief
* Set ElInfo's \ref macroElement_ * Set ElInfo's \ref macroElement_
*/ */
inline void setMacroElement(MacroElement* mel) { inline void setMacroElement(MacroElement* mel) {
macroElement_ = mel; macroElement_ = mel;
}; }
/** \brief /** \brief
* Set ElInfo's \ref element * Set ElInfo's \ref element
*/ */
inline void setElement(Element* elem) { inline void setElement(Element* elem) {
element_ = elem; element_ = elem;
}; }
/** \brief /** \brief
* Set ElInfo's \ref parent_ * Set ElInfo's \ref parent_
*/ */
inline void setParent(Element* elem) { inline void setParent(Element* elem) {
parent_ = elem; parent_ = elem;
}; }
/** \brief /** \brief
* Set ElInfo's \ref fillFlag_ * Set ElInfo's \ref fillFlag_
*/ */
inline void setFillFlag(Flag flag) { inline void setFillFlag(Flag flag) {
fillFlag_ = flag; fillFlag_ = flag;
}; }
/** \brief /** \brief
* Sets ElInfo's \ref coord_[i]. * Sets ElInfo's \ref coord_[i].
*/ */
inline void setCoord(int i,WorldVector<double>& coord) { inline void setCoord(int i,WorldVector<double>& coord) {
coord_[i] = coord; coord_[i] = coord;
}; }
/** \brief /** \brief
* Sets ElInfo's \ref coord. * Sets ElInfo's \ref coord.
*/ */
inline void setCoords(FixVec<WorldVector<double>,VERTEX >& coords) { inline void setCoords(FixVec<WorldVector<double>,VERTEX >& coords) {
coord_ = coords; coord_ = coords;
}; }
/** \brief /** \brief
* Set ElInfo's \ref level_ * Set ElInfo's \ref level
*/ */
inline void setLevel(int l) { inline void setLevel(int l) {
level_ = l; level = l;
}; }
/** \brief
* Set ElInfo's \ref displacement. Used only during dual traverse.
*/
inline void setDisplacement(int d) {
displacement = d;
}
/** \brief /** \brief
* Set ElInfo's \ref boundary_[i] * Set ElInfo's \ref boundary_[i]
...@@ -356,8 +374,12 @@ namespace AMDiS { ...@@ -356,8 +374,12 @@ namespace AMDiS {
parametric_ = param; parametric_ = param;
} }
inline void setSubElemCoords(VectorOfFixVecs<DimVec<double> > *coords) { /** \brief
subElemCoords = coords; * Sets the element transformation matrix \ref subElemCoordsMat .
* This value is used only during dual traverse.
*/
inline void setSubElemCoordsMat(DimMat<double> *mat) {
subElemCoordsMat = mat;
} }
/** \} */ /** \} */
...@@ -390,8 +412,7 @@ namespace AMDiS { ...@@ -390,8 +412,7 @@ namespace AMDiS {
* Otherwise the function itself provides memory for this vector. In this * Otherwise the function itself provides memory for this vector. In this
* case the vector is overwritten during the next call of coordToWorld. * case the vector is overwritten during the next call of coordToWorld.
*/ */
virtual const WorldVector<double> virtual const WorldVector<double> *coordToWorld(const DimVec<double>& lambda,
*coordToWorld(const DimVec<double>& lambda,
WorldVector<double>* world) const;