From: Sebastian Kinnewig Date: Fri, 26 Jan 2024 10:48:48 +0000 (+0100) Subject: Simplify locally_owned_elements in TpetraWrappers::Vector. X-Git-Tag: relicensing~107^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7cef5acbe9490dd46538aa24f6cd0da9c72f766;p=dealii.git Simplify locally_owned_elements in TpetraWrappers::Vector. --- diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index 9f566733fa..ba226f7fbe 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -826,31 +826,10 @@ namespace LinearAlgebra template - ::dealii::IndexSet + IndexSet Vector::locally_owned_elements() const { - IndexSet is(size()); - - // easy case: local range is contiguous - if (vector->getMap()->isContiguous()) - { - is.add_range(vector->getMap()->getMinGlobalIndex(), - vector->getMap()->getMaxGlobalIndex() + 1); - } - else if (vector->getLocalLength() > 0) - { - const size_type n_indices = vector->getLocalLength(); - std::vector vector_indices; - vector_indices.reserve(n_indices); - for (unsigned int i = 0; i < n_indices; ++i) - vector_indices.push_back(vector->getMap()->getGlobalElement(i)); - - is.add_indices(vector_indices.data(), - vector_indices.data() + n_indices); - } - is.compress(); - - return is; + return IndexSet(vector->getMap()); }