]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify locally_owned_elements in TpetraWrappers::Vector. 16547/head
authorSebastian Kinnewig <kinnewig@ifam.uni-hannover.de>
Fri, 26 Jan 2024 10:48:48 +0000 (11:48 +0100)
committerSebastian Kinnewig <kinnewig@ifam.uni-hannover.de>
Fri, 26 Jan 2024 10:48:48 +0000 (11:48 +0100)
include/deal.II/lac/trilinos_tpetra_vector.templates.h

index 9f566733fabd8111591b359708e4bf163b747dd9..ba226f7fbe4dce71ee0193055686c859905aea7d 100644 (file)
@@ -826,31 +826,10 @@ namespace LinearAlgebra
 
 
     template <typename Number>
-    ::dealii::IndexSet
+    IndexSet
     Vector<Number>::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<types::global_dof_index> 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());
     }
 
 

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.