From 205b4671a9623437683c2c32a9052a8d06bc7e59 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Mon, 20 Dec 2010 14:49:23 +0000 Subject: [PATCH] Added pre refinements for mesh in parallel computations. --- AMDiS/src/Mesh.cc | 10 ++++++++++ AMDiS/src/parallel/MeshManipulation.cc | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index 1ada139d..f0f4b1d5 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -1280,6 +1280,16 @@ namespace AMDiS { } + // === Check if number of pre refinements is set ini init file. === + + int nPreRefine = 0; + GET_PARAMETER(0, "parallel->pre refine", "%d", &nPreRefine); + if (nPreRefine != 0) { + MSG("Calculated %d pre refines to be useful, but %d are set in init file!\n", + nrRefine, nPreRefine); + nrRefine = nPreRefine; + } + // === If we do not need to refine the mesh, return back. === if (nrRefine == 0) diff --git a/AMDiS/src/parallel/MeshManipulation.cc b/AMDiS/src/parallel/MeshManipulation.cc index ebf60fa7..d5040cd7 100644 --- a/AMDiS/src/parallel/MeshManipulation.cc +++ b/AMDiS/src/parallel/MeshManipulation.cc @@ -25,6 +25,9 @@ namespace AMDiS { TEST_EXIT(mesh->getDim() == 2)("Not yet supported for dim != 2!\n"); + + // Create data structure that maps macro element indices to the + // corresponding pointers. std::map<int, MacroElement*> macroIndexMap; for (std::set<MacroElement*>::iterator it = newMacroEl.begin(); it != newMacroEl.end(); ++it) @@ -33,6 +36,10 @@ namespace AMDiS { std::set<int> macrosProcessed; std::map<const DegreeOfFreedom*, const DegreeOfFreedom*> mapDelDofs; + + // === Traverse mesh and put all "old" macro element to macrosProcessed === + // === that stores all macro elements which are really conected to the === + // === overall mesh structure. === TraverseStack stack; ElInfo *elInfo = stack.traverseFirst(mesh, 0, Mesh::CALL_EL_LEVEL); @@ -48,6 +55,10 @@ namespace AMDiS { } + // === Traverse all new elements and connect them to the overall mesh === + // === structure by deleting all double DOFs on macro element's vertices, === + // === edges and faces. === + for (std::set<MacroElement*>::iterator it = newMacroEl.begin(); it != newMacroEl.end(); ++it) { @@ -127,6 +138,8 @@ namespace AMDiS { } + // === Remove all DOF replacments of the form A -> B, B -> C by A -> C. === + bool changed = false; do { changed = false; @@ -144,6 +157,8 @@ namespace AMDiS { } while (changed); + // === Set new DOF pointers in all elements of the mesh. === + elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); while (elInfo) { for (int i = 0; i < mesh->getGeo(VERTEX); i++) @@ -154,6 +169,8 @@ namespace AMDiS { } + // === And delete all double DOFs. === + for (std::map<const DegreeOfFreedom*, const DegreeOfFreedom*>::iterator it = mapDelDofs.begin(); it != mapDelDofs.end(); ++it) mesh->freeDof(const_cast<DegreeOfFreedom*>(it->first), VERTEX); -- GitLab