]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make TpetraWrapps::Vector compatible with BlockVectorBase.
authorSebastian Kinnewig <kinnewig@ifam.uni-hannover.de>
Fri, 2 Feb 2024 10:35:56 +0000 (11:35 +0100)
committerSebastian Kinnewig <sebastian@kinnewig.org>
Sun, 18 Feb 2024 15:20:52 +0000 (16:20 +0100)
include/deal.II/lac/trilinos_tpetra_vector.h
include/deal.II/lac/trilinos_tpetra_vector.templates.h
source/lac/trilinos_tpetra_block_sparse_matrix.cc

index 0b9a2d3c165e6574537e19c063fcc64b107678e6..6018ff6fa0d48fbf4800982fcca58f23c1e2de8e 100644 (file)
@@ -208,6 +208,34 @@ namespace LinearAlgebra
                        << "An error with error number " << arg1
                        << " occurred while calling a Trilinos function");
 
+        /*
+         * Access to a an element that is not (locally-)owned.
+         *
+         * @ingroup Exceptions
+         */
+        DeclException4(
+          ExcAccessToNonLocalElement,
+          size_type,
+          size_type,
+          size_type,
+          size_type,
+          << "You are trying to access element " << arg1
+          << " of a distributed vector, but this element is not stored "
+          << "on the current processor. Note: There are " << arg2
+          << " elements stored "
+          << "on the current processor from within the range [" << arg3 << ','
+          << arg4 << "] but Trilinos vectors need not store contiguous "
+          << "ranges on each processor, and not every element in "
+          << "this range may in fact be stored locally."
+          << "\n\n"
+          << "A common source for this kind of problem is that you "
+          << "are passing a 'fully distributed' vector into a function "
+          << "that needs read access to vector elements that correspond "
+          << "to degrees of freedom on ghost cells (or at least to "
+          << "'locally active' degrees of freedom that are not also "
+          << "'locally owned'). You need to pass a vector that has these "
+          << "elements as ghost entries.");
+
       private:
         /**
          * Point to the vector we are referencing.
@@ -261,6 +289,8 @@ namespace LinearAlgebra
       using real_type  = typename numbers::NumberTraits<Number>::real_type;
       using size_type  = types::global_dof_index;
       using reference  = internal::VectorReference<Number, MemorySpace>;
+      using const_reference =
+        const internal::VectorReference<Number, MemorySpace>;
       using MapType =
         Tpetra::Map<int, dealii::types::signed_global_dof_index, NodeType>;
       using VectorType = Tpetra::
index db6cc93ed54bd812ac3848509a218fcf51db28a8..c48c17e7de5e1f6a6c7e9910132500ad63936d80 100644 (file)
@@ -182,6 +182,7 @@ namespace LinearAlgebra
           0, 0, Utilities::Trilinos::tpetra_comm_self()));
       has_ghost  = false;
       compressed = true;
+      nonlocal_vector.reset();
     }
 
 
@@ -1066,6 +1067,7 @@ namespace LinearAlgebra
     }
 
 
+
     template <typename Number, typename MemorySpace>
     MPI_Comm
     Vector<Number, MemorySpace>::mpi_comm() const
index fafcebe3250decdddf793db606653fd19ccd5248..283dad3bda86f398bffa906e67c013ef13268742 100644 (file)
@@ -52,18 +52,6 @@ namespace LinearAlgebra
     BlockSparseMatrix<double>::Tvmult(
       TpetraWrappers::BlockVector<double> &,
       const TpetraWrappers::BlockVector<double> &) const;
-
-    template void
-    BlockSparseMatrix<double>::vmult(
-      ::dealii::BlockVector<double> &,
-      const ::dealii::BlockVector<double> &) const;
-
-    template void
-    BlockSparseMatrix<double>::Tvmult(
-      ::dealii::BlockVector<double> &,
-      const ::dealii::BlockVector<double> &) const;
-
-
   } // namespace TpetraWrappers
 } // namespace LinearAlgebra
 #  endif // DOXYGEN

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.