diff --git a/AMDiS/src/Debug.cc b/AMDiS/src/Debug.cc index ea0156a9ab8dba966e183069f8a3e8f34c965267..0765ccf30beb22bfbe2c3fc25f284146ef330f47 100644 --- a/AMDiS/src/Debug.cc +++ b/AMDiS/src/Debug.cc @@ -87,15 +87,15 @@ namespace AMDiS { int markLevel = -1; while (elInfo) { + if (markChildren && elInfo->getLevel() <= markLevel) + markChildren = false; + int index = elInfo->getElement()->getIndex(); if (index == idx) { markChildren = true; markLevel = elInfo->getLevel(); } - - if (markChildren && elInfo->getLevel() < markLevel) - markChildren = false; - + if (elInfo->getElement()->isLeaf()) vec[index] = (markChildren ? 1.0 : 0.0); @@ -438,6 +438,38 @@ namespace AMDiS { } + void printElementHierarchie(Mesh *mesh, int elIndex) + { + FUNCNAME("debug::printElementHierarchie()"); + + bool printInfo = false; + int elLevel = -1; + + TraverseStack stack; + ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); + while (elInfo) { + if (printInfo && elInfo->getLevel() <= elLevel) + return; + + if (elInfo->getElement()->getIndex() == elIndex) { + printInfo = true; + elLevel = elInfo->getLevel(); + MSG(" Hierarchie for elIdx = %d\n", elIndex); + } else { + if (printInfo) { + std::stringstream oss; + for (int i = 0; i < (elInfo->getLevel() - elLevel); i++) + oss << " "; + oss << "|--" << elInfo->getElement()->getIndex(); + MSG("%s\n", oss.str().c_str()); + } + } + + elInfo = stack.traverseNext(elInfo); + } + } + + void createSortedDofs(Mesh *mesh, ElementIdxToDofs &elMap) { FUNCNAME("debug::dbgCreateElementMap()"); diff --git a/AMDiS/src/Debug.h b/AMDiS/src/Debug.h index 7df6c40fe10c3ab30380af4c8c33d3e30ef2e3a2..e65ae42a495244ca98d4135ec18ab25aea117ca7 100644 --- a/AMDiS/src/Debug.h +++ b/AMDiS/src/Debug.h @@ -133,6 +133,8 @@ namespace AMDiS { void writeCoordsFile(const FiniteElemSpace *feSpace, std::string filename); + void printElementHierarchie(Mesh *mesh, int elIndex); + /** \brief * Traverse a mesh and store for each element all its vertex DOFs in local sorted * order (by values).