diff --git a/AMDiS/src/parallel/PetscSolverFeti.cc b/AMDiS/src/parallel/PetscSolverFeti.cc index 802034e7d8bc3bc9c56bcf38fa589ae0dd88258f..5db733dce6148737664914f61b6e358f13187906 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 a69dd4daa47cca995a15ff5e1bef651cb877b121..adc44ac54e85c0650ad83da713ac5aea642de24e 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; };