46 #ifndef XPETRA_EPETRAVECTOR_HPP 47 #define XPETRA_EPETRAVECTOR_HPP 61 #include <Epetra_Vector.h> 66 template<
class GlobalOrdinal,
class Node>
67 Epetra_Vector &
toEpetra(Vector<double, int, GlobalOrdinal, Node> &);
69 template<
class GlobalOrdinal,
class Node>
70 const Epetra_Vector &
toEpetra(
const Vector<double, int, GlobalOrdinal, Node> &);
73 template<
class EpetraGlobalOrdinal,
class Node>
75 :
public virtual Vector<double,int,EpetraGlobalOrdinal, Node>,
public EpetraMultiVectorT<EpetraGlobalOrdinal, Node>
85 void norm1(
const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms)
const { }
88 void norm2(
const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms)
const { }
91 void normInf(
const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms)
const { }
94 void meanValue(
const Teuchos::ArrayView< Scalar > &means)
const { }
150 Teuchos::ScalarTraits< Scalar >::magnitudeType
norm1()
const {
return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
153 Teuchos::ScalarTraits< Scalar >::magnitudeType
norm2()
const {
return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
156 Teuchos::ScalarTraits< Scalar >::magnitudeType
normInf()
const {
return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
173 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {};
183 "Xpetra::EpetraVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
195 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 198 typename dual_view_type::t_host_um getHostLocalView ()
const {
202 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
203 throw std::runtime_error(
"Epetra does not support device views!");
204 typename dual_view_type::t_dev ret;
218 template<
class TargetDeviceType>
219 typename Kokkos::Impl::if_c<
220 Kokkos::Impl::is_same<
221 typename dual_view_type::t_dev_um::execution_space::memory_space,
222 typename TargetDeviceType::memory_space>::value,
223 typename dual_view_type::t_dev_um,
224 typename dual_view_type::t_host_um>::type
225 getLocalView ()
const {
226 return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
241 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 342 std::ostringstream oss;
343 oss << Teuchos::Describable::description();
350 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
353 if (verbLevel > Teuchos::VERB_NONE) {
381 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 384 typename dual_view_type::t_host_um getHostLocalView ()
const {
388 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
389 throw std::runtime_error(
"Epetra does not support device views!");
390 typename dual_view_type::t_dev ret;
404 template<
class TargetDeviceType>
405 typename Kokkos::Impl::if_c<
406 Kokkos::Impl::is_same<
407 typename dual_view_type::t_dev_um::execution_space::memory_space,
408 typename TargetDeviceType::memory_space>::value,
409 typename dual_view_type::t_dev_um,
410 typename dual_view_type::t_host_um>::type
411 getLocalView ()
const {
412 return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
426 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 525 std::ostringstream oss;
526 oss << Teuchos::Describable::description();
533 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
536 if (verbLevel > Teuchos::VERB_NONE) {
564 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 567 typename dual_view_type::t_host_um getHostLocalView ()
const {
571 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
572 throw std::runtime_error(
"Epetra does not support device views!");
573 typename dual_view_type::t_dev ret;
587 template<
class TargetDeviceType>
588 typename Kokkos::Impl::if_c<
589 Kokkos::Impl::is_same<
590 typename dual_view_type::t_dev_um::execution_space::memory_space,
591 typename TargetDeviceType::memory_space>::value,
592 typename dual_view_type::t_dev_um,
593 typename dual_view_type::t_host_um>::type
594 getLocalView ()
const {
595 return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
610 #endif // XPETRA_EPETRAVECTOR_HPP Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &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.
EpetraVectorT(const Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Exception throws to report errors in the internal logical of the program.
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.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra 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.
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...
EpetraVectorT(const RCP< Epetra_MultiVector > &mv, size_t j)
std::string description() const
Return a simple one-line description of this object.
EpetraVectorT(const Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
EpetraGlobalOrdinal GlobalOrdinal
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
virtual ~EpetraVectorT()
Vector copy constructor.
EpetraGlobalOrdinal GlobalOrdinal
virtual ~EpetraVectorT()
Vector copy constructor.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra vector.
virtual ~EpetraVectorT()
Vector copy constructor.
EpetraVectorT(const 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.
std::string description() const
Return a simple one-line description of this object.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute the dot product of each corresponding pair of vectors (columns) in A and B.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
void sumIntoGlobalValue(GlobalOrdinal globalRow, 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.
void sumIntoGlobalValue(GlobalOrdinal globalRow, 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.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-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 norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
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 replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
#define XPETRA_MONITOR(funcName)
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra vector.
EpetraVectorT(const RCP< Epetra_MultiVector > &mv, size_t j)
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.