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>
66 const Teuchos::ArrayView<const Scalar>& A)
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>
120 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
124 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm1");
125 return getTpetra_Vector()->norm1();
129 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
130 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
134 XPETRA_MONITOR(
"TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::norm2");
135 return getTpetra_Vector()->norm2();
139 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
140 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
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>
172 describe(Teuchos::FancyOStream& out,
const Teuchos::EVerbosityLevel verbLevel)
const
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>
191 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& vec)
197 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
198 RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, 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>();
240 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
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
294 TpetraVector(
const Teuchos::RCP<const Map>& map,
const Teuchos::ArrayView<const Scalar>& A)
329 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm1()
const
331 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
336 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm2()
const
338 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
343 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
normInf()
const
345 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
350 Scalar
meanValue()
const {
return Teuchos::ScalarTraits<Scalar>::zero(); }
363 void describe(Teuchos::FancyOStream& out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
369 Scalar
dot(
const Vector& a)
const {
return Teuchos::ScalarTraits<Scalar>::zero(); }
378 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& vec)
389 RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
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;
439 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
447 #endif // #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
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
472 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::dot;
473 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm1;
474 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm2;
475 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::normInf;
476 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::meanValue;
477 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceGlobalValue;
478 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoGlobalValue;
479 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceLocalValue;
480 using TpetraMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoLocalValue;
496 TpetraVector(
const Teuchos::RCP<const Map>& map,
const Teuchos::ArrayView<const Scalar>& A)
531 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm1()
const
533 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
537 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm2()
const
539 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
543 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
normInf()
const
545 return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());
549 Scalar
meanValue()
const {
return Teuchos::ScalarTraits<Scalar>::zero(); }
560 void describe(Teuchos::FancyOStream& out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
565 Scalar
dot(
const Vector& a)
const {
return Teuchos::ScalarTraits<Scalar>::zero(); }
574 TpetraVector(
const Teuchos::RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& vec)
584 RCP<Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
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;
630 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
637 #endif // #if((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
642 #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.
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.
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.