]> https://gitweb.dealii.org/ - dealii.git/commitdiff
locally_owned_size() in partitioner
authorDavid Wells <drwells@email.unc.edu>
Mon, 25 May 2020 16:13:42 +0000 (12:13 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 11 Feb 2021 16:48:49 +0000 (11:48 -0500)
include/deal.II/base/partitioner.h
include/deal.II/base/partitioner.templates.h
include/deal.II/lac/la_parallel_block_vector.templates.h
include/deal.II/lac/la_parallel_vector.h
include/deal.II/lac/la_parallel_vector.templates.h
include/deal.II/lac/read_write_vector.templates.h
include/deal.II/matrix_free/dof_info.templates.h
include/deal.II/matrix_free/matrix_free.h
include/deal.II/matrix_free/operators.h
source/base/partitioner.cc

index 33717041e4420c3e3287d67cd86afe60fa340aa3..0d8ffe712494b62a6f832d416ab7e4027d0c961d 100644 (file)
@@ -123,9 +123,10 @@ namespace Utilities
      * The partitioner includes a mechanism for converting global to local and
      * local to global indices. Internally, this class stores vector elements
      * using the convention as follows: The local range is associated with
-     * local indices [0,@p local_size), and ghost indices are stored
-     * consecutively in [@p local_size, @p local_size + @p n_ghost_indices).
-     * The ghost indices are sorted according to their global index.
+     * local indices [0, locally_owned_size()), and ghost indices are stored
+     * consecutively in [locally_owned_size(), locally_owned_size() +
+     * n_ghost_indices()). The ghost indices are sorted according to their
+     * global index.
      *
      *
      * <h4>Parallel data exchange</h4>
@@ -282,12 +283,23 @@ namespace Utilities
       size() const;
 
       /**
-       * Return the local size, i.e. local_range().second minus
-       * local_range().first.
+       * Return the number of locally owned indices,
+       * i.e., local_range().second minus local_range().first.
+       *
+       * @deprecated Use the more clearly named function locally_owned_size()
+       * instead.
        */
+      DEAL_II_DEPRECATED
       unsigned int
       local_size() const;
 
+      /**
+       * Return the number of locally owned indices,
+       * i.e., local_range().second minus local_range().first.
+       */
+      unsigned int
+      locally_owned_size() const;
+
       /**
        * Return an IndexSet representation of the local range. This class
        * only supports contiguous local ranges, so the IndexSet actually only
@@ -317,10 +329,10 @@ namespace Utilities
        * the given global index is neither locally owned nor a ghost, an
        * exception is thrown.
        *
-       * Note that the returned local index for locally owned indices
-       * will be between 0 and
-       * `local_size()-1`, and the local index for ghosts is between
-       * `local_size()` and `local_size()+n_ghost_indices()-1`.
+       * Note that the returned local index for locally owned indices will be
+       * between 0 and locally_owned_size() - 1, and the local index for
+       * ghosts is between locally_owned_size() and locally_owned_size() +
+       * n_ghost_indices() - 1.
        */
       unsigned int
       global_to_local(const types::global_dof_index global_index) const;
@@ -329,8 +341,9 @@ namespace Utilities
        * Return the global index corresponding to the given local index.
        *
        * Note that the local index for locally owned indices must be between 0
-       * and `local_size()-1`, and the local index for ghosts must be between
-       * `local_size()` and `local_size()+n_ghost_indices()-1`.
+       * and locally_owned_size() - 1, and the local index for ghosts must be
+       * between locally_owned_size() and locally_owned_size() +
+       * n_ghost_indices() - 1.
        */
       types::global_dof_index
       local_to_global(const unsigned int local_index) const;
@@ -810,6 +823,14 @@ namespace Utilities
 
     inline unsigned int
     Partitioner::local_size() const
+    {
+      return locally_owned_size();
+    }
+
+
+
+    inline unsigned int
+    Partitioner::locally_owned_size() const
     {
       types::global_dof_index size =
         local_range_data.second - local_range_data.first;
@@ -852,7 +873,7 @@ namespace Utilities
       if (in_local_range(global_index))
         return static_cast<unsigned int>(global_index - local_range_data.first);
       else if (is_ghost_entry(global_index))
-        return (local_size() +
+        return (locally_owned_size() +
                 static_cast<unsigned int>(
                   ghost_indices_data.index_within_set(global_index)));
       else
@@ -867,11 +888,13 @@ namespace Utilities
     inline types::global_dof_index
     Partitioner::local_to_global(const unsigned int local_index) const
     {
-      AssertIndexRange(local_index, local_size() + n_ghost_indices_data);
-      if (local_index < local_size())
+      AssertIndexRange(local_index,
+                       locally_owned_size() + n_ghost_indices_data);
+      if (local_index < locally_owned_size())
         return local_range_data.first + types::global_dof_index(local_index);
       else
-        return ghost_indices_data.nth_index_in_set(local_index - local_size());
+        return ghost_indices_data.nth_index_in_set(local_index -
+                                                   locally_owned_size());
     }
 
 
index dd10f66c3f46bc9e016c82fdce4a37a054a763df..4ea19aecc46899dc43e4e136b459b62fbf373da6 100644 (file)
@@ -58,7 +58,7 @@ namespace Utilities
       const unsigned int n_ghost_targets  = ghost_targets_data.size();
 
       if (n_import_targets > 0)
-        AssertDimension(locally_owned_array.size(), local_size());
+        AssertDimension(locally_owned_array.size(), locally_owned_size());
 
       Assert(requests.size() == 0,
              ExcMessage("Another operation seems to still be running. "
@@ -576,7 +576,7 @@ namespace Utilities
       // first wait for the receive to complete
       if (requests.size() > 0 && n_import_targets > 0)
         {
-          AssertDimension(locally_owned_array.size(), local_size());
+          AssertDimension(locally_owned_array.size(), locally_owned_size());
           const int ierr =
             MPI_Waitall(n_import_targets, requests.data(), MPI_STATUSES_IGNORE);
           AssertThrowMPI(ierr);
index 75bb7d2707bf857ad5606d56730416c971de4f5d..bd31e026d8d4ac275ad06d74c9c6fdbb51b430da 100644 (file)
@@ -674,9 +674,9 @@ namespace LinearAlgebra
 
       Number local_result = Number();
       for (unsigned int i = 0; i < this->n_blocks(); ++i)
-        local_result +=
-          this->block(i).mean_value_local() *
-          static_cast<real_type>(this->block(i).partitioner->local_size());
+        local_result += this->block(i).mean_value_local() *
+                        static_cast<real_type>(
+                          this->block(i).partitioner->locally_owned_size());
 
       if (this->block(0).partitioner->n_mpi_processes() > 1)
         return Utilities::MPI::sum(
index 42b1220d0432428d26e9ef2713fd7c13d1e42705..107b9a2e79581b4ca09cce9ebecb933338b5eb58 100644 (file)
@@ -1534,7 +1534,7 @@ namespace LinearAlgebra
     inline typename Vector<Number, MemorySpace>::size_type
     Vector<Number, MemorySpace>::locally_owned_size() const
     {
-      return partitioner->local_size();
+      return partitioner->locally_owned_size();
     }
 
 
@@ -1586,7 +1586,7 @@ namespace LinearAlgebra
     Vector<Number, MemorySpace>::end()
     {
       return internal::Policy<Number, MemorySpace>::begin(data) +
-             partitioner->local_size();
+             partitioner->locally_owned_size();
     }
 
 
@@ -1596,7 +1596,7 @@ namespace LinearAlgebra
     Vector<Number, MemorySpace>::end() const
     {
       return internal::Policy<Number, MemorySpace>::begin(data) +
-             partitioner->local_size();
+             partitioner->locally_owned_size();
     }
 
 
@@ -1686,7 +1686,7 @@ namespace LinearAlgebra
              ExcMessage(
                "This function is only implemented for the Host memory space"));
       AssertIndexRange(local_index,
-                       partitioner->local_size() +
+                       partitioner->locally_owned_size() +
                          partitioner->n_ghost_indices());
       // do not allow reading a vector which is not in ghost mode
       Assert(local_index < local_size() || vector_is_ghosted == true,
@@ -1707,7 +1707,7 @@ namespace LinearAlgebra
                "This function is only implemented for the Host memory space"));
 
       AssertIndexRange(local_index,
-                       partitioner->local_size() +
+                       partitioner->locally_owned_size() +
                          partitioner->n_ghost_indices());
 
       return data.values[local_index];
index 28c433026512de14b238c873b8117bf590594657..f41ff44c524264938d64afa37929c5993e289b97 100644 (file)
@@ -591,7 +591,7 @@ namespace LinearAlgebra
         {
           partitioner = v.partitioner;
           const size_type new_allocated_size =
-            partitioner->local_size() + partitioner->n_ghost_indices();
+            partitioner->locally_owned_size() + partitioner->n_ghost_indices();
           resize_val(new_allocated_size, this->comm_sm);
         }
 
@@ -653,7 +653,7 @@ namespace LinearAlgebra
 
       // set vector size and allocate memory
       const size_type new_allocated_size =
-        partitioner->local_size() + partitioner->n_ghost_indices();
+        partitioner->locally_onwed_size() + partitioner->n_ghost_indices();
       resize_val(new_allocated_size, comm_sm);
 
       // initialize to zero
@@ -700,7 +700,10 @@ namespace LinearAlgebra
         {
           dealii::internal::VectorOperations::
             functions<Number, Number, MemorySpaceType>::copy(
-              thread_loop_partitioner, partitioner->local_size(), v.data, data);
+              thread_loop_partitioner,
+              partitioner->locally_owned_size(),
+              v.data,
+              data);
         }
     }
 
@@ -835,7 +838,7 @@ namespace LinearAlgebra
 
       thread_loop_partitioner = c.thread_loop_partitioner;
 
-      const size_type this_size = partitioner->local_size();
+      const size_type this_size = partitioner->locally_owned_size();
       if (this_size > 0)
         {
           dealii::internal::VectorOperations::
@@ -858,13 +861,14 @@ namespace LinearAlgebra
     Vector<Number, MemorySpaceType>::copy_locally_owned_data_from(
       const Vector<Number2, MemorySpaceType> &src)
     {
-      AssertDimension(partitioner->local_size(), src.partitioner->local_size());
-      if (partitioner->local_size() > 0)
+      AssertDimension(partitioner->locally_owned_size(),
+                      src.partitioner->locally_owned_size());
+      if (partitioner->locally_owned_size() > 0)
         {
           dealii::internal::VectorOperations::
             functions<Number, Number2, MemorySpaceType>::copy(
               thread_loop_partitioner,
-              partitioner->local_size(),
+              partitioner->locally_owned_size(),
               src.data,
               data);
         }
@@ -927,14 +931,15 @@ namespace LinearAlgebra
     Vector<Number, MemorySpaceType>::zero_out_ghost_values() const
     {
       if (data.values != nullptr)
-        std::fill_n(data.values.get() + partitioner->local_size(),
+        std::fill_n(data.values.get() + partitioner->locally_owned_size(),
                     partitioner->n_ghost_indices(),
                     Number());
 #ifdef DEAL_II_COMPILER_CUDA_AWARE
       if (data.values_dev != nullptr)
         {
           const cudaError_t cuda_error_code =
-            cudaMemset(data.values_dev.get() + partitioner->local_size(),
+            cudaMemset(data.values_dev.get() +
+                         partitioner->locally_owned_size(),
                        0,
                        partitioner->n_ghost_indices() * sizeof(Number));
           AssertCuda(cuda_error_code);
@@ -1025,7 +1030,7 @@ namespace LinearAlgebra
             operation,
             communication_channel,
             ArrayView<Number, MemorySpace::CUDA>(
-              data.values_dev.get() + partitioner->local_size(),
+              data.values_dev.get() + partitioner->locally_owned_size(),
               partitioner->n_ghost_indices()),
             ArrayView<Number, MemorySpace::CUDA>(
               import_data.values_dev.get(), partitioner->n_import_indices()),
@@ -1038,7 +1043,7 @@ namespace LinearAlgebra
             operation,
             communication_channel,
             ArrayView<Number, MemorySpace::Host>(
-              data.values.get() + partitioner->local_size(),
+              data.values.get() + partitioner->locally_owned_size(),
               partitioner->n_ghost_indices()),
             ArrayView<Number, MemorySpace::Host>(
               import_data.values.get(), partitioner->n_import_indices()),
@@ -1078,10 +1083,10 @@ namespace LinearAlgebra
               operation,
               ArrayView<const Number, MemorySpace::CUDA>(
                 import_data.values_dev.get(), partitioner->n_import_indices()),
-              ArrayView<Number, MemorySpace::CUDA>(data.values_dev.get(),
-                                                   partitioner->local_size()),
               ArrayView<Number, MemorySpace::CUDA>(
-                data.values_dev.get() + partitioner->local_size(),
+                data.values_dev.get(), partitioner->locally_owned_size()),
+              ArrayView<Number, MemorySpace::CUDA>(
+                data.values_dev.get() + partitioner->locally_owned_size(),
                 partitioner->n_ghost_indices()),
               compress_requests);
         }
@@ -1096,10 +1101,10 @@ namespace LinearAlgebra
               operation,
               ArrayView<const Number, MemorySpace::Host>(
                 import_data.values.get(), partitioner->n_import_indices()),
-              ArrayView<Number, MemorySpace::Host>(data.values.get(),
-                                                   partitioner->local_size()),
               ArrayView<Number, MemorySpace::Host>(
-                data.values.get() + partitioner->local_size(),
+                data.values.get(), partitioner->locally_owned_size()),
+              ArrayView<Number, MemorySpace::Host>(
+                data.values.get() + partitioner->locally_owned_size(),
                 partitioner->n_ghost_indices()),
               compress_requests);
         }
@@ -1197,24 +1202,24 @@ namespace LinearAlgebra
         defined(DEAL_II_MPI_WITH_CUDA_SUPPORT))
       partitioner->export_to_ghosted_array_start<Number, MemorySpace::Host>(
         communication_channel,
-        ArrayView<const Number, MemorySpace::Host>(data.values.get(),
-                                                   partitioner->local_size()),
+        ArrayView<const Number, MemorySpace::Host>(
+          data.values.get(), partitioner->locally_owned_size()),
         ArrayView<Number, MemorySpace::Host>(import_data.values.get(),
                                              partitioner->n_import_indices()),
-        ArrayView<Number, MemorySpace::Host>(data.values.get() +
-                                               partitioner->local_size(),
-                                             partitioner->n_ghost_indices()),
+        ArrayView<Number, MemorySpace::Host>(
+          data.values.get() + partitioner->locally_owned_size(),
+          partitioner->n_ghost_indices()),
         update_ghost_values_requests);
 #  else
       partitioner->export_to_ghosted_array_start<Number, MemorySpace::CUDA>(
         communication_channel,
-        ArrayView<const Number, MemorySpace::CUDA>(data.values_dev.get(),
-                                                   partitioner->local_size()),
+        ArrayView<const Number, MemorySpace::CUDA>(
+          data.values_dev.get(), partitioner->locally_owned_size()),
         ArrayView<Number, MemorySpace::CUDA>(import_data.values_dev.get(),
                                              partitioner->n_import_indices()),
-        ArrayView<Number, MemorySpace::CUDA>(data.values_dev.get() +
-                                               partitioner->local_size(),
-                                             partitioner->n_ghost_indices()),
+        ArrayView<Number, MemorySpace::CUDA>(
+          data.values_dev.get() + partitioner->locally_owned_size(),
+          partitioner->n_ghost_indices()),
         update_ghost_values_requests);
 #  endif
 
@@ -1244,13 +1249,13 @@ namespace LinearAlgebra
         defined(DEAL_II_MPI_WITH_CUDA_SUPPORT))
           partitioner->export_to_ghosted_array_finish(
             ArrayView<Number, MemorySpace::Host>(
-              data.values.get() + partitioner->local_size(),
+              data.values.get() + partitioner->locally_owned_size(),
               partitioner->n_ghost_indices()),
             update_ghost_values_requests);
 #  else
           partitioner->export_to_ghosted_array_finish(
             ArrayView<Number, MemorySpace::CUDA>(
-              data.values_dev.get() + partitioner->local_size(),
+              data.values_dev.get() + partitioner->locally_owned_size(),
               partitioner->n_ghost_indices()),
             update_ghost_values_requests);
 #  endif
@@ -1263,8 +1268,9 @@ namespace LinearAlgebra
       if (std::is_same<MemorySpaceType, MemorySpace::CUDA>::value)
         {
           cudaError_t cuda_error_code =
-            cudaMemcpy(data.values_dev.get() + partitioner->local_size(),
-                       data.values.get() + partitioner->local_size(),
+            cudaMemcpy(data.values_dev.get() +
+                         partitioner->locally_owned_size(),
+                       data.values.get() + partitioner->locally_owned_size(),
                        partitioner->n_ghost_indices() * sizeof(Number),
                        cudaMemcpyHostToDevice);
           AssertCuda(cuda_error_code);
@@ -1467,7 +1473,10 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::add_vector(
-          thread_loop_partitioner, partitioner->local_size(), v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          v.data,
+          data);
 
       if (vector_is_ghosted)
         update_ghost_values();
@@ -1492,7 +1501,10 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::subtract_vector(
-          thread_loop_partitioner, partitioner->local_size(), v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          v.data,
+          data);
 
       if (vector_is_ghosted)
         update_ghost_values();
@@ -1510,7 +1522,7 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::add_factor(
-          thread_loop_partitioner, partitioner->local_size(), a, data);
+          thread_loop_partitioner, partitioner->locally_owned_size(), a, data);
 
       if (vector_is_ghosted)
         update_ghost_values();
@@ -1539,7 +1551,11 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::add_av(
-          thread_loop_partitioner, partitioner->local_size(), a, v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          a,
+          v.data,
+          data);
     }
 
 
@@ -1582,7 +1598,7 @@ namespace LinearAlgebra
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::add_avpbw(
           thread_loop_partitioner,
-          partitioner->local_size(),
+          partitioner->locally_owned_size(),
           a,
           b,
           v.data,
@@ -1619,7 +1635,11 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::sadd_xv(
-          thread_loop_partitioner, partitioner->local_size(), x, v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          x,
+          v.data,
+          data);
 
       if (vector_is_ghosted)
         update_ghost_values();
@@ -1647,7 +1667,7 @@ namespace LinearAlgebra
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::sadd_xav(
           thread_loop_partitioner,
-          partitioner->local_size(),
+          partitioner->locally_owned_size(),
           x,
           a,
           v.data,
@@ -1678,7 +1698,10 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::multiply_factor(
-          thread_loop_partitioner, partitioner->local_size(), factor, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          factor,
+          data);
 
       if (vector_is_ghosted)
         update_ghost_values();
@@ -1736,7 +1759,11 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::equ_au(
-          thread_loop_partitioner, partitioner->local_size(), a, v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          a,
+          v.data,
+          data);
 
 
       if (vector_is_ghosted)
@@ -1763,11 +1790,15 @@ namespace LinearAlgebra
       if (PointerComparison::equal(this, &v))
         return norm_sqr_local();
 
-      AssertDimension(partitioner->local_size(), v.partitioner->local_size());
+      AssertDimension(partitioner->locally_owned_size(),
+                      v.partitioner->locally_owned_size());
 
       return dealii::internal::VectorOperations::
         functions<Number, Number2, MemorySpaceType>::dot(
-          thread_loop_partitioner, partitioner->local_size(), v.data, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          v.data,
+          data);
     }
 
 
@@ -1801,7 +1832,10 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::norm_2(
-          thread_loop_partitioner, partitioner->local_size(), sum, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          sum,
+          data);
 
       AssertIsFinite(sum);
 
@@ -1816,14 +1850,14 @@ namespace LinearAlgebra
     {
       Assert(size() != 0, ExcEmptyObject());
 
-      if (partitioner->local_size() == 0)
+      if (partitioner->locally_owned_size() == 0)
         return Number();
 
       Number sum = ::dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::mean_value(
-          thread_loop_partitioner, partitioner->local_size(), data);
+          thread_loop_partitioner, partitioner->locally_owned_size(), data);
 
-      return sum / real_type(partitioner->local_size());
+      return sum / real_type(partitioner->locally_owned_size());
     }
 
 
@@ -1834,8 +1868,9 @@ namespace LinearAlgebra
     {
       Number local_result = mean_value_local();
       if (partitioner->n_mpi_processes() > 1)
-        return Utilities::MPI::sum(local_result * static_cast<real_type>(
-                                                    partitioner->local_size()),
+        return Utilities::MPI::sum(local_result *
+                                     static_cast<real_type>(
+                                       partitioner->locally_owned_size()),
                                    partitioner->get_mpi_communicator()) /
                static_cast<real_type>(partitioner->size());
       else
@@ -1852,7 +1887,10 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::norm_1(
-          thread_loop_partitioner, partitioner->local_size(), sum, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          sum,
+          data);
 
       return sum;
     }
@@ -1904,7 +1942,11 @@ namespace LinearAlgebra
 
       dealii::internal::VectorOperations::
         functions<Number, Number, MemorySpaceType>::norm_p(
-          thread_loop_partitioner, partitioner->local_size(), sum, p, data);
+          thread_loop_partitioner,
+          partitioner->locally_owned_size(),
+          sum,
+          p,
+          data);
 
       return std::pow(sum, 1. / p);
     }
@@ -1933,7 +1975,7 @@ namespace LinearAlgebra
     {
       real_type max = 0.;
 
-      const size_type local_size = partitioner->local_size();
+      const size_type local_size = partitioner->locally_owned_size();
       internal::la_parallel_vector_templates_functions<
         Number,
         MemorySpaceType>::linfty_norm_local(data, local_size, max);
@@ -1964,7 +2006,7 @@ namespace LinearAlgebra
       const Vector<Number, MemorySpaceType> &v,
       const Vector<Number, MemorySpaceType> &w)
     {
-      const size_type vec_size = partitioner->local_size();
+      const size_type vec_size = partitioner->locally_owned_size();
       AssertDimension(vec_size, v.local_size());
       AssertDimension(vec_size, w.local_size());
 
@@ -2085,10 +2127,10 @@ namespace LinearAlgebra
           << "), global size: " << partitioner->size() << std::endl
           << "Vector data:" << std::endl;
       if (across)
-        for (size_type i = 0; i < partitioner->local_size(); ++i)
+        for (size_type i = 0; i < partitioner->locally_owned_size(); ++i)
           out << stored_elements[i] << ' ';
       else
-        for (size_type i = 0; i < partitioner->local_size(); ++i)
+        for (size_type i = 0; i < partitioner->locally_owned_size(); ++i)
           out << stored_elements[i] << std::endl;
       out << std::endl;
 
@@ -2098,12 +2140,14 @@ namespace LinearAlgebra
           if (across)
             for (size_type i = 0; i < partitioner->n_ghost_indices(); ++i)
               out << '(' << partitioner->ghost_indices().nth_index_in_set(i)
-                  << '/' << stored_elements[partitioner->local_size() + i]
+                  << '/'
+                  << stored_elements[partitioner->locally_owned_size() + i]
                   << ") ";
           else
             for (size_type i = 0; i < partitioner->n_ghost_indices(); ++i)
               out << '(' << partitioner->ghost_indices().nth_index_in_set(i)
-                  << '/' << stored_elements[partitioner->local_size() + i]
+                  << '/'
+                  << stored_elements[partitioner->locally_owned_size() + i]
                   << ")" << std::endl;
           out << std::endl;
         }
index 639becf5f4257acad799a3c9ebf1835b54a32b1e..6dcef4b413559c79c9c8e0c91106765eac3554a3 100644 (file)
@@ -130,7 +130,8 @@ namespace LinearAlgebra
         distributed::Vector<Number, ::dealii::MemorySpace::Host> tmp_vector(
           communication_pattern);
 
-        const unsigned int n_elements = communication_pattern->local_size();
+        const unsigned int n_elements =
+          communication_pattern->locally_owned_size();
         std::copy(values, values + n_elements, tmp_vector.begin());
         tmp_vector.update_ghost_values();
 
@@ -173,8 +174,9 @@ namespace LinearAlgebra
         distributed::Vector<Number, ::dealii::MemorySpace::Host> tmp_vector(
           communication_pattern);
 
-        const unsigned int n_elements = communication_pattern->local_size();
-        cudaError_t        cuda_error_code = cudaMemcpy(tmp_vector.begin(),
+        const unsigned int n_elements =
+          communication_pattern->locally_owned_size();
+        cudaError_t cuda_error_code = cudaMemcpy(tmp_vector.begin(),
                                                  values,
                                                  n_elements * sizeof(Number),
                                                  cudaMemcpyDeviceToHost);
index 432f2d505f6907c537c111f50ea7c88044e0c2cb..59274ade9d7f8be62cc1f4282eea5d29c79c16c4 100644 (file)
@@ -1552,7 +1552,7 @@ namespace internal
       // touched by a cell
       AssertDimension(length, vectorization_length);
       const unsigned int n_components = start_components.back();
-      const unsigned int n_dofs       = vector_partitioner->local_size() +
+      const unsigned int n_dofs = vector_partitioner->locally_owned_size() +
                                   vector_partitioner->n_ghost_indices();
       std::vector<unsigned int> touched_first_by(
         (n_dofs + chunk_size_zero_vector - 1) / chunk_size_zero_vector,
@@ -1671,13 +1671,13 @@ namespace internal
                                 chunk_must_zero_vector,
                                 vector_zero_range_list_index,
                                 vector_zero_range_list,
-                                vector_partitioner->local_size());
+                                vector_partitioner->locally_owned_size());
 
       // the other two operations only work on the local range (without
       // ghosts), so we skip the latter parts of the vector now
-      touched_first_by.resize(
-        (vector_partitioner->local_size() + chunk_size_zero_vector - 1) /
-        chunk_size_zero_vector);
+      touched_first_by.resize((vector_partitioner->locally_owned_size() +
+                               chunk_size_zero_vector - 1) /
+                              chunk_size_zero_vector);
 
       // set the import indices in the vector partitioner to one index higher
       // to indicate that we want to process it first. This additional index
@@ -1693,11 +1693,11 @@ namespace internal
                                 chunk_must_do_pre,
                                 cell_loop_pre_list_index,
                                 cell_loop_pre_list,
-                                vector_partitioner->local_size());
+                                vector_partitioner->locally_owned_size());
 
-      touched_last_by.resize(
-        (vector_partitioner->local_size() + chunk_size_zero_vector - 1) /
-        chunk_size_zero_vector);
+      touched_last_by.resize((vector_partitioner->locally_owned_size() +
+                              chunk_size_zero_vector - 1) /
+                             chunk_size_zero_vector);
 
       // set the indices which were not touched by the cell loop (i.e.,
       // constrained indices) to the last valid partition index. Since
@@ -1720,7 +1720,7 @@ namespace internal
                                 chunk_must_do_post,
                                 cell_loop_post_list_index,
                                 cell_loop_post_list,
-                                vector_partitioner->local_size());
+                                vector_partitioner->locally_owned_size());
     }
 
 
@@ -1972,9 +1972,10 @@ namespace internal
     DoFInfo::compute_dof_renumbering(
       std::vector<types::global_dof_index> &renumbering)
     {
-      const unsigned int local_size = vector_partitioner->local_size();
+      const unsigned int locally_owned_size =
+        vector_partitioner->locally_owned_size();
       renumbering.resize(0);
-      renumbering.resize(local_size, numbers::invalid_dof_index);
+      renumbering.resize(locally_owned_size, numbers::invalid_dof_index);
 
       types::global_dof_index counter      = 0;
       const unsigned int      n_components = start_components.back();
@@ -2004,14 +2005,14 @@ namespace internal
                 for (unsigned int j = 0;
                      j < n_vectorization_lanes_filled[dof_access_cell][cell_no];
                      ++j)
-                  if (dof_ind[j * ndofs + i] < local_size)
+                  if (dof_ind[j * ndofs + i] < locally_owned_size)
                     if (renumbering[dof_ind[j * ndofs + i]] ==
                         numbers::invalid_dof_index)
                       renumbering[dof_ind[j * ndofs + i]] = counter++;
             }
         }
 
-      AssertIndexRange(counter, local_size + 1);
+      AssertIndexRange(counter, locally_owned_size + 1);
       for (types::global_dof_index &dof_index : renumbering)
         if (dof_index == numbers::invalid_dof_index)
           dof_index = counter++;
index 6e407a20530c35e2504cbf793b98d8d03f8244f7..15aa5ffab162f8c52ff7cd08aa25b73debe779a9 100644 (file)
@@ -3466,10 +3466,10 @@ namespace internal
 
           part.export_to_ghosted_array_start(
             component_in_block_vector * 2 + channel_shift,
-            ArrayView<const Number>(vec.begin(), part.local_size()),
+            ArrayView<const Number>(vec.begin(), part.locally_owned_size()),
             vec.shared_vector_data(),
             ArrayView<Number>(const_cast<Number *>(vec.begin()) +
-                                part.local_size(),
+                                part.locally_owned_size(),
                               matrix_free.get_dof_info(mf_component)
                                 .vector_partitioner->n_ghost_indices()),
             ArrayView<Number>(tmp_data[component_in_block_vector]->begin(),
@@ -3550,10 +3550,10 @@ namespace internal
               part.n_import_sm_procs() != 0)
             {
               part.export_to_ghosted_array_finish(
-                ArrayView<const Number>(vec.begin(), part.local_size()),
+                ArrayView<const Number>(vec.begin(), part.locally_owned_size()),
                 vec.shared_vector_data(),
                 ArrayView<Number>(const_cast<Number *>(vec.begin()) +
-                                    part.local_size(),
+                                    part.locally_owned_size(),
                                   matrix_free.get_dof_info(mf_component)
                                     .vector_partitioner->n_ghost_indices()),
                 this->requests[component_in_block_vector]);
@@ -3664,12 +3664,10 @@ namespace internal
 
           part.import_from_ghosted_array_start(
             dealii::VectorOperation::add,
-            component_in_block_vector * 2 + channel_shift,
-            ArrayView<Number>(vec.begin(), part.local_size()),
-            vec.shared_vector_data(),
-            ArrayView<Number>(vec.begin() + part.local_size(),
-                              matrix_free.get_dof_info(mf_component)
-                                .vector_partitioner->n_ghost_indices()),
+            component_in_block_vector + channel_shift,
+            ArrayView<Number>(vec.begin() +
+                                vec.get_partitioner()->locally_owned_size(),
+                              vec.get_partitioner()->n_ghost_indices()),
             ArrayView<Number>(tmp_data[component_in_block_vector]->begin(),
                               part.n_import_indices()),
             this->requests[component_in_block_vector]);
@@ -3747,9 +3745,9 @@ namespace internal
             {
               part.import_from_ghosted_array_finish(
                 VectorOperation::add,
-                ArrayView<Number>(vec.begin(), part.local_size()),
+                ArrayView<Number>(vec.begin(), part.locally_owned_size()),
                 vec.shared_vector_data(),
-                ArrayView<Number>(vec.begin() + part.local_size(),
+                ArrayView<Number>(vec.begin() + part.locally_owned_size(),
                                   matrix_free.get_dof_info(mf_component)
                                     .vector_partitioner->n_ghost_indices()),
                 ArrayView<const Number>(
@@ -3830,12 +3828,19 @@ namespace internal
 
           if (part.n_ghost_indices() > 0)
             {
-              part.reset_ghost_values(ArrayView<Number>(
-                const_cast<LinearAlgebra::distributed::Vector<Number> &>(vec)
-                    .begin() +
-                  part.local_size(),
-                matrix_free.get_dof_info(mf_component)
-                  .vector_partitioner->n_ghost_indices()));
+              for (std::vector<std::pair<unsigned int, unsigned int>>::
+                     const_iterator my_ghosts =
+                       part.ghost_indices_within_larger_ghost_set().begin();
+                   my_ghosts !=
+                   part.ghost_indices_within_larger_ghost_set().end();
+                   ++my_ghosts)
+                for (unsigned int j = my_ghosts->first; j < my_ghosts->second;
+                     j++)
+                  {
+                    const_cast<LinearAlgebra::distributed::Vector<Number> &>(
+                      vec)
+                      .local_element(j + part.locally_owned_size()) = 0.;
+                  }
             }
 
 #  endif
@@ -4742,7 +4747,7 @@ namespace internal
               // Case with threaded loop -> currently no overlap implemented
               dealii::parallel::apply_to_subranges(
                 0U,
-                dof_info.vector_partitioner->local_size(),
+                dof_info.vector_partitioner->locally_owned_size(),
                 operation_before_loop,
                 internal::VectorImplementation::minimum_parallel_grain_size);
             }
@@ -4772,7 +4777,7 @@ namespace internal
               // Case with threaded loop -> currently no overlap implemented
               dealii::parallel::apply_to_subranges(
                 0U,
-                dof_info.vector_partitioner->local_size(),
+                dof_info.vector_partitioner->locally_owned_size(),
                 operation_after_loop,
                 internal::VectorImplementation::minimum_parallel_grain_size);
             }
index 6b2945e16e03ba416fdd7c6b9817ce47c94e4d48..c72d24d994d978d4b5c20cb8f253646e0423b604 100644 (file)
@@ -1375,11 +1375,14 @@ namespace MatrixFreeOperators
 
         // If not, assert that the local ranges are the same and reset to the
         // current partitioner
-        Assert(
-          BlockHelper::subblock(src, i).get_partitioner()->local_size() ==
-            data->get_dof_info(mf_component).vector_partitioner->local_size(),
-          ExcMessage("The vector passed to the vmult() function does not have "
-                     "the correct size for compatibility with MatrixFree."));
+        Assert(BlockHelper::subblock(src, i)
+                   .get_partitioner()
+                   ->locally_owned_size() ==
+                 data->get_dof_info(mf_component)
+                   .vector_partitioner->locally_owned_size(),
+               ExcMessage(
+                 "The vector passed to the vmult() function does not have "
+                 "the correct size for compatibility with MatrixFree."));
 
         // copy the vector content to a temporary vector so that it does not get
         // lost
index b0eee440d6c1fe864331ac190a0f93b181cfc98a..33acfd77baae8bccb269b97e2951978d31d6de18 100644 (file)
@@ -227,7 +227,7 @@ namespace Utilities
           return;
         }
 
-      types::global_dof_index my_size = local_size();
+      types::global_dof_index my_size = locally_owned_size();
 
       // Allow non-zero start index for the vector. Part 1:
       // Assume for now that the index set of rank 0 starts with 0
@@ -258,9 +258,10 @@ namespace Utilities
       // information.
       if (local_range_data.first == 0 && my_shift != 0)
         {
-          const types::global_dof_index old_local_size = local_size();
-          local_range_data.first                       = my_shift;
-          local_range_data.second = my_shift + old_local_size;
+          const types::global_dof_index old_locally_owned_size =
+            locally_owned_size();
+          local_range_data.first  = my_shift;
+          local_range_data.second = my_shift + old_locally_owned_size;
         }
 
       std::vector<unsigned int> owning_ranks_of_ghosts(

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.