diff --git a/AMDiS/src/Global.h b/AMDiS/src/Global.h index 64e17af7ab75b6f371cf3c111e93de678fa26eaa..4435b243ce328a50ebfa66d9f9f5c98145020522 100644 --- a/AMDiS/src/Global.h +++ b/AMDiS/src/Global.h @@ -41,6 +41,7 @@ #include <string> #include <vector> +#include <set> #include <fstream> #include <math.h> #include <iostream> @@ -80,6 +81,8 @@ namespace AMDiS { /// Defines type for a vector of DOF pointers. typedef std::vector<const DegreeOfFreedom*> DofContainer; + typedef std::set<const DegreeOfFreedom*> DofContainerSet; + /// Defines a type for global edge identification via its DOFs. typedef std::pair<DegreeOfFreedom, DegreeOfFreedom> DofEdge; diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index 55d132b7dd1a30f8534cb8b369dc5082725a4312..db0137c0a834fa226b0fa8f228ec08ff1e872669 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -1649,20 +1649,21 @@ namespace AMDiS { recvDofs.clear(); if (createBoundaryDofFlag.isSet(BOUNDARY_SUBOBJ_SORTED)) { - MSG("WITH BOUNDARY SUBOBJ SORTED!\n"); DofContainer dofs; for (int geo = FACE; geo >= VERTEX; geo--) { - boundaryDofInfo.nGeoDofs[static_cast<GeoIndex>(geo)] = 0; + std::set<const DegreeOfFreedom*> &dofSet = + boundaryDofInfo.geoDofs[static_cast<GeoIndex>(geo)]; + dofSet.clear(); for (InteriorBoundary::iterator it(myIntBoundary); !it.end(); ++it) { if (it->rankObj.subObj == geo) { dofs.clear(); it->rankObj.el->getAllDofs(feSpace, it->rankObj, dofs); - - boundaryDofInfo.nGeoDofs[static_cast<GeoIndex>(geo)] += dofs.size(); - DofContainer &tmp = sendDofs[it.getRank()]; + + DofContainer& tmp = sendDofs[it.getRank()]; tmp.insert(tmp.end(), dofs.begin(), dofs.end()); + dofSet.insert(dofs.begin(), dofs.end()); } } } @@ -1673,7 +1674,6 @@ namespace AMDiS { it->rankObj.el->getAllDofs(feSpace, it->rankObj, recvDofs[it.getRank()]); } else { - MSG("GAAAAAAANZ NORMAL!\n"); for (InteriorBoundary::iterator it(myIntBoundary); !it.end(); ++it) it->rankObj.el->getAllDofs(feSpace, it->rankObj, sendDofs[it.getRank()]); diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h index 86ec876cfe33922b011e4775ac9fa2298075251c..2342a21a2382f6ad14f32cc8c163847368a89ee3 100644 --- a/AMDiS/src/parallel/MeshDistributor.h +++ b/AMDiS/src/parallel/MeshDistributor.h @@ -48,7 +48,7 @@ namespace AMDiS { struct BoundaryDofInfo { - map<GeoIndex, int> nGeoDofs; + map<GeoIndex, DofContainerSet> geoDofs; }; @@ -305,6 +305,11 @@ namespace AMDiS { createBoundaryDofFlag = flag; } + BoundaryDofInfo& getBoundaryDofInfo() + { + return boundaryDofInfo; + } + protected: /** \brief * Determines the interior boundaries, i.e. boundaries between ranks, and stores diff --git a/AMDiS/src/parallel/PetscSolverSchur.cc b/AMDiS/src/parallel/PetscSolverSchur.cc index cfc10e9182e630212eccbcd1af01bc07d4bec5e3..bee57fdbbea925fa9bb1ba84cbaaf82c4f204ddf 100644 --- a/AMDiS/src/parallel/PetscSolverSchur.cc +++ b/AMDiS/src/parallel/PetscSolverSchur.cc @@ -44,15 +44,57 @@ namespace AMDiS { } } + + nBoundaryDofs = boundaryDofs.size(); mpi::getDofNumbering(mpiComm, nBoundaryDofs, rStartBoundaryDofs, nOverallBoundaryDofs); - int counter = rStartBoundaryDofs; + + DofContainerSet& edgeDofs = meshDistributor->getBoundaryDofInfo().geoDofs[EDGE]; + DofContainerSet& vertexDofs = meshDistributor->getBoundaryDofInfo().geoDofs[VERTEX]; + int nEdgeDofs = edgeDofs.size(); + int nVertexDofs = vertexDofs.size(); + + TEST_EXIT_DBG(nEdgeDofs + nVertexDofs == nBoundaryDofs) + ("Should not happen!\n"); + + int rStartEdgeDofs, nOverallEdgeDofs; + mpi::getDofNumbering(mpiComm, nEdgeDofs, + rStartEdgeDofs, nOverallEdgeDofs); + + int rStartVertexDofs, nOverallVertexDofs; + mpi::getDofNumbering(mpiComm, nVertexDofs, + rStartVertexDofs, nOverallVertexDofs); + + TEST_EXIT_DBG(nOverallEdgeDofs + nOverallVertexDofs == nOverallBoundaryDofs) + ("Should not happen!\n"); + + mapGlobalBoundaryDof.clear(); +#if 1 + { + int counter = rStartEdgeDofs; + for (DofContainerSet::iterator it = edgeDofs.begin(); + it != edgeDofs.end(); ++it) + mapGlobalBoundaryDof[meshDistributor->mapLocalToGlobal(**it)] = + counter++; + } + { + int counter = nOverallEdgeDofs + rStartVertexDofs; + for (DofContainerSet::iterator it = vertexDofs.begin(); + it != vertexDofs.end(); ++it) + mapGlobalBoundaryDof[meshDistributor->mapLocalToGlobal(**it)] = + counter++; + } +#else + { + int counter = rStartBoundaryDofs; for (std::set<DegreeOfFreedom>::iterator it = boundaryDofs.begin(); it != boundaryDofs.end(); ++it) mapGlobalBoundaryDof[*it] = counter++; + } +#endif @@ -78,11 +120,13 @@ namespace AMDiS { mpi::getDofNumbering(mpiComm, nInteriorDofs, rStartInteriorDofs, nOverallInteriorDofs); - counter = rStartInteriorDofs; - mapGlobalInteriorDof.clear(); - for (std::set<DegreeOfFreedom>::iterator it = interiorDofs.begin(); - it != interiorDofs.end(); ++it) - mapGlobalInteriorDof[*it] = counter++; + { + int counter = rStartInteriorDofs; + mapGlobalInteriorDof.clear(); + for (std::set<DegreeOfFreedom>::iterator it = interiorDofs.begin(); + it != interiorDofs.end(); ++it) + mapGlobalInteriorDof[*it] = counter++; + } TEST_EXIT_DBG(nInteriorDofs > 0)("Should not happen!\n"); @@ -394,7 +438,7 @@ namespace AMDiS { if (rankOnly && !meshDistributor->getIsRankDof(dofIt.getDOFIndex())) continue; - // Calculate global row index of the dof. + // Calculate global row index of the DOF. DegreeOfFreedom globalRowDof = meshDistributor->mapLocalToGlobal(dofIt.getDOFIndex());