From: Wolfgang Bangerth Date: Thu, 29 Jul 2021 01:30:09 +0000 (-0600) Subject: Fix a few type mistakes in AlignedVector. X-Git-Tag: v9.4.0-rc1~1115^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12607%2Fhead;p=dealii.git Fix a few type mistakes in AlignedVector. --- diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index de72cb524b..b0e248ba2e 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -1161,7 +1161,7 @@ template inline void AlignedVector::insert_back(ForwardIterator begin, ForwardIterator end) { - const unsigned int old_size = size(); + const size_type old_size = size(); reserve(old_size + (end - begin)); for (; begin != end; ++begin, ++used_elements_end) { @@ -1461,8 +1461,7 @@ AlignedVector::replicate_across_communicator(const MPI_Comm & communicator, // We don't need to do this on the shmem root process: This process has // already gotten its base_ptr correctly set above, and we can determine the // array size by just calling size(). - unsigned int array_size = - (is_shmem_root ? size() : numbers::invalid_unsigned_int); + size_type array_size = (is_shmem_root ? size() : size_type(0)); if (is_shmem_root == false) { int disp_unit; @@ -1559,24 +1558,24 @@ AlignedVector::replicate_across_communicator(const MPI_Comm & communicator, // the shmem root!) but also destroy the MPI_Win and the communicator. All of // that is encapsulated in the following call where the deleter makes copies // of the arguments in the lambda capture. - elements = - decltype(elements)(aligned_shmem_pointer, - [is_shmem_root, - array_size, - aligned_shmem_pointer, - shmem_group_communicator, - shmem_window](T *) mutable { - if (is_shmem_root) - for (unsigned int i = 0; i < array_size; ++i) - aligned_shmem_pointer[i].~T(); - - int ierr; - ierr = MPI_Win_free(&shmem_window); - AssertThrowMPI(ierr); - - ierr = MPI_Comm_free(&shmem_group_communicator); - AssertThrowMPI(ierr); - }); + elements = decltype(elements)(aligned_shmem_pointer, + [is_shmem_root, + array_size, + aligned_shmem_pointer, + shmem_group_communicator, + shmem_window](T *) mutable { + if (is_shmem_root) + for (size_type i = 0; i < array_size; ++i) + aligned_shmem_pointer[i].~T(); + + int ierr; + ierr = MPI_Win_free(&shmem_window); + AssertThrowMPI(ierr); + + ierr = + MPI_Comm_free(&shmem_group_communicator); + AssertThrowMPI(ierr); + }); // We then also have to set the other two pointers that define the state of // the current object. Note that the new buffer size is exactly as large as