From f87fb020bfc2c067d283203312f8dd13e89c60c5 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 22 Dec 2018 15:33:52 +0100 Subject: [PATCH] Replace vector_partitioner with thrilinos_partitioner --- .../deal.II/lac/read_write_vector.templates.h | 2 +- include/deal.II/lac/trilinos_precondition.h | 12 ++++++++---- include/deal.II/lac/trilinos_vector.h | 18 ++++++++++++++++++ source/lac/trilinos_sparse_matrix.cc | 4 ++-- source/lac/trilinos_vector.cc | 6 +++--- tests/mpi/trilinos_compress_bug.cc | 2 +- tests/mpi/trilinos_vector_reinit.cc | 4 ++-- tests/trilinos/index_set_02.cc | 2 +- tests/trilinos/readwritevector_02.cc | 2 +- tests/trilinos/readwritevector_03.cc | 2 +- 10 files changed, 38 insertions(+), 16 deletions(-) diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index 7a2948bcc4..9a80226481 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -308,7 +308,7 @@ namespace LinearAlgebra // the argument's lifetime needs to be longer then. If we do this, we need // to think about whether the view should be read/write. - stored_elements = IndexSet(trilinos_vec.vector_partitioner()); + stored_elements = IndexSet(trilinos_vec.trilinos_partitioner()); resize_val(stored_elements.n_elements()); diff --git a/include/deal.II/lac/trilinos_precondition.h b/include/deal.II/lac/trilinos_precondition.h index 0a8787fa76..56e459a0b3 100644 --- a/include/deal.II/lac/trilinos_precondition.h +++ b/include/deal.II/lac/trilinos_precondition.h @@ -1976,9 +1976,11 @@ namespace TrilinosWrappers inline void PreconditionBase::vmult(MPI::Vector &dst, const MPI::Vector &src) const { - Assert(dst.vector_partitioner().SameAs(preconditioner->OperatorRangeMap()), + Assert(dst.trilinos_partitioner().SameAs( + preconditioner->OperatorRangeMap()), ExcNonMatchingMaps("dst")); - Assert(src.vector_partitioner().SameAs(preconditioner->OperatorDomainMap()), + Assert(src.trilinos_partitioner().SameAs( + preconditioner->OperatorDomainMap()), ExcNonMatchingMaps("src")); const int ierr = preconditioner->ApplyInverse(src.trilinos_vector(), @@ -1989,9 +1991,11 @@ namespace TrilinosWrappers inline void PreconditionBase::Tvmult(MPI::Vector &dst, const MPI::Vector &src) const { - Assert(dst.vector_partitioner().SameAs(preconditioner->OperatorRangeMap()), + Assert(dst.trilinos_partitioner().SameAs( + preconditioner->OperatorRangeMap()), ExcNonMatchingMaps("dst")); - Assert(src.vector_partitioner().SameAs(preconditioner->OperatorDomainMap()), + Assert(src.trilinos_partitioner().SameAs( + preconditioner->OperatorDomainMap()), ExcNonMatchingMaps("src")); preconditioner->SetUseTranspose(true); diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 79226b9f31..95a9a8fdc0 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -1201,10 +1201,20 @@ namespace TrilinosWrappers /** * Return a const reference to the underlying Trilinos Epetra_Map that * sets the parallel partitioning of the vector. + * + * @deprecated Use trilinos_partitioner() instead. */ + DEAL_II_DEPRECATED const Epetra_Map & vector_partitioner() const; + /** + * Return a const reference to the underlying Trilinos Epetra_BlockMap + * that sets the parallel partitioning of the vector. + */ + const Epetra_BlockMap & + trilinos_partitioner() const; + /** * Print to a stream. @p precision denotes the desired precision with * which values shall be printed, @p scientific whether scientific @@ -2143,6 +2153,14 @@ namespace TrilinosWrappers + inline const Epetra_BlockMap & + Vector::trilinos_partitioner() const + { + return vector->Map(); + } + + + inline const MPI_Comm & Vector::get_mpi_communicator() const { diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index a523b2423c..b181dcac42 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -2068,10 +2068,10 @@ namespace TrilinosWrappers const TrilinosWrappers::MPI::Vector &in, const TrilinosWrappers::MPI::Vector &out) { - Assert(in.vector_partitioner().SameAs(m.DomainMap()) == true, + Assert(in.trilinos_partitioner().SameAs(m.DomainMap()) == true, ExcMessage( "Column map of matrix does not fit with vector map!")); - Assert(out.vector_partitioner().SameAs(m.RangeMap()) == true, + Assert(out.trilinos_partitioner().SameAs(m.RangeMap()) == true, ExcMessage("Row map of matrix does not fit with vector map!")); (void)m; (void)in; diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index dd96f6d021..0f53cca4bb 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -300,7 +300,7 @@ namespace TrilinosWrappers { TrilinosWrappers::types::int_type *glob_elements = TrilinosWrappers::my_global_elements( - v.block(block).vector_partitioner()); + v.block(block).trilinos_partitioner()); for (size_type i = 0; i < v.block(block).local_size(); ++i) global_ids[added_elements++] = glob_elements[i] + block_offset; owned_elements.add_indices(v.block(block).owned_elements, @@ -313,7 +313,7 @@ namespace TrilinosWrappers n_elements, global_ids.data(), 0, - v.block(0).vector_partitioner().Comm()); + v.block(0).trilinos_partitioner().Comm()); auto actual_vec = std_cxx14::make_unique(new_map); @@ -616,7 +616,7 @@ namespace TrilinosWrappers // GlobalAssemble(). double double_mode = mode; const Epetra_MpiComm *comm_ptr = - dynamic_cast(&(vector_partitioner().Comm())); + dynamic_cast(&(trilinos_partitioner().Comm())); Assert(comm_ptr != nullptr, ExcInternalError()); Utilities::MPI::MinMaxAvg result = Utilities::MPI::min_max_avg(double_mode, comm_ptr->GetMpiComm()); diff --git a/tests/mpi/trilinos_compress_bug.cc b/tests/mpi/trilinos_compress_bug.cc index 70f0064dae..fed83f3628 100644 --- a/tests/mpi/trilinos_compress_bug.cc +++ b/tests/mpi/trilinos_compress_bug.cc @@ -63,7 +63,7 @@ test() test1.compress(VectorOperation::add); - // TrilinosWrappers::MPI::Vector test(test1.vector_partitioner()); // works + // TrilinosWrappers::MPI::Vector test(test1.trilinos_partitioner()); // works // TrilinosWrappers::MPI::Vector test(locally_owned); // works TrilinosWrappers::MPI::Vector test(test1); // fails diff --git a/tests/mpi/trilinos_vector_reinit.cc b/tests/mpi/trilinos_vector_reinit.cc index 2d0bd35822..da9991f227 100644 --- a/tests/mpi/trilinos_vector_reinit.cc +++ b/tests/mpi/trilinos_vector_reinit.cc @@ -40,7 +40,7 @@ test() TrilinosWrappers::MPI::Vector test1, test2; - AssertThrow(test1.vector_partitioner().SameAs(test2.vector_partitioner()), + AssertThrow(test1.trilinos_partitioner().SameAs(test2.trilinos_partitioner()), ExcInternalError()); // first processor owns 2 indices, second @@ -54,7 +54,7 @@ test() // reinit Trilinos vector from other vector test2.reinit(test1, true); - AssertThrow(test1.vector_partitioner().SameAs(test2.vector_partitioner()), + AssertThrow(test1.trilinos_partitioner().SameAs(test2.trilinos_partitioner()), ExcInternalError()); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) diff --git a/tests/trilinos/index_set_02.cc b/tests/trilinos/index_set_02.cc index a74d0b0a9a..fda3bf0c8e 100644 --- a/tests/trilinos/index_set_02.cc +++ b/tests/trilinos/index_set_02.cc @@ -66,7 +66,7 @@ test() TrilinosWrappers::MPI::Vector v; v.reinit(set_my, set_ghost, MPI_COMM_WORLD); - IndexSet from_partitioner(v.vector_partitioner()); + IndexSet from_partitioner(v.trilinos_partitioner()); deallog << "vec size: " << v.size() << " from_partitioner: " << from_partitioner.size() << std::endl; diff --git a/tests/trilinos/readwritevector_02.cc b/tests/trilinos/readwritevector_02.cc index 7bcee170e8..f7151182a3 100644 --- a/tests/trilinos/readwritevector_02.cc +++ b/tests/trilinos/readwritevector_02.cc @@ -60,7 +60,7 @@ test() tril_vector_ghosted.print(deallog.get_file_stream()); - IndexSet readwrite_is(tril_vector_ghosted.vector_partitioner()); + IndexSet readwrite_is(tril_vector_ghosted.trilinos_partitioner()); deallog << "ghosted IS: "; readwrite_is.print(deallog); diff --git a/tests/trilinos/readwritevector_03.cc b/tests/trilinos/readwritevector_03.cc index 270fb26ca4..b188b452ed 100644 --- a/tests/trilinos/readwritevector_03.cc +++ b/tests/trilinos/readwritevector_03.cc @@ -60,7 +60,7 @@ test() tril_vector_ghosted.print(deallog.get_file_stream()); - IndexSet readwrite_is(tril_vector_ghosted.vector_partitioner()); + IndexSet readwrite_is(tril_vector_ghosted.trilinos_partitioner()); deallog << "ghosted IS: "; readwrite_is.print(deallog); -- 2.39.5