diff --git a/AMDiS/src/Lagrange.cc b/AMDiS/src/Lagrange.cc index c23144b57ad59d540b2775f548d6662938d0f2d0..93e4240dde0b492ebdd0abb5e4a8ec4074ba6454 100644 --- a/AMDiS/src/Lagrange.cc +++ b/AMDiS/src/Lagrange.cc @@ -1223,7 +1223,7 @@ namespace AMDiS { if (list->getNeighbourElement(i, 1) && list->getNeighbourNr(i, 1) < i) lr_set += 2; - + TEST_EXIT(lr_set > 0) ("No values set on both neighbours of element %d\n", el->getIndex()); diff --git a/AMDiS/src/Marker.cc b/AMDiS/src/Marker.cc index dae5790294b142fe00424106e74bbdc4ac734190..3f82e606218fecd34d363b3b49b90a0098d7993a 100644 --- a/AMDiS/src/Marker.cc +++ b/AMDiS/src/Marker.cc @@ -123,6 +123,23 @@ namespace AMDiS { } + void MSMarker::initMarking(AdaptInfo *adaptInfo, Mesh *mesh) + { + FUNCNAME("MSMarker::initMarking()"); + + Marker::initMarking(adaptInfo, mesh); + + double MSGammaP = pow(MSGamma, p); + double MSGammaCP = pow(MSGammaC, p); + + markRLimit = MSGammaP * adaptInfo->getEstMax(row == -1 ? 0 : row); + markCLimit = MSGammaCP * adaptInfo->getEstMax(row == -1 ? 0 : row); + + MSG("start max_est: %.3le mark_limits: %.3le %.3le\n", + adaptInfo->getEstMax(row == -1 ? 0 : row), markRLimit, markCLimit); + } + + void ESMarker::initMarking(AdaptInfo *adaptInfo, Mesh *mesh) { FUNCNAME("ESMarker::initMarking()"); diff --git a/AMDiS/src/Marker.h b/AMDiS/src/Marker.h index a6fae8e064a586605e2a672972fbeda08f4f019d..c24c238b090d6063742314baf4b997905cc9adc9 100644 --- a/AMDiS/src/Marker.h +++ b/AMDiS/src/Marker.h @@ -217,16 +217,7 @@ namespace AMDiS { } /// Implementation of MarkScal::initMarking(). - virtual void initMarking(AdaptInfo *adaptInfo, Mesh *mesh) - { - Marker::initMarking(adaptInfo, mesh); - - double MSGammaP = pow(MSGamma, p); - double MSGammaCP = pow(MSGammaC, p); - - markRLimit = MSGammaP * adaptInfo->getEstMax(row == -1 ? 0 : row); - markCLimit = MSGammaCP * adaptInfo->getEstMax(row == -1 ? 0 : row); - } + void initMarking(AdaptInfo *adaptInfo, Mesh *mesh); protected: /// Marking parameter. diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index fdf3832d05f8aedd7dc138aedc269db75f6a360b..617a3d07f8b4d70c42a01e149e060b182222f235 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -133,6 +133,9 @@ namespace AMDiS { Parameters::get(name + "->print timings", printTimings); TEST_EXIT(partitioner)("Could not create partitioner \"%s\"!\n", partStr.c_str()); + + // If required, create hierarchical mesh level structure. + createMeshLevelStructure(); } @@ -179,15 +182,11 @@ namespace AMDiS { elObjDb.setFeSpace(feSpaces[0]); - // If required, create hierarchical mesh level structure. - createMeshLevelStructure(); // If the problem has been already read from a file, we need only to set // isRankDofs to all matrices and rhs vector and to remove periodic // boundary conditions (if there are some). if (deserialized) { - createMeshLevelStructure(); - updateMacroElementInfo(); removePeriodicBoundaryConditions(); @@ -569,7 +568,7 @@ namespace AMDiS { dofMaps.end()) ("Parallel DOF mapping already registerd in mesh distributor object!\n"); - dofMaps.push_back(&dofMap); + dofMaps.push_back(&dofMap); } diff --git a/AMDiS/src/parallel/MeshLevelData.h b/AMDiS/src/parallel/MeshLevelData.h index 66f826abbecb05794b18c5fbedbd4f8f9fabfb1b..93a35faf87075d20f05f4465f230cbab8ca00e37 100644 --- a/AMDiS/src/parallel/MeshLevelData.h +++ b/AMDiS/src/parallel/MeshLevelData.h @@ -72,7 +72,10 @@ namespace AMDiS { MPI::Intracomm& getMpiComm(int level) { - TEST_EXIT_DBG(level < nLevel)("Should not happen!\n"); + FUNCNAME("MeshLevelData::getMpiComm()"); + + TEST_EXIT_DBG(level < nLevel) + ("Asked for level %d, but defined only for %d levels!\n", level, nLevel); return mpiComms[level]; } diff --git a/AMDiS/src/parallel/ParallelDebug.cc b/AMDiS/src/parallel/ParallelDebug.cc index e070ee6c4ec869cdb399ea832bf3eeb697eaab3e..619133b0ba6a0529ef0bb92d967d570c59990d59 100644 --- a/AMDiS/src/parallel/ParallelDebug.cc +++ b/AMDiS/src/parallel/ParallelDebug.cc @@ -927,6 +927,9 @@ namespace AMDiS { Mesh *mesh = feSpace->getMesh(); + if (mesh->getDim() != 3) + return; + stringstream filename; filename << prefix << "-" << MPI::COMM_WORLD.Get_rank() << "." << postfix; diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc index 3da4d281cb2e61ff69e880c5850648919d60b743..71bde6145064c997a7f16c25feae7de8542f8cdf 100644 --- a/AMDiS/src/parallel/PetscSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -48,8 +48,9 @@ namespace AMDiS { PetscSolver::~PetscSolver() { if (parallelDofMappingsRegistered) { - meshDistributor->removeDofMap(dofMap); int nLevels = meshDistributor->getMeshLevelData().getLevelNumber(); + + meshDistributor->removeDofMap(dofMap); if (nLevels > 1) meshDistributor->removeDofMap(dofMapSd); } diff --git a/AMDiS/src/parallel/PetscSolver.h b/AMDiS/src/parallel/PetscSolver.h index fb0b6cc8109d36f0e028f210aa64bcaff7b64c01..8c70fb3ddbaed65d7f4c3d0fe032abdf19947ca7 100644 --- a/AMDiS/src/parallel/PetscSolver.h +++ b/AMDiS/src/parallel/PetscSolver.h @@ -150,6 +150,11 @@ namespace AMDiS { return dofMap; } + ParallelDofMapping& getDofMapSd() + { + return dofMapSd; + } + vector<const FiniteElemSpace*>& getComponentSpaces() { return componentSpaces; diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index 7379e46781a4f8bdc42c2a0ae707aef297510bec..2c0087c9ad9db1df03afe341b53471120dade5c7 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.cc +++ b/AMDiS/src/parallel/PetscSolverFeti.cc @@ -331,11 +331,13 @@ namespace AMDiS { // === Calculate the number of primals that are owned by the rank and === // === create local indices of the primals starting at zero. === - for (DofIndexSet::iterator it = primals.begin(); it != primals.end(); ++it) + for (DofIndexSet::iterator it = primals.begin(); it != primals.end(); ++it) { if (dofMap[feSpace].isRankDof(*it)) { primalDofMap[component].insertRankDof(*it); - } else + } else { primalDofMap[component].insertNonRankDof(*it); + } + } } @@ -1047,7 +1049,7 @@ namespace AMDiS { MatMatMult(subdomain->getMatCoarseInterior(), matK, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &mat_schur_primal); MatAYPX(mat_schur_primal, -1.0, subdomain->getMatCoarse(), DIFFERENT_NONZERO_PATTERN); - + MatDestroy(&matK); } else { Mat tmp; diff --git a/AMDiS/src/parallel/PetscSolverFeti.h b/AMDiS/src/parallel/PetscSolverFeti.h index 6d5b7114abdef33e14d3f576e1a54875bf6a2360..1d312e6c6253c43fc3bb55e5ed7477999936fd21 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.h +++ b/AMDiS/src/parallel/PetscSolverFeti.h @@ -57,6 +57,11 @@ namespace AMDiS { /// Constructor of FETI-DP solver class. PetscSolverFeti(string name); + /// After mesh changes, or if the solver is called the first time, this + /// function creates all information about primal nodes, dual nodes and + /// lagrange constraints. + void createFetiData(); + /// Assemble the sequentially created matrices to the global matrices /// required by the FETI-DP method. void fillPetscMatrix(Matrix<DOFMatrix*> *mat); @@ -115,11 +120,6 @@ namespace AMDiS { /// void createDirichletData(Matrix<DOFMatrix*> &mat); - /// After mesh changes, or if the solver is called the first time, this - /// function creates all information about primal nodes, dual nodes and - /// lagrange constraints. - void createFetiData(); - /// Defines which boundary nodes are primal. Creates global index of /// the primal variables. void createPrimals(int component); diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index 00d4b309df7eff1c667a8d6749a8f6ae9eacd630..806f79c744d8bbc00dfd3fb0a6a35e3a59a6090e 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -203,8 +203,8 @@ namespace AMDiS { rStartInterior; MatSetValues(getMatCoarseInteriorByComponent(rowComponent), - 1, &rowIndex, colsOther.size(), - &(colsOther[0]), &(valuesOther[0]), ADD_VALUES); + 1, &rowIndex, colsOther.size(), + &(colsOther[0]), &(valuesOther[0]), ADD_VALUES); } } else { if ((*interiorMap)[rowComponent].isSet(*cursor) == false) @@ -222,8 +222,8 @@ namespace AMDiS { cols[i] = interiorMap->getMatIndex(colComponent, cols[i]); } - MatSetValues(getMatInterior(), 1, &localRowIndex, cols.size(), - &(cols[0]), &(values[0]), ADD_VALUES); + MatSetValues(getMatInterior(), 1, &localRowIndex, cols.size(), + &(cols[0]), &(values[0]), ADD_VALUES); if (colsOther.size()) { int globalRowIndex = @@ -234,8 +234,8 @@ namespace AMDiS { colCoarseSpace->getMatIndex(colComponent, colsOther[i]); MatSetValues(getMatInteriorCoarseByComponent(colComponent), - 1, &globalRowIndex, colsOther.size(), - &(colsOther[0]), &(valuesOther[0]), ADD_VALUES); + 1, &globalRowIndex, colsOther.size(), + &(colsOther[0]), &(valuesOther[0]), ADD_VALUES); } } } @@ -244,6 +244,7 @@ namespace AMDiS { matAssembly(); + // === Create solver for the non primal (thus local) variables. === KSPCreate(mpiCommLocal, &kspInterior);