From d605187fd00ef1fbc574aac0471164a40cab61f2 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 7 Dec 2022 15:57:44 +0000 Subject: [PATCH] Fix some deprecations --- .../lac/affine_constraints.templates.h | 11 +++++----- include/deal.II/lac/la_vector.templates.h | 2 +- include/deal.II/lac/read_write_vector.h | 8 +++---- .../deal.II/lac/read_write_vector.templates.h | 21 ++++++++++--------- .../mg_transfer_global_coarsening.templates.h | 14 ++++++------- source/base/mpi.cc | 4 ++-- source/base/mpi_noncontiguous_partitioner.cc | 4 ++-- source/base/partitioner.cc | 4 ++-- .../repartitioning_policy_tools.cc | 6 +++--- source/grid/tria_description.cc | 6 +++--- source/matrix_free/dof_info.cc | 8 +++---- source/matrix_free/vector_data_exchange.cc | 4 ++-- 12 files changed, 47 insertions(+), 45 deletions(-) diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 2d560d124b..044e35ade9 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -262,8 +262,9 @@ namespace internal Utilities::MPI::ConsensusAlgorithms::Selector< std::vector>, - std::vector>(constrained_indices_process, mpi_communicator) - .run(); + std::vector> + consensus_algorithm; + consensus_algorithm.run(constrained_indices_process, mpi_communicator); // step 2: collect all locally owned constraints const auto constrained_indices_by_ranks = @@ -390,9 +391,9 @@ namespace internal Utilities::MPI::ConsensusAlgorithms::Selector< std::vector< std::pair>, - std::vector>(locally_relevant_dofs_process, - mpi_communicator) - .run(); + std::vector> + consensus_algorithm; + consensus_algorithm.run(locally_relevant_dofs_process, mpi_communicator); const auto locally_relevant_dofs_by_ranks = locally_relevant_dofs_process.get_requesters(); diff --git a/include/deal.II/lac/la_vector.templates.h b/include/deal.II/lac/la_vector.templates.h index d257624eca..1d56f6462f 100644 --- a/include/deal.II/lac/la_vector.templates.h +++ b/include/deal.II/lac/la_vector.templates.h @@ -557,7 +557,7 @@ namespace LinearAlgebra out.precision(precision); - const unsigned int n_elements = this->n_elements(); + const unsigned int n_elements = this->locally_owned_size(); for (unsigned int i = 0; i < n_elements; ++i) out << this->values[i] << ' '; out << '\n' << std::flush; diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index d3ec6df772..14b6f445ab 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -900,7 +900,7 @@ namespace LinearAlgebra inline typename ReadWriteVector::iterator ReadWriteVector::end() { - return values.get() + this->n_elements(); + return values.get() + this->locally_owned_size(); } @@ -909,7 +909,7 @@ namespace LinearAlgebra inline typename ReadWriteVector::const_iterator ReadWriteVector::end() const { - return values.get() + this->n_elements(); + return values.get() + this->locally_owned_size(); } @@ -985,7 +985,7 @@ namespace LinearAlgebra inline Number ReadWriteVector::local_element(const size_type local_index) const { - AssertIndexRange(local_index, this->n_elements()); + AssertIndexRange(local_index, this->locally_owned_size()); return values[local_index]; } @@ -996,7 +996,7 @@ namespace LinearAlgebra inline Number & ReadWriteVector::local_element(const size_type local_index) { - AssertIndexRange(local_index, this->n_elements()); + AssertIndexRange(local_index, this->locally_owned_size()); return values[local_index]; } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index 6972b59584..d1b9d6c070 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -265,7 +265,7 @@ namespace LinearAlgebra ReadWriteVector::reinit(const ReadWriteVector &v, const bool omit_zeroing_entries) { - resize_val(v.n_elements()); + resize_val(v.locally_owned_size()); stored_elements = v.get_stored_elements(); @@ -339,7 +339,7 @@ namespace LinearAlgebra FunctorTemplate functor(*this, func); dealii::internal::VectorOperations::parallel_for(functor, 0, - n_elements(), + locally_owned_size(), thread_loop_partitioner); } @@ -353,15 +353,15 @@ namespace LinearAlgebra return *this; thread_loop_partitioner = in_vector.thread_loop_partitioner; - if (n_elements() != in_vector.n_elements()) + if (locally_owned_size() != in_vector.locally_owned_size()) reinit(in_vector, true); - if (n_elements() > 0) + if (locally_owned_size() > 0) { dealii::internal::VectorOperations::Vector_copy copier( in_vector.values.get(), values.get()); dealii::internal::VectorOperations::parallel_for( - copier, 0, n_elements(), thread_loop_partitioner); + copier, 0, locally_owned_size(), thread_loop_partitioner); } return *this; @@ -375,15 +375,15 @@ namespace LinearAlgebra ReadWriteVector::operator=(const ReadWriteVector &in_vector) { thread_loop_partitioner = in_vector.thread_loop_partitioner; - if (n_elements() != in_vector.n_elements()) + if (locally_owned_size() != in_vector.locally_owned_size()) reinit(in_vector, true); - if (n_elements() > 0) + if (locally_owned_size() > 0) { dealii::internal::VectorOperations::Vector_copy copier( in_vector.values.get(), values.get()); dealii::internal::VectorOperations::parallel_for( - copier, 0, n_elements(), thread_loop_partitioner); + copier, 0, locally_owned_size(), thread_loop_partitioner); } return *this; @@ -399,7 +399,7 @@ namespace LinearAlgebra ExcMessage("Only 0 can be assigned to a vector.")); (void)s; - const size_type this_size = n_elements(); + const size_type this_size = locally_owned_size(); if (this_size > 0) { dealii::internal::VectorOperations::Vector_set setter( @@ -999,7 +999,8 @@ namespace LinearAlgebra ReadWriteVector::memory_consumption() const { std::size_t memory = sizeof(*this); - memory += sizeof(Number) * static_cast(this->n_elements()); + memory += + sizeof(Number) * static_cast(this->locally_owned_size()); memory += stored_elements.memory_consumption(); diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 664fba2f8a..1dd8eb62e2 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -570,8 +570,8 @@ namespace internal std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); } for (unsigned i = 0; @@ -597,8 +597,8 @@ namespace internal std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); this->is_dst_locally_owned = is_dst_locally_owned; this->is_dst_remote = is_dst_remote; @@ -1134,7 +1134,7 @@ namespace internal touch_count_.copy_locally_owned_data_from(touch_count); - for (unsigned int i = 0; i < touch_count_.local_size(); ++i) + for (unsigned int i = 0; i < touch_count_.locally_owned_size(); ++i) touch_count_.local_element(i) = constraints_fine.is_constrained( touch_count_.get_partitioner()->local_to_global(i)) ? @@ -3224,8 +3224,8 @@ MGTwoLevelTransfer>::reinit( std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); bool all_cells_found = true; diff --git a/source/base/mpi.cc b/source/base/mpi.cc index cb58254d59..121353f857 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -1070,8 +1070,8 @@ namespace Utilities std::vector< std::pair>, std::vector> - consensus_algorithm(process, comm); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, comm); return owning_ranks; } diff --git a/source/base/mpi_noncontiguous_partitioner.cc b/source/base/mpi_noncontiguous_partitioner.cc index 3ae4c9c51f..ac842e2ff1 100644 --- a/source/base/mpi_noncontiguous_partitioner.cc +++ b/source/base/mpi_noncontiguous_partitioner.cc @@ -121,8 +121,8 @@ namespace Utilities std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); // setup map of processes from where this rank will receive values { diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index c8689d9606..89ef30f6e5 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -288,8 +288,8 @@ namespace Utilities std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); { ghost_targets_data = {}; diff --git a/source/distributed/repartitioning_policy_tools.cc b/source/distributed/repartitioning_policy_tools.cc index d7b25c6590..e1deb26c1b 100644 --- a/source/distributed/repartitioning_policy_tools.cc +++ b/source/distributed/repartitioning_policy_tools.cc @@ -159,8 +159,8 @@ namespace RepartitioningPolicyTools std::vector< std::pair>, std::vector> - consensus_algorithm(process, communicator); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, communicator); } const auto tria = @@ -288,7 +288,7 @@ namespace RepartitioningPolicyTools const auto partitioner = tria->global_active_cell_index_partitioner().lock(); - std::vector weights(partitioner->local_size()); + std::vector weights(partitioner->locally_owned_size()); const auto mpi_communicator = tria_in.get_communicator(); const auto n_subdomains = Utilities::MPI::n_mpi_processes(mpi_communicator); diff --git a/source/grid/tria_description.cc b/source/grid/tria_description.cc index ed35ad410d..1484356c5f 100644 --- a/source/grid/tria_description.cc +++ b/source/grid/tria_description.cc @@ -993,7 +993,7 @@ namespace TriangulationDescription { #ifdef DEAL_II_WITH_MPI if (tria.get_communicator() == MPI_COMM_NULL) - AssertDimension(partition.local_size(), 0); + AssertDimension(partition.locally_owned_size(), 0); #endif if (partition.size() == 0) @@ -1013,12 +1013,12 @@ namespace TriangulationDescription const std::vector relevant_processes = [&]() { std::set relevant_processes; - for (unsigned int i = 0; i < partition.local_size(); ++i) + for (unsigned int i = 0; i < partition.locally_owned_size(); ++i) relevant_processes.insert( static_cast(partition.local_element(i))); for (const auto &partition : partitions_mg) - for (unsigned int i = 0; i < partition.local_size(); ++i) + for (unsigned int i = 0; i < partition.locally_owned_size(); ++i) relevant_processes.insert( static_cast(partition.local_element(i))); diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index eb3e1edaeb..b51828f6af 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -908,7 +908,7 @@ namespace internal for (unsigned int i = row_starts[cell * n_components].first; i < row_starts[(cell + 1) * n_components].first; ++i) - if (dof_indices[i] >= part.local_size()) + if (dof_indices[i] >= part.locally_owned_size()) ghost_indices.push_back(part.local_to_global(dof_indices[i])); const unsigned int fe_index = @@ -919,7 +919,7 @@ namespace internal for (unsigned int i = row_starts_plain_indices[cell]; i < row_starts_plain_indices[cell] + dofs_this_cell; ++i) - if (plain_dof_indices[i] >= part.local_size()) + if (plain_dof_indices[i] >= part.locally_owned_size()) ghost_indices.push_back( part.local_to_global(plain_dof_indices[i])); } @@ -1048,7 +1048,7 @@ namespace internal const unsigned int index = dof_indices_contiguous[dof_access_cell][cell_no]; if (flag || (index != numbers::invalid_unsigned_int && - index >= part.local_size())) + index >= part.locally_owned_size())) { const unsigned int stride = dof_indices_interleave_strides[dof_access_cell][cell_no]; @@ -1132,7 +1132,7 @@ namespace internal const unsigned int index = dof_indices_contiguous[dof_access_cell][cell_no]; if (flag || (index != numbers::invalid_unsigned_int && - index >= part.local_size())) + index >= part.locally_owned_size())) { const unsigned int stride = dof_indices_interleave_strides[dof_access_cell][cell_no]; diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index 12f6661f34..c3600fbe3a 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -443,8 +443,8 @@ namespace internal std::vector< std::pair>, std::vector> - consensus_algorithm(process, comm); - consensus_algorithm.run(); + consensus_algorithm; + consensus_algorithm.run(process, comm); // decompress ghost_indices_within_larger_ghost_set for simpler // data access during setup -- 2.39.5