]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Support older Trilinos versions
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 19 Sep 2018 21:54:23 +0000 (23:54 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Feb 2019 12:46:19 +0000 (13:46 +0100)
include/deal.II/lac/trilinos_tpetra_communication_pattern.h
source/base/index_set.cc
source/lac/trilinos_tpetra_vector.cc

index 8dc7cf7874723fe76331f5878b075be7f91159de..a3a23726fecbbf55165f6c01125fc9881672dbe5 100644 (file)
@@ -25,6 +25,7 @@
 
 #    include <deal.II/lac/communication_pattern_base.h>
 
+#    include <Tpetra_Export.hpp>
 #    include <Tpetra_Import.hpp>
 
 #    include <memory>
index 6fe2920ffe390fc3e098d513b517e229d0ad62cd..143efc6dc6b49843570276c6eac61cad9c240d7d 100644 (file)
@@ -571,9 +571,9 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator,
       fill_index_vector(indices);
       std::vector<int> int_indices(indices.size());
       std::copy(indices.begin(), indices.end(), int_indices.begin());
+      const Teuchos::ArrayView<int> arr_view(int_indices);
       return Tpetra::Map<>(size(),
-                           (n_elements() > 0 ? int_indices.data() : nullptr),
-                           n_elements(),
+                           arr_view,
                            0,
 #  ifdef DEAL_II_WITH_MPI
                            Teuchos::rcp(new Teuchos::MpiComm<int>(communicator))
index 88324e6d53a7f819fc2e63201f28e6b6a9a88092..dae177f7e5c4727a687f8bc5ac57a9e73c3a2a76 100644 (file)
@@ -561,9 +561,13 @@ namespace LinearAlgebra
       else if (vector->getLocalLength() > 0)
         {
           const size_type n_indices = vector->getLocalLength();
-          auto vector_indices       = vector->getMap()->getMyGlobalIndices();
-          is.add_indices((unsigned int *)&vector_indices[0],
-                         (unsigned int *)&vector_indices[0] + n_indices);
+          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();
 

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.