46 #ifndef XPETRA_TPETRAVECTOR_DEF_HPP
47 #define XPETRA_TPETRAVECTOR_DEF_HPP
54 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 :
TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(map, A, map->getNodeNumElements(), 1)
72 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::replaceGlobalValue");
85 getTpetra_Vector()->replaceGlobalValue(globalRow, value);
89 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
94 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::sumIntoGlobalValue");
95 getTpetra_Vector()->sumIntoGlobalValue(globalRow, value);
99 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
104 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::replaceLocalValue");
105 getTpetra_Vector()->replaceLocalValue(myRow, value);
109 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
114 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::sumIntoLocalValue");
115 getTpetra_Vector()->sumIntoLocalValue(myRow, value);
119 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
124 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm1");
125 return getTpetra_Vector()->norm1();
129 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
134 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm2");
135 return getTpetra_Vector()->norm2();
139 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
144 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::normInf");
145 return getTpetra_Vector()->normInf();
149 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
154 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::meanValue");
155 return getTpetra_Vector()->meanValue();
159 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
164 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::description");
165 return getTpetra_Vector()->description();
169 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
174 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::describe");
175 getTpetra_Vector()->describe(out, verbLevel);
179 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
184 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::dot");
185 return getTpetra_Vector()->dot(*
toTpetra(a));
189 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
190 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
195 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::normWeighted");
196 return getTpetra_Vector()->normWeighted(*
toTpetra(weights));
201 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
209 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
218 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
220 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
229 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
231 TpetraVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
232 getDeviceLocalView()
const
234 return this->TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getDeviceLocalView();
239 template<
class TargetDeviceType>
240 typename Kokkos::Impl::if_c<
241 Kokkos::Impl::is_same<
242 typename dual_view_type::t_dev_um::execution_space::memory_space,
243 typename TargetDeviceType::memory_space>::value,
244 typename dual_view_type::t_dev_um,
245 typename dual_view_type::t_host_um>::type
246 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
247 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getLocalView ()
const {
248 return this->TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
252 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
256 #ifdef HAVE_XPETRA_EPETRA
260 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) \
261 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
264 template<
class Scalar>
266 :
public virtual Vector<Scalar, int, int, EpetraNode>
273 #undef XPETRA_TPETRAMULTIVECTOR_SHORT
274 #undef XPETRA_TPETRAVECTOR_SHORT
276 #define XPETRA_TPETRAMULTIVECTOR_SHORT
277 #define XPETRA_TPETRAVECTOR_SHORT
384 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
390 #endif // TPETRA_ENABLE_DEPRECATED_CODE
411 return Teuchos::null;
416 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
420 typename dual_view_type::t_host_um getHostLocalView()
const
422 typename dual_view_type::t_host_um ret;
426 typename dual_view_type::t_dev_um getDeviceLocalView()
const
428 typename dual_view_type::t_dev_um ret;
444 template<
class TargetDeviceType>
445 typename Kokkos::Impl::if_c<
446 Kokkos::Impl::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
447 typename dual_view_type::t_dev_um,
448 typename dual_view_type::t_host_um>::type
451 typename Kokkos::Impl::if_c<
452 Kokkos::Impl::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
453 typename dual_view_type::t_dev_um,
454 typename dual_view_type::t_host_um>::type ret;
458 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
466 #endif // #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
471 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) \
472 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
475 template<
class Scalar>
477 :
public virtual Vector<Scalar, int, long long, EpetraNode>
484 #undef XPETRA_TPETRAMULTIVECTOR_SHORT
485 #undef XPETRA_TPETRAVECTOR_SHORT
487 #define XPETRA_TPETRAMULTIVECTOR_SHORT
488 #define XPETRA_TPETRAVECTOR_SHORT
491 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::dot;
492 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm1;
493 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm2;
494 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::normInf;
495 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::meanValue;
496 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceGlobalValue;
497 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoGlobalValue;
498 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceLocalValue;
499 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoLocalValue;
587 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
592 #endif // TPETRA_ENABLE_DEPRECATED_CODE
612 return Teuchos::null;
616 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
620 typename dual_view_type::t_host_um getHostLocalView()
const
622 typename dual_view_type::t_host_um ret;
626 typename dual_view_type::t_dev_um getDeviceLocalView()
const
628 typename dual_view_type::t_dev_um ret;
642 template<
class TargetDeviceType>
643 typename Kokkos::Impl::if_c<
644 Kokkos::Impl::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
645 typename dual_view_type::t_dev_um,
646 typename dual_view_type::t_host_um>::type
649 typename Kokkos::Impl::if_c<
650 Kokkos::Impl::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
651 typename dual_view_type::t_dev_um,
652 typename dual_view_type::t_host_um>::type ret;
655 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
662 #endif // #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
667 #endif // HAVE_XPETRA_EPETRA
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
std::string description() const
Return a simple one-line description of this object.
virtual ~TpetraVector()
Destructor.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
Scalar meanValue() const
Compute mean (average) value of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
TpetraVector(const Teuchos::RCP< const Map > &map, const Teuchos::ArrayView< const Scalar > &A)
Set multi-vector values from an array using Teuchos memory management classes. (copy) ...
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
std::string description() const
Return a simple one-line description of this object.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
Scalar meanValue() const
Compute mean (average) value of this Vector.
RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Vector() const
Get the underlying Tpetra multivector.
static const EVerbosityLevel verbLevel_default
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
TpetraVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, bool zeroOut=true)
Sets all vector entries to zero.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
static magnitudeType magnitude(T a)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Vector() const
Get the underlying Tpetra multivector.
std::string description() const
Return a simple one-line description of this object.
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
#define XPETRA_MONITOR(funcName)
TpetraVector(const Teuchos::RCP< const Map > &map, const Teuchos::ArrayView< const Scalar > &A)
Set multi-vector values from an array using Teuchos memory management classes. (copy) ...
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
Scalar meanValue() const
Compute mean (average) value of this Vector.
RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Vector() const
Get the underlying Tpetra multivector.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.
virtual ~TpetraVector()
Destructor.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.