From: David Wells Date: Mon, 25 May 2020 16:29:52 +0000 (-0400) Subject: locally_owned_size() in PETScVector and PETScVectorBase X-Git-Tag: v9.3.0-rc1~449^2~8 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=169e9a2bc5ecb4520d64ecb3056930865f5f4b68;p=dealii.git locally_owned_size() in PETScVector and PETScVectorBase --- diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index e370c65667..4e7e83d364 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -90,9 +90,11 @@ namespace PETScWrappers , communicator(v.communicator) { if (v.has_ghost_elements()) - Vector::create_vector(v.size(), v.local_size(), v.ghost_indices); + Vector::create_vector(v.size(), + v.locally_owned_size(), + v.ghost_indices); else - Vector::create_vector(v.size(), v.local_size()); + Vector::create_vector(v.size(), v.locally_owned_size()); this->operator=(v); } @@ -128,7 +130,7 @@ namespace PETScWrappers if (v.has_ghost_elements()) reinit(v.locally_owned_elements(), v.ghost_indices, v.communicator); else - reinit(v.communicator, v.size(), v.local_size(), true); + reinit(v.communicator, v.size(), v.locally_owned_size(), true); } PetscErrorCode ierr = VecCopy(v.vector, vector); @@ -168,7 +170,7 @@ namespace PETScWrappers // only do something if the sizes // mismatch (may not be true for every proc) - int k_global, k = ((size() != n) || (local_size() != local_sz)); + int k_global, k = ((size() != n) || (locally_owned_size() != local_sz)); { const int ierr = MPI_Allreduce(&k, &k_global, 1, MPI_INT, MPI_LOR, communicator); @@ -213,7 +215,10 @@ namespace PETScWrappers } } else - reinit(v.communicator, v.size(), v.local_size(), omit_zeroing_entries); + reinit(v.communicator, + v.size(), + v.locally_owned_size(), + omit_zeroing_entries); } diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 3b9cf737fa..204cf4ba24 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -606,8 +606,9 @@ namespace PETScWrappers PetscErrorCode ierr = VecGetArray(vector, &start_ptr); AssertThrow(ierr == 0, ExcPETScError(ierr)); - const PetscScalar *ptr = start_ptr, *eptr = start_ptr + local_size(); - bool flag = true; + const PetscScalar *ptr = start_ptr, + *eptr = start_ptr + locally_owned_size(); + bool flag = true; while (ptr != eptr) { if (*ptr != value_type()) @@ -659,8 +660,9 @@ namespace PETScWrappers PetscErrorCode ierr = VecGetArray(vector, &start_ptr); AssertThrow(ierr == 0, ExcPETScError(ierr)); - const PetscScalar *ptr = start_ptr, *eptr = start_ptr + local_size(); - bool flag = true; + const PetscScalar *ptr = start_ptr, + *eptr = start_ptr + locally_owned_size(); + bool flag = true; while (ptr != eptr) { if (!internal::is_non_negative(*ptr))