From b3684565b623debb128ce1c1441bb2d7b515c7da Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 16 Sep 2016 14:37:40 +0200 Subject: [PATCH] The size of owned_elemwnts has to match the size of the vector if asking for locally_owned_elements --- include/deal.II/lac/trilinos_vector.h | 2 +- include/deal.II/lac/trilinos_vector_base.h | 6 +++++- source/lac/trilinos_vector.cc | 12 ++++++------ source/lac/trilinos_vector_base.cc | 2 +- ...nos_bug.with_trilinos=true.mpirun=10.debug.output | 2 +- ...inos_bug.with_trilinos=true.mpirun=4.debug.output | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 6cb27c126b..9196b94e66 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -513,7 +513,7 @@ namespace TrilinosWrappers * * In case the provided IndexSet forms an overlapping partitioning, * it it not clear which elements are owned by which process and - * locally_owned_elements will return an IndexSet of size zero. + * locally_owned_elements() will return an IndexSet of size zero. * * @see * @ref GlossGhostedVector "vectors with ghost elements" diff --git a/include/deal.II/lac/trilinos_vector_base.h b/include/deal.II/lac/trilinos_vector_base.h index a37bbe9613..d670f272dc 100644 --- a/include/deal.II/lac/trilinos_vector_base.h +++ b/include/deal.II/lac/trilinos_vector_base.h @@ -1087,6 +1087,10 @@ namespace TrilinosWrappers IndexSet VectorBase::locally_owned_elements() const { + Assert(owned_elements.size()==size(), + ExcMessage("The locally owned elements have not been properly initialized!" + " This happens for example if this object has been initialized" + " with exactly one overlapping IndexSet.")); return owned_elements; } @@ -1204,7 +1208,7 @@ namespace TrilinosWrappers if (v.nonlocal_vector.get() != 0) nonlocal_vector.reset(new Epetra_MultiVector(v.nonlocal_vector->Map(), 1)); - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index 836f8c2b20..0af4209e7f 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -122,7 +122,7 @@ namespace TrilinosWrappers last_action = Zero; vector.reset (new Epetra_FEVector(*v.vector)); has_ghosts = v.has_ghosts; - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } @@ -318,7 +318,7 @@ namespace TrilinosWrappers vector.reset (new Epetra_FEVector(v.vector->Map())); has_ghosts = v.has_ghosts; last_action = Zero; - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } else if (omit_zeroing_entries == false) { @@ -395,7 +395,7 @@ namespace TrilinosWrappers my_global_elements(v.block(block).vector_partitioner()); for (size_type i=0; iMap().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } else if (omit_zeroing_entries) { @@ -806,7 +806,7 @@ namespace TrilinosWrappers v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } const int ierr = vector->Update(1.0, *v.vector, 0.0); diff --git a/source/lac/trilinos_vector_base.cc b/source/lac/trilinos_vector_base.cc index 7b69d1c7f1..1f5d8d50f0 100644 --- a/source/lac/trilinos_vector_base.cc +++ b/source/lac/trilinos_vector_base.cc @@ -141,7 +141,7 @@ namespace TrilinosWrappers last_action = Zero; vector.reset (new Epetra_FEVector(*v.vector)); has_ghosts = v.has_ghosts; - owned_elements = v.locally_owned_elements(); + owned_elements = v.owned_elements; } else { diff --git a/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=10.debug.output b/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=10.debug.output index 1a79b30795..120d14c2b5 100644 --- a/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=10.debug.output +++ b/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=10.debug.output @@ -1,2 +1,2 @@ -DEAL:0:2d::Exception: ExcGhostsPresent() +DEAL:0:2d::Exception: ExcMessage("The locally owned elements have not been properly initialized!" " This happens for example if this object has been initialized" " with exactly one overlapping IndexSet.") diff --git a/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=4.debug.output b/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=4.debug.output index 1a79b30795..120d14c2b5 100644 --- a/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=4.debug.output +++ b/tests/mpi/constraint_matrix_trilinos_bug.with_trilinos=true.mpirun=4.debug.output @@ -1,2 +1,2 @@ -DEAL:0:2d::Exception: ExcGhostsPresent() +DEAL:0:2d::Exception: ExcMessage("The locally owned elements have not been properly initialized!" " This happens for example if this object has been initialized" " with exactly one overlapping IndexSet.") -- 2.39.5