diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index 85461d15da7d619b6ae40d4aa5cd91a33d4e40fe..7dbacfb16ad658a3dcb7fefc4a26182403ff24d0 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.cc +++ b/AMDiS/src/parallel/PetscSolverFeti.cc @@ -1099,6 +1099,40 @@ namespace AMDiS { } + void PetscSolverFeti::dbgMatrix() + { + FUNCNAME("PetscSolverFeti::dbgMatrix()"); + +#if (DEBUG != 0) + int writeInteriorMatrix = -1; + Parameters::get("parallel->debug->write interior matrix", + writeInteriorMatrix); + + if (writeInteriorMatrix >= 0 && + writeInteriorMatrix == MPI::COMM_WORLD.Get_rank()) { + PetscViewer petscView; + PetscViewerBinaryOpen(PETSC_COMM_SELF, "interior.mat", + FILE_MODE_WRITE, &petscView); + MatView(subdomain->getMatIntInt(), petscView); + PetscViewerDestroy(&petscView); + } + + + int writeCoarseMatrix = 0; + Parameters::get("parallel->debug->write coarse matrix", + writeCoarseMatrix); + + if (writeCoarseMatrix > 0) { + PetscViewer petscView; + PetscViewerBinaryOpen(PETSC_COMM_WORLD, "coarse.mat", + FILE_MODE_WRITE, &petscView); + MatView(subdomain->getMatCoarseCoarse(), petscView); + PetscViewerDestroy(&petscView); + } +#endif + } + + void PetscSolverFeti::recoverSolution(Vec &vec_sol_b, Vec &vec_sol_primal, SystemVector &vec) @@ -1412,6 +1446,11 @@ namespace AMDiS { // === Create PETSc solver for the FETI-DP operator. === createFetiKsp(feSpaces); + + + // === If required, run debug tests. === + + dbgMatrix(); } diff --git a/AMDiS/src/parallel/PetscSolverFeti.h b/AMDiS/src/parallel/PetscSolverFeti.h index cbe71f8713cfd5f2b24c4e38d5e05fce938b060b..c5e8c345ea0a7ec809c5401191b053178e332371 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.h +++ b/AMDiS/src/parallel/PetscSolverFeti.h @@ -135,6 +135,10 @@ namespace AMDiS { /// Destroys FETI-DP operator, \ref ksp_feti void destroyFetiKsp(); + /// In debug modes, this function runs some debug tests on the FETI + /// matrices. In optimized mode, nothing is done here. + void dbgMatrix(); + /** \brief * Recovers AMDiS solution vector from PETSc's solution vectors of the * FETI-DP system. First, the B variables can locally be copied to the