From b620b7b7dc9cebe3aabcf481b9eb8deed89bb0d0 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Fri, 24 Jul 2015 19:43:17 +0200 Subject: [PATCH] Added IndexSet constructor with Epetra_Map --- include/deal.II/base/index_set.h | 27 +++++++++++++++++++++++++++ include/deal.II/lac/trilinos_vector.h | 8 ++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index b8dd4bd236..3549ce1d56 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -88,6 +88,14 @@ public: */ explicit IndexSet (const types::global_dof_index size); + +#ifdef DEAL_II_WITH_TRILINOS + /** + * Constructor from a trilinos Epetra_Map. + */ + IndexSet(const Epetra_Map &map); +#endif + /** * Remove all indices from this index set. The index set retains its size, * however. @@ -534,6 +542,24 @@ IndexSet::IndexSet (const types::global_dof_index size) + +#ifdef DEAL_II_WITH_TRILINOS +inline +IndexSet::IndexSet (const Epetra_Map &map) + : + is_compressed (true), + index_space_size (map.NumGlobalElements()), + largest_range (numbers::invalid_unsigned_int) +{ + int *map_indices = map.MyGlobalElements(); + for (int i=0; i @@ -997,7 +997,7 @@ namespace internal TrilinosWrappers::MPI::Vector &v, bool fast) { - v.reinit(matrix.domain_partitioner(), fast); + v.reinit(IndexSet(matrix.domain_partitioner()), MPI_COMM_WORLD, fast); } }; @@ -1015,7 +1015,7 @@ namespace internal TrilinosWrappers::Vector &v, bool fast) { - v.reinit(matrix.range_partitioner(), fast); + v.reinit(IndexSet(matrix.range_partitioner()), MPI_COMM_WORLD, fast); } template @@ -1024,7 +1024,7 @@ namespace internal TrilinosWrappers::Vector &v, bool fast) { - v.reinit(matrix.domain_partitioner(), fast); + v.reinit(IndexSet(matrix.domain_partitioner()), MPI_COMM_WORLD, fast); } }; -- 2.39.5