From 67423d738a0808d4caf9bdbb2f14153ddadd8c70 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 23 Mar 2020 11:13:26 +0100 Subject: [PATCH] Rename variables --- include/deal.II/lac/la_sm_vector.h | 38 ++--- include/deal.II/lac/la_sm_vector.templates.h | 144 +++++++++---------- 2 files changed, 84 insertions(+), 98 deletions(-) diff --git a/include/deal.II/lac/la_sm_vector.h b/include/deal.II/lac/la_sm_vector.h index 423e3403e1..ff4628a28b 100644 --- a/include/deal.II/lac/la_sm_vector.h +++ b/include/deal.II/lac/la_sm_vector.h @@ -135,8 +135,8 @@ namespace LinearAlgebra Vector(const IndexSet &local_range, const MPI_Comm communicator); - Vector( - const std::shared_ptr &partitioner); + Vector(const std::shared_ptr + &partitioner_old); virtual ~Vector() override; @@ -157,9 +157,9 @@ namespace LinearAlgebra reinit(const IndexSet &local_range, const MPI_Comm communicator); void - reinit( - const std::shared_ptr &partitioner, - const std::shared_ptr &partitioner_sm); + reinit(const std::shared_ptr + & partitioner_old, + const std::shared_ptr &partitioner); void swap(Vector &v); @@ -475,9 +475,9 @@ namespace LinearAlgebra const Vector &V, const Vector &W); - std::shared_ptr partitioner; + std::shared_ptr partitioner_old; - std::shared_ptr partitioner_sm; + std::shared_ptr partitioner; size_type allocated_size; @@ -565,7 +565,7 @@ namespace LinearAlgebra inline typename Vector::size_type Vector::local_size() const { - return partitioner->local_size(); + return partitioner_old->local_size(); } @@ -620,7 +620,7 @@ namespace LinearAlgebra Vector::ghost_elements() const { Assert(false, ExcNotImplemented()); - return partitioner->ghost_indices(); + return partitioner_old->ghost_indices(); } @@ -660,7 +660,7 @@ namespace LinearAlgebra Vector::end() { return internal::Policy::begin(data) + - partitioner->local_size(); + partitioner_old->local_size(); } @@ -670,7 +670,7 @@ namespace LinearAlgebra Vector::end() const { return internal::Policy::begin(data) + - partitioner->local_size(); + partitioner_old->local_size(); } @@ -680,7 +680,7 @@ namespace LinearAlgebra Vector::operator()(const size_type global_index) const { Assert(false, ExcNotImplemented()); - return data.values[partitioner->global_to_local(global_index)]; + return data.values[partitioner_old->global_to_local(global_index)]; } @@ -690,7 +690,7 @@ namespace LinearAlgebra Vector::operator()(const size_type global_index) { Assert(false, ExcNotImplemented()); - return data.values[partitioner->global_to_local(global_index)]; + return data.values[partitioner_old->global_to_local(global_index)]; } @@ -724,8 +724,8 @@ namespace LinearAlgebra ExcMessage( "This function is only implemented for the Host memory space")); AssertIndexRange(local_index, - partitioner->local_size() + - partitioner->n_ghost_indices()); + partitioner_old->local_size() + + partitioner_old->n_ghost_indices()); // do not allow reading a vector which is not in ghost mode Assert(local_index < local_size() || vector_is_ghosted == true, ExcMessage("You tried to read a ghost element of this vector, " @@ -745,8 +745,8 @@ namespace LinearAlgebra "This function is only implemented for the Host memory space")); AssertIndexRange(local_index, - partitioner->local_size() + - partitioner->n_ghost_indices()); + partitioner_old->local_size() + + partitioner_old->n_ghost_indices()); return data.values[local_index]; } @@ -827,7 +827,7 @@ namespace LinearAlgebra Vector::get_mpi_communicator() const { Assert(false, ExcNotImplemented()); - return partitioner->get_mpi_communicator(); + return partitioner_old->get_mpi_communicator(); } @@ -836,7 +836,7 @@ namespace LinearAlgebra inline const std::shared_ptr & Vector::get_partitioner() const { - return partitioner; + return partitioner_old; } diff --git a/include/deal.II/lac/la_sm_vector.templates.h b/include/deal.II/lac/la_sm_vector.templates.h index 28975551b3..fe30bb8a18 100644 --- a/include/deal.II/lac/la_sm_vector.templates.h +++ b/include/deal.II/lac/la_sm_vector.templates.h @@ -138,7 +138,7 @@ namespace LinearAlgebra Vector::clear_mpi_requests() { // TODO: what is the use of this? - // it should probably delegated to partitioner + // it should probably delegated to partitioner_old } @@ -181,20 +181,20 @@ namespace LinearAlgebra const bool omit_zeroing_entries) { clear_mpi_requests(); - Assert(v.partitioner.get() != nullptr, ExcNotInitialized()); + Assert(v.partitioner_old.get() != nullptr, ExcNotInitialized()); // check whether the partitioners are // different (check only if the are allocated // differently, not if the actual data is // different) - if (partitioner.get() != v.partitioner.get()) + if (partitioner_old.get() != v.partitioner_old.get()) { - partitioner = v.partitioner; - partitioner_sm = v.partitioner_sm; + partitioner_old = v.partitioner_old; + partitioner = v.partitioner; const size_type new_allocated_size = - partitioner_sm->local_size() + partitioner_sm->n_ghost_indices(); + partitioner->local_size() + partitioner->n_ghost_indices(); resize_val(new_allocated_size, - partitioner_sm->get_sm_mpi_communicator()); + partitioner->get_sm_mpi_communicator()); } if (omit_zeroing_entries == false) @@ -244,18 +244,17 @@ namespace LinearAlgebra template void Vector::reinit( - const std::shared_ptr &partitioner, - const std::shared_ptr & partitioner_sm) + const std::shared_ptr &partitioner_old, + const std::shared_ptr & partitioner) { clear_mpi_requests(); - this->partitioner = partitioner; - this->partitioner_sm = partitioner_sm; + this->partitioner_old = partitioner_old; + this->partitioner = partitioner; // set vector size and allocate memory const size_type new_allocated_size = - this->partitioner_sm->local_size() + - this->partitioner_sm->n_ghost_indices(); - resize_val(new_allocated_size, partitioner_sm->get_sm_mpi_communicator()); + this->partitioner->local_size() + this->partitioner->n_ghost_indices(); + resize_val(new_allocated_size, partitioner->get_sm_mpi_communicator()); // initialize to zero this->operator=(Number()); @@ -274,7 +273,7 @@ namespace LinearAlgebra template Vector::Vector() - : partitioner(new Utilities::MPI::Partitioner()) + : partitioner_old(new Utilities::MPI::Partitioner()) , allocated_size(0) {} @@ -296,10 +295,7 @@ namespace LinearAlgebra { dealii::internal::VectorOperations:: functions::copy( - thread_loop_partitioner, - partitioner_sm->local_size(), - v.data, - data); + thread_loop_partitioner, partitioner->local_size(), v.data, data); } } @@ -346,12 +342,12 @@ namespace LinearAlgebra template Vector::Vector( - const std::shared_ptr &partitioner) + const std::shared_ptr &partitioner_old) : allocated_size(0) , vector_is_ghosted(false) { Assert(false, ExcNotImplemented()); - (void)partitioner; + (void)partitioner_old; } @@ -389,14 +385,14 @@ namespace LinearAlgebra Vector:: operator=(const Vector &c) { - Assert(c.partitioner.get() != nullptr, ExcNotInitialized()); + Assert(c.partitioner_old.get() != nullptr, ExcNotInitialized()); // we update ghost values whenever one of the input or output vector // already held ghost values or when we import data from a vector with // the same local range but different ghost layout bool must_update_ghost_values = c.vector_is_ghosted; - // check whether the two vectors use the same parallel partitioner. if + // check whether the two vectors use the same parallel partitioner_old. if // not, check if all local ranges are the same (that way, we can // exchange data between different parallel layouts). One variant which // is included here and necessary for compatibility with the other @@ -404,22 +400,23 @@ namespace LinearAlgebra // c does not have any ghosts (constructed without ghost elements given) // but the current vector does: In that case, we need to exchange data // also when none of the two vector had updated its ghost values before. - if (partitioner.get() == nullptr) + if (partitioner_old.get() == nullptr) reinit(c, true); - else if (partitioner.get() != c.partitioner.get()) + else if (partitioner_old.get() != c.partitioner_old.get()) { // local ranges are also the same if both partitioners are empty // (even if they happen to define the empty range as [0,0) or [c,c) // for some c!=0 in a different way). int local_ranges_are_identical = - (partitioner->local_range() == c.partitioner->local_range() || - (partitioner->local_range().second == - partitioner->local_range().first && - c.partitioner->local_range().second == - c.partitioner->local_range().first)); - if ((c.partitioner->n_mpi_processes() > 1 && + (partitioner_old->local_range() == + c.partitioner_old->local_range() || + (partitioner_old->local_range().second == + partitioner_old->local_range().first && + c.partitioner_old->local_range().second == + c.partitioner_old->local_range().first)); + if ((c.partitioner_old->n_mpi_processes() > 1 && Utilities::MPI::min(local_ranges_are_identical, - c.partitioner->get_mpi_communicator()) == + c.partitioner_old->get_mpi_communicator()) == 0) || !local_ranges_are_identical) reinit(c, true); @@ -427,15 +424,15 @@ namespace LinearAlgebra must_update_ghost_values |= vector_is_ghosted; must_update_ghost_values |= - (c.partitioner->ghost_indices_initialized() == false && - partitioner->ghost_indices_initialized() == true); + (c.partitioner_old->ghost_indices_initialized() == false && + partitioner_old->ghost_indices_initialized() == true); } else must_update_ghost_values |= vector_is_ghosted; thread_loop_partitioner = c.thread_loop_partitioner; - const size_type this_size = partitioner_sm->local_size(); + const size_type this_size = partitioner->local_size(); if (this_size > 0) { dealii::internal::VectorOperations:: @@ -504,8 +501,8 @@ namespace LinearAlgebra Vector::zero_out_ghosts() const { if (data.values != nullptr) - std::fill_n(data.values.get() + partitioner_sm->local_size(), - partitioner_sm->n_ghost_indices(), + std::fill_n(data.values.get() + partitioner->local_size(), + partitioner->n_ghost_indices(), Number()); vector_is_ghosted = false; @@ -523,10 +520,10 @@ namespace LinearAlgebra ExcNotImplemented()); Assert(vector_is_ghosted == false, ExcMessage("Cannot call compress() on a ghosted vector")); - partitioner_sm->compress_start(data.values.get(), - data.others, - import_data, - communication_channel); + partitioner->compress_start(data.values.get(), + data.others, + import_data, + communication_channel); } @@ -539,9 +536,7 @@ namespace LinearAlgebra Assert(::dealii::VectorOperation::values::add == operation, ExcNotImplemented()); vector_is_ghosted = false; - partitioner_sm->compress_finish(data.values.get(), - data.others, - import_data); + partitioner->compress_finish(data.values.get(), data.others, import_data); } @@ -551,10 +546,10 @@ namespace LinearAlgebra Vector::update_ghost_values_start( const unsigned int communication_channel) const { - partitioner_sm->update_ghost_values_start(data.values.get(), - data.others, - import_data, - communication_channel); + partitioner->update_ghost_values_start(data.values.get(), + data.others, + import_data, + communication_channel); } @@ -563,9 +558,9 @@ namespace LinearAlgebra void Vector::update_ghost_values_finish() const { - partitioner_sm->update_ghost_values_finish(data.values.get(), - data.others, - import_data); + partitioner->update_ghost_values_finish(data.values.get(), + data.others, + import_data); vector_is_ghosted = true; } @@ -656,7 +651,7 @@ namespace LinearAlgebra dealii::internal::VectorOperations:: functions::subtract_vector( - thread_loop_partitioner, partitioner_sm->local_size(), v.data, data); + thread_loop_partitioner, partitioner->local_size(), v.data, data); if (vector_is_ghosted) update_ghost_values(); @@ -697,11 +692,7 @@ namespace LinearAlgebra dealii::internal::VectorOperations:: functions::add_av( - thread_loop_partitioner, - partitioner_sm->local_size(), - a, - v.data, - data); + thread_loop_partitioner, partitioner->local_size(), a, v.data, data); } @@ -780,7 +771,7 @@ namespace LinearAlgebra dealii::internal::VectorOperations:: functions::sadd_xav( thread_loop_partitioner, - partitioner_sm->local_size(), + partitioner->local_size(), x, a, v.data, @@ -884,11 +875,7 @@ namespace LinearAlgebra dealii::internal::VectorOperations:: functions::equ_au( - thread_loop_partitioner, - partitioner_sm->local_size(), - a, - v.data, - data); + thread_loop_partitioner, partitioner->local_size(), a, v.data, data); if (vector_is_ghosted) @@ -932,12 +919,11 @@ namespace LinearAlgebra if (PointerComparison::equal(this, &v)) return norm_sqr_local(); - AssertDimension(partitioner_sm->local_size(), - v.partitioner_sm->local_size()); + AssertDimension(partitioner->local_size(), v.partitioner->local_size()); return dealii::internal::VectorOperations:: functions::dot( - thread_loop_partitioner, partitioner_sm->local_size(), v.data, data); + thread_loop_partitioner, partitioner->local_size(), v.data, data); } @@ -953,9 +939,9 @@ namespace LinearAlgebra const VectorType &v = dynamic_cast(vv); Number local_result = inner_product_local(v); - if (partitioner_sm->n_mpi_processes() > 1) + if (partitioner->n_mpi_processes() > 1) return Utilities::MPI::sum(local_result, - partitioner_sm->get_mpi_communicator()); + partitioner->get_mpi_communicator()); else return local_result; } @@ -971,7 +957,7 @@ namespace LinearAlgebra dealii::internal::VectorOperations:: functions::norm_2( - thread_loop_partitioner, partitioner_sm->local_size(), sum, data); + thread_loop_partitioner, partitioner->local_size(), sum, data); AssertIsFinite(sum); @@ -1025,9 +1011,9 @@ namespace LinearAlgebra Vector::norm_sqr() const { real_type local_result = norm_sqr_local(); - if (partitioner_sm->n_mpi_processes() > 1) + if (partitioner->n_mpi_processes() > 1) return Utilities::MPI::sum(local_result, - partitioner_sm->get_mpi_communicator()); + partitioner->get_mpi_communicator()); else return local_result; } @@ -1071,7 +1057,7 @@ namespace LinearAlgebra { real_type max = 0.; - const size_type local_size = partitioner_sm->local_size(); + const size_type local_size = partitioner->local_size(); internal::la_parallel_vector_templates_functions< Number, MemorySpaceType>::linfty_norm_local(data, local_size, max); @@ -1086,9 +1072,9 @@ namespace LinearAlgebra Vector::linfty_norm() const { const real_type local_result = linfty_norm_local(); - if (partitioner_sm->n_mpi_processes() > 1) + if (partitioner->n_mpi_processes() > 1) return Utilities::MPI::max(local_result, - partitioner_sm->get_mpi_communicator()); + partitioner->get_mpi_communicator()); else return local_result; } @@ -1102,7 +1088,7 @@ namespace LinearAlgebra const Vector &v, const Vector &w) { - const size_type vec_size = partitioner_sm->local_size(); + const size_type vec_size = partitioner->local_size(); AssertDimension(vec_size, v.local_size()); AssertDimension(vec_size, w.local_size()); @@ -1134,9 +1120,9 @@ namespace LinearAlgebra const VectorType &w = dynamic_cast(ww); Number local_result = add_and_dot_local(a, v, w); - if (partitioner_sm->n_mpi_processes() > 1) + if (partitioner->n_mpi_processes() > 1) return Utilities::MPI::sum(local_result, - partitioner_sm->get_mpi_communicator()); + partitioner->get_mpi_communicator()); else return local_result; } @@ -1148,7 +1134,7 @@ namespace LinearAlgebra Vector::partitioners_are_compatible( const Utilities::MPI::Partitioner &part) const { - return partitioner->is_compatible(part); + return partitioner_old->is_compatible(part); } @@ -1159,7 +1145,7 @@ namespace LinearAlgebra const Utilities::MPI::Partitioner &part) const { Assert(false, ExcNotImplemented()); - return partitioner->is_globally_compatible(part); + return partitioner_old->is_globally_compatible(part); } -- 2.39.5