47 #ifndef XPETRA_BLOCKEDVECTOR_DECL_HPP
48 #define XPETRA_BLOCKEDVECTOR_DECL_HPP
65 template<
class Scalar,
70 :
public virtual Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>
91 #undef XPETRA_BLOCKEDVECTOR_SHORT
108 BlockedVector(
const Teuchos::RCP<const BlockedMap>& map,
bool zeroOut =
true);
162 virtual void replaceGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar& value);
165 virtual void sumIntoGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar& value);
168 virtual void replaceLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar& value);
171 virtual void sumIntoLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar& value);
187 virtual void putScalar(
const Scalar& value);
198 virtual Teuchos::RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
202 virtual Teuchos::RCP<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
206 virtual Teuchos::ArrayRCP<const Scalar>
getData(
size_t j)
const;
218 const Teuchos::ArrayView<Scalar>& dots)
const;
230 virtual void scale(
const Scalar& alpha);
233 virtual void scale(Teuchos::ArrayView<const Scalar> alpha);
235 virtual void update(
const Scalar& alpha,
241 virtual void update(
const Scalar& alpha,
245 const Scalar& gamma);
248 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm1()
const;
251 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType
norm2()
const;
254 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType
normInf()
const;
257 virtual void norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms)
const;
260 virtual void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms)
const;
263 virtual void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms)
const;
267 virtual void meanValue(
const Teuchos::ArrayView<Scalar>& )
const;
272 virtual void multiply(Teuchos::ETransp ,
279 virtual void multiply(Teuchos::ETransp ,
327 virtual void describe(Teuchos::FancyOStream& out,
328 const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const;
330 virtual void replaceMap(
const RCP<const Map>& map);
361 virtual void setSeed(
unsigned int seed);
364 virtual void randomize(
bool bUseXpetraImplementation =
false);
369 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
370 typedef typename Kokkos::Details::ArithTraits<Scalar>::val_type impl_scalar_type;
371 typedef Kokkos::DualView<impl_scalar_type**, Kokkos::LayoutStride,
372 typename node_type::execution_space,
373 Kokkos::MemoryUnmanaged> dual_view_type;
374 typedef typename dual_view_type::host_mirror_space host_execution_space;
375 typedef typename dual_view_type::t_dev::execution_space dev_execution_space;
382 template<
class TargetDeviceType>
383 typename Kokkos::Impl::if_c<
385 typename dev_execution_space::memory_space,
386 typename TargetDeviceType::memory_space>::value,
387 typename dual_view_type::t_dev_um,
388 typename dual_view_type::t_host_um>::type
389 getLocalView ()
const
391 if(std::is_same<typename host_execution_space::memory_space, typename TargetDeviceType::memory_space>::value)
393 return getHostLocalView();
397 return getDeviceLocalView();
400 virtual typename dual_view_type::t_host_um getHostLocalView ()
const
402 typename dual_view_type::t_host_um test;
405 virtual typename dual_view_type::t_dev_um getDeviceLocalView()
const
407 typename dual_view_type::t_dev_um test;
412 typedef typename Kokkos::Details::ArithTraits<Scalar>::val_type impl_scalar_type;
414 DualView<impl_scalar_type**, Kokkos::LayoutStride, typename node_type::execution_space, Kokkos::MemoryUnmanaged>
416 typedef typename dual_view_type::host_mirror_space host_execution_space;
417 typedef typename dual_view_type::t_dev::execution_space dev_execution_space;
424 template<
class TargetDeviceType>
425 typename Kokkos::Impl::if_c<std::is_same<
typename dev_execution_space::memory_space,
426 typename TargetDeviceType::memory_space>::value,
427 typename dual_view_type::t_dev_um,
428 typename dual_view_type::t_host_um>::type
429 getLocalView()
const;
431 virtual typename dual_view_type::t_host_um getHostLocalView ()
const
433 typename dual_view_type::t_host_um test;
436 virtual typename dual_view_type::t_dev_um getDeviceLocalView()
const
438 typename dual_view_type::t_dev_um test;
442 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
449 Teuchos::RCP<const Map>
getMap()
const;
452 Teuchos::RCP< Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
456 Teuchos::RCP< Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
466 Teuchos::RCP< Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
492 #define XPETRA_BLOCKEDVECTOR_SHORT
493 #endif // XPETRA_BLOCKEDVECTOR_DECL_HPP
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
virtual void setSeed(unsigned int seed)
Set seed for Random function.
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual void update(const Scalar &alpha, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual void elementWiseMultiply(Scalar, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, Scalar)
Element-wise multiply of a Vector A with a MultiVector B.
virtual void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
virtual void replaceMap(const RCP< const Map > &map)
virtual size_t getNumVectors() const
Number of columns in the Vector.
virtual std::string description() const
A simple one-line description of this object.
virtual void abs(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input vector in target: A = abs(this).
virtual void dot(const Xpetra::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]).
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual void reciprocal(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input vector in target, this(i,j) = 1/A(i,j).
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void assign(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual size_t getLocalLength() const
Local number of rows on the calling process.
GlobalOrdinal global_ordinal_type
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
LocalOrdinal local_ordinal_type
virtual ~BlockedVector()
Destructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
void setMultiVector(size_t r, Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > v, bool bThyraMode)
set partial Vector associated with block row r
size_t global_size_t
Global size_t object.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Merge() const
merge BlockedVector blocks to a single Vector
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
CombineMode
Xpetra::Combine Mode enumerable type.
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.