From: Sebastian Kinnewig Date: Fri, 9 Feb 2024 08:46:23 +0000 (+0100) Subject: Implementation for TpetraWrappers::Vector::operator Number() X-Git-Tag: relicensing~57^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a9bf186e4eb8a4d408aa43f38c3c71c957a8be0;p=dealii.git Implementation for TpetraWrappers::Vector::operator Number() --- diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index cfb5ecfb2b..eed13a0575 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -44,6 +44,37 @@ namespace LinearAlgebra { namespace TpetraWrappers { + namespace internal + { + template + VectorReference::operator Number() const + { + // Get the local index + const TrilinosWrappers::types::int_type local_index = + vector.vector->getMap()->getLocalElement( + static_cast(index)); + +# if DEAL_II_TRILINOS_VERSION_GTE(14, 0, 0) + Assert((local_index != Teuchos::OrdinalTraits::invalid()), + ExcAccessToNonLocalElement( + index, + vector.vector->getMap()->getLocalNumElements(), + vector.vector->getMap()->getMinLocalIndex(), + vector.vector->getMap()->getMaxLocalIndex())); +# else + Assert((local_index != Teuchos::OrdinalTraits::invalid()), + ExcAccessToNonLocalElement( + index, + vector.vector->getMap()->getNodeNumElements(), + vector.vector->getMap()->getMinLocalIndex(), + vector.vector->getMap()->getMaxLocalIndex())); +# endif + return vector.vector->getData()[local_index]; + } + } // namespace internal + + + template Vector::Vector() : Subscriptor()