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 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
197 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
206 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
208 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
217 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
219 TpetraVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
220 getDeviceLocalView()
const
222 return this->TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getDeviceLocalView();
227 template<
class TargetDeviceType>
228 typename Kokkos::Impl::if_c<
230 typename dual_view_type::t_dev_um::execution_space::memory_space,
231 typename TargetDeviceType::memory_space>::value,
232 typename dual_view_type::t_dev_um,
233 typename dual_view_type::t_host_um>::type
234 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
235 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getLocalView ()
const {
236 return this->TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
244 #ifdef HAVE_XPETRA_EPETRA
248 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) \
249 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
252 template<
class Scalar>
254 :
public virtual Vector<Scalar, int, int, EpetraNode>
261 #undef XPETRA_TPETRAMULTIVECTOR_SHORT
262 #undef XPETRA_TPETRAVECTOR_SHORT
264 #define XPETRA_TPETRAMULTIVECTOR_SHORT
265 #define XPETRA_TPETRAVECTOR_SHORT
392 return Teuchos::null;
397 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
401 typename dual_view_type::t_host_um getHostLocalView()
const
403 typename dual_view_type::t_host_um ret;
407 typename dual_view_type::t_dev_um getDeviceLocalView()
const
409 typename dual_view_type::t_dev_um ret;
425 template<
class TargetDeviceType>
426 typename Kokkos::Impl::if_c<
427 std::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
428 typename dual_view_type::t_dev_um,
429 typename dual_view_type::t_host_um>::type
432 typename Kokkos::Impl::if_c<
433 std::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
434 typename dual_view_type::t_dev_um,
435 typename dual_view_type::t_host_um>::type ret;
452 #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) \
453 || (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
456 template<
class Scalar>
458 :
public virtual Vector<Scalar, int, long long, EpetraNode>
465 #undef XPETRA_TPETRAMULTIVECTOR_SHORT
466 #undef XPETRA_TPETRAVECTOR_SHORT
468 #define XPETRA_TPETRAMULTIVECTOR_SHORT
469 #define XPETRA_TPETRAVECTOR_SHORT
587 return Teuchos::null;
591 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
595 typename dual_view_type::t_host_um getHostLocalView()
const
597 typename dual_view_type::t_host_um ret;
601 typename dual_view_type::t_dev_um getDeviceLocalView()
const
603 typename dual_view_type::t_dev_um ret;
617 template<
class TargetDeviceType>
618 typename Kokkos::Impl::if_c<
619 std::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
620 typename dual_view_type::t_dev_um,
621 typename dual_view_type::t_host_um>::type
624 typename Kokkos::Impl::if_c<
625 std::is_same<typename dual_view_type::t_dev_um::execution_space::memory_space, typename TargetDeviceType::memory_space>::value,
626 typename dual_view_type::t_dev_um,
627 typename dual_view_type::t_host_um>::type ret;
#define XPETRA_MONITOR(funcName)
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
static const EVerbosityLevel verbLevel_default
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace 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...
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 sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
std::string description() const
Return a simple one-line description of this 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.
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 replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
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.
TpetraVector(const Teuchos::RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm 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.
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
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, const Teuchos::ArrayView< const Scalar > &A)
Set multi-vector values from an array using Teuchos memory management classes. (copy)
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
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.
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.
TpetraVector(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
Sets all vector entries to zero.
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 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.
RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_Vector() const
Get the underlying Tpetra multivector.
virtual ~TpetraVector()
Destructor.
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.
Scalar dot(const Vector &a) const
Computes dot product of this Vector against input Vector x.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
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.
std::string description() const
Return a simple one-line description of this 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.
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 norm1() const
Return 1-norm of this Vector.
TpetraVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, bool zeroOut=true)
Sets all vector entries to zero.
virtual ~TpetraVector()
Destructor.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
static magnitudeType magnitude(T a)