46 #ifndef XPETRA_TPETRAVECTOR_HPP 47 #define XPETRA_TPETRAVECTOR_HPP 62 #include "Tpetra_Vector.hpp" 67 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 RCP<Tpetra::Vector<Scalar,LocalOrdinal, GlobalOrdinal, Node> >
toTpetra(Vector<Scalar,LocalOrdinal, GlobalOrdinal, Node> &);
70 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 RCP<Tpetra::Vector<Scalar,LocalOrdinal, GlobalOrdinal, Node> >
toTpetra(
const Vector<Scalar,LocalOrdinal, GlobalOrdinal, Node> &);
73 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node > >
toXpetra(RCP<
const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > vec);
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
77 RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node > >
toXpetra(RCP<Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > vec);
82 template <class Scalar = Vector<>::scalar_type,
87 :
public virtual Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>,
88 public TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>
90 #undef XPETRA_TPETRAMULTIVECTOR_SHORT 113 TpetraVector(
const Teuchos::RCP<const Map> &map,
const Teuchos::ArrayView< const Scalar > &A)
114 :
TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> (map,A,map->getNodeNumElements(),1) { }
162 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
XPETRA_MONITOR(
"TpetraVector::describe");
getTpetra_Vector()->describe(out, verbLevel); }
177 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &vec) :
TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> (vec) { }
182 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 186 typename dual_view_type::t_host_um getHostLocalView ()
const {
190 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
191 return this->TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getDeviceLocalView();
204 template<
class TargetDeviceType>
205 typename Kokkos::Impl::if_c<
206 Kokkos::Impl::is_same<
207 typename dual_view_type::t_dev_um::execution_space::memory_space,
208 typename TargetDeviceType::memory_space>::value,
209 typename dual_view_type::t_dev_um,
210 typename dual_view_type::t_host_um>::type
211 getLocalView ()
const {
212 return this->TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
220 #ifdef HAVE_XPETRA_EPETRA 222 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 223 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 226 template <
class Scalar>
228 :
public virtual Vector<Scalar,int,int,EpetraNode>,
235 #undef XPETRA_TPETRAMULTIVECTOR_SHORT 260 TpetraVector(
const Teuchos::RCP<const Map> &map,
const Teuchos::ArrayView< const Scalar > &A)
291 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
norm1()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
294 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
norm2()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
297 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
normInf()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
300 Scalar
meanValue()
const {
return Teuchos::ScalarTraits< Scalar >::zero(); }
311 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
316 Scalar
dot(
const Vector &a)
const {
return Teuchos::ScalarTraits< Scalar >::zero(); }
319 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
normWeighted(
const Vector &weights)
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
326 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &vec) {
331 RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
getTpetra_Vector()
const {
return Teuchos::null; }
333 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 337 typename dual_view_type::t_host_um getHostLocalView ()
const {
338 typename dual_view_type::t_host_um ret;
342 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
343 typename dual_view_type::t_dev_um ret;
357 template<
class TargetDeviceType>
358 typename Kokkos::Impl::if_c<
359 Kokkos::Impl::is_same<
360 typename dual_view_type::t_dev_um::execution_space::memory_space,
361 typename TargetDeviceType::memory_space>::value,
362 typename dual_view_type::t_dev_um,
363 typename dual_view_type::t_host_um>::type
364 getLocalView ()
const {
365 typename Kokkos::Impl::if_c<
366 Kokkos::Impl::is_same<
367 typename dual_view_type::t_dev_um::execution_space::memory_space,
368 typename TargetDeviceType::memory_space>::value,
369 typename dual_view_type::t_dev_um,
370 typename dual_view_type::t_host_um>::type ret;
380 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \ 381 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))) 384 template <
class Scalar>
386 :
public virtual Vector<Scalar,int,long long,EpetraNode>,
393 #undef XPETRA_TPETRAMULTIVECTOR_SHORT 418 TpetraVector(
const Teuchos::RCP<const Map> &map,
const Teuchos::ArrayView< const Scalar > &A)
449 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
norm1()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
452 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
norm2()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
455 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
normInf()
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
458 Scalar
meanValue()
const {
return Teuchos::ScalarTraits< Scalar >::zero(); }
469 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
474 Scalar
dot(
const Vector &a)
const {
return Teuchos::ScalarTraits< Scalar >::zero(); }
477 typename Teuchos::ScalarTraits< Scalar >::magnitudeType
normWeighted(
const Vector &weights)
const {
return Teuchos::ScalarTraits< Scalar >::magnitude(Teuchos::ScalarTraits< Scalar >::zero()); }
484 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &vec) {
489 RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
getTpetra_Vector()
const {
return Teuchos::null; }
491 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 495 typename dual_view_type::t_host_um getHostLocalView ()
const {
496 typename dual_view_type::t_host_um ret;
500 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
501 typename dual_view_type::t_dev_um ret;
515 template<
class TargetDeviceType>
516 typename Kokkos::Impl::if_c<
517 Kokkos::Impl::is_same<
518 typename dual_view_type::t_dev_um::execution_space::memory_space,
519 typename TargetDeviceType::memory_space>::value,
520 typename dual_view_type::t_dev_um,
521 typename dual_view_type::t_host_um>::type
522 getLocalView ()
const {
523 typename Kokkos::Impl::if_c<
524 Kokkos::Impl::is_same<
525 typename dual_view_type::t_dev_um::execution_space::memory_space,
526 typename TargetDeviceType::memory_space>::value,
527 typename dual_view_type::t_dev_um,
528 typename dual_view_type::t_host_um>::type ret;
537 #endif // HAVE_XPETRA_EPETRA 540 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
544 return tX.getTpetra_Vector();
547 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
551 return tX.getTpetra_Vector();
554 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
555 RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node > >
toXpetra(RCP<Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > vec) {
559 return Teuchos::null;
562 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
563 RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node > >
toXpetra(RCP<
const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > vec) {
565 return toXpetra(Teuchos::rcp_const_cast<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node > > (vec));
572 #define XPETRA_TPETRAVECTOR_SHORT 573 #endif // XPETRA_TPETRAVECTOR_HPP RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Vector() const
Get the underlying Tpetra multivector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
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.
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.
Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector &weights) const
Compute Weighted 2-norm (RMS Norm) of this Vector.
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
virtual ~TpetraVector()
Destructor.
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
LocalOrdinal local_ordinal_type
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.
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.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
std::string description() const
Return a simple one-line description of this object.
Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector &weights) const
Compute Weighted 2-norm (RMS Norm) of this Vector.
GlobalOrdinal global_ordinal_type
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
std::string description() const
Return a simple one-line description of this object.
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Scalar meanValue() const
Compute mean (average) value of this Vector.
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 norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
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 replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
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.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void sumIntoGlobalValue(GlobalOrdinal globalRow, 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< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
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.
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.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Scalar meanValue() const
Compute mean (average) value of this Vector.
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) ...
#define XPETRA_MONITOR(funcName)
Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector &weights) const
Compute Weighted 2-norm (RMS Norm) of this Vector.
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) ...
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.
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.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
virtual ~TpetraVector()
Destructor.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.