From 4e83eefcd5bc6b4188c48aff6e7225c28b54db21 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Thu, 15 Mar 2012 11:36:36 +0000 Subject: [PATCH] FETI-DP Dirichlet precondition works now again. --- AMDiS/src/parallel/PetscSolverFeti.cc | 24 ++++++++++++++++----- AMDiS/src/parallel/PetscSolverFetiStructs.h | 8 ++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index 802034e7..5db733dc 100644 --- a/AMDiS/src/parallel/PetscSolverFeti.cc +++ b/AMDiS/src/parallel/PetscSolverFeti.cc @@ -88,8 +88,9 @@ namespace AMDiS { VecGetArray(data->tmp_vec_b, &local_b); VecGetArray(data->tmp_vec_duals0, &local_duals); - for (int i = nLocalB - nLocalDuals, j = 0; i < nLocalB; i++, j++) - local_duals[j] = local_b[i]; + for (map<int, int>::iterator it = data->localToDualMap.begin(); + it != data->localToDualMap.end(); ++it) + local_duals[it->second] = local_b[it->first]; VecRestoreArray(data->tmp_vec_b, &local_b); VecRestoreArray(data->tmp_vec_duals0, &local_duals); @@ -111,8 +112,9 @@ namespace AMDiS { VecGetArray(data->tmp_vec_b, &local_b); VecGetArray(data->tmp_vec_duals0, &local_duals); - for (int i = nLocalB - nLocalDuals, j = 0; i < nLocalB; i++, j++) - local_b[i] = local_duals[j]; + for (map<int, int>::iterator it = data->localToDualMap.begin(); + it != data->localToDualMap.end(); ++it) + local_b[it->first] = local_duals[it->second]; VecRestoreArray(data->tmp_vec_b, &local_b); VecRestoreArray(data->tmp_vec_duals0, &local_duals); @@ -674,7 +676,19 @@ namespace AMDiS { &(fetiDirichletPreconData.tmp_vec_duals1)); MatGetVecs(mat_interior_interior, PETSC_NULL, &(fetiDirichletPreconData.tmp_vec_interior)); - + + for (unsigned int i = 0; i < feSpaces.size(); i++) { + map<DegreeOfFreedom, MultiIndex> &dualMap = + dualDofMap[feSpaces[i]].getMap(); + for (map<DegreeOfFreedom, MultiIndex>::iterator it = dualMap.begin(); + it != dualMap.end(); ++it) { + DegreeOfFreedom d = it->first; + int matIndexLocal = localDofMap.getLocalMatIndex(i, d); + int matIndexDual = dualDofMap.getLocalMatIndex(i, d); + fetiDirichletPreconData.localToDualMap[matIndexLocal] = matIndexDual; + } + } + KSPGetPC(ksp_feti, &precon_feti); PCSetType(precon_feti, PCSHELL); PCShellSetContext(precon_feti, static_cast<void*>(&fetiDirichletPreconData)); diff --git a/AMDiS/src/parallel/PetscSolverFetiStructs.h b/AMDiS/src/parallel/PetscSolverFetiStructs.h index a69dd4da..adc44ac5 100644 --- a/AMDiS/src/parallel/PetscSolverFetiStructs.h +++ b/AMDiS/src/parallel/PetscSolverFetiStructs.h @@ -23,8 +23,12 @@ #ifndef AMDIS_PETSC_SOLVER_FETI_STRUCTS_H #define AMDIS_PETSC_SOLVER_FETI_STRUCTS_H +#include <map> + namespace AMDiS { + using namespace std; + class PetscSolverFeti; /** \brief @@ -92,7 +96,9 @@ namespace AMDiS { Vec tmp_vec_duals0, tmp_vec_duals1; /// Temporal vector on the interior variables. - Vec tmp_vec_interior; + Vec tmp_vec_interior; + + map<int, int> localToDualMap; }; -- GitLab