42 #ifndef TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP
43 #define TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP
47 #include "Tpetra_MultiVector.hpp"
52 namespace Experimental {
142 template<
class Scalar,
151 using STS = Teuchos::ScalarTraits<Scalar>;
202 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
213 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
286 const size_t offset = 0);
294 const size_t offset = 0);
348 void scale (
const Scalar& val);
357 update (
const Scalar& alpha,
448 template<
class TargetMemorySpace>
450 mv_.template sync<typename TargetMemorySpace::memory_space> ();
464 template<
class TargetMemorySpace>
466 return mv_.template need_sync<typename TargetMemorySpace::memory_space> ();
484 template<
class TargetMemorySpace>
486 mv_.template modify<typename TargetMemorySpace::memory_space> ();
519 bool replaceLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
531 bool replaceGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
543 bool sumIntoLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
555 bool sumIntoGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
567 bool getLocalRowView (
const LO localRowIndex,
const LO colIndex, Scalar*& vals)
const;
579 bool getGlobalRowView (
const GO globalRowIndex,
const LO colIndex, Scalar*& vals)
const;
592 typename little_vec_type::HostMirror
593 getLocalBlock (
const LO localRowIndex,
const LO colIndex)
const;
607 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
609 #else // TPETRA_ENABLE_DEPRECATED_CODE
611 #endif // TPETRA_ENABLE_DEPRECATED_CODE
613 const size_t numSameIDs,
620 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
622 #else // TPETRA_ENABLE_DEPRECATED_CODE
624 #endif // TPETRA_ENABLE_DEPRECATED_CODE
628 Kokkos::DualView<packet_type*,
630 Kokkos::DualView<
size_t*,
632 size_t& constantNumPackets,
636 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
638 #else // TPETRA_ENABLE_DEPRECATED_CODE
640 #endif // TPETRA_ENABLE_DEPRECATED_CODE
643 Kokkos::DualView<packet_type*,
645 Kokkos::DualView<
size_t*,
647 const size_t constantNumPackets,
661 return static_cast<size_t> (1);
704 replaceLocalValuesImpl (
const LO localRowIndex,
706 const Scalar vals[])
const;
709 sumIntoLocalValuesImpl (
const LO localRowIndex,
711 const Scalar vals[])
const;
713 static Teuchos::RCP<const mv_type>
716 static Teuchos::RCP<const BlockMultiVector<Scalar, LO, GO, Node> >
735 std::pair<int, std::unique_ptr<std::string>>
738 const size_t numSameIDs,
739 const Kokkos::DualView<
743 const Kokkos::DualView<
748 std::pair<int, std::unique_ptr<std::string>>
750 (
const Kokkos::DualView<
762 size_t& constantNumPackets,
765 std::pair<int, std::unique_ptr<std::string>>
767 (
const Kokkos::DualView<
779 const size_t constantNumPackets,
787 #endif // TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP
void sync()
Update data to the given target memory space, only if data in the "other" space have been marked as m...
Node node_type
The Kokkos Node type; a legacy thing that will go away at some point.
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
void sync_host()
Update data to the host.
Forward declaration of Tpetra::Experimental::BlockCrsMatrix.
bool need_sync_host() const
Whether this object needs synchronization to the host.
mv_type mv_
The Tpetra::MultiVector used to represent the data.
void modify_device()
Mark data as modified on the device.
bool need_sync_device() const
Whether this object needs synchronization to the device.
void putScalar(const Scalar &val)
Fill all entries with the given value val.
LO local_ordinal_type
The type of local indices.
size_t getNumVectors() const
Number of columns in the multivector.
bool replaceGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a global index.
bool sumIntoGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a global index.
void modify_host()
Mark data as modified on the host.
MultiVector for multiple degrees of freedom per mesh point.
Forward declaration of Tpetra::Experimental::BlockMultiVector.
bool need_sync() const
Whether this object needs synchronization to the given memory space.
static map_type makePointMap(const map_type &meshMap, const LO blockSize)
Create and return the point Map corresponding to the given mesh Map and block size.
Kokkos::View< impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > little_vec_type
"Block view" of all degrees of freedom at a mesh point, for a single column of the MultiVector...
little_vec_type::HostMirror getLocalBlock(const LO localRowIndex, const LO colIndex) const
Get a host view of the degrees of freedom at the given mesh point.
void scale(const Scalar &val)
Multiply all entries in place by the given value val.
void update(const Scalar &alpha, const BlockMultiVector< Scalar, LO, GO, Node > &X, const Scalar &beta)
Update: this = beta*this + alpha*X.
bool need_sync_device() const
Whether this MultiVector needs synchronization to the device.
mv_type getMultiVectorView() const
Get a Tpetra::MultiVector that views this BlockMultiVector's data.
LO getBlockSize() const
Get the number of degrees of freedom per mesh point.
typename::Kokkos::Details::ArithTraits< Scalar >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
impl_scalar_type * getRawPtr() const
Raw pointer to the MultiVector's data.
void sync_host()
Synchronize to Host.
LO getNumVectors() const
Get the number of columns (vectors) in the BlockMultiVector.
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Rule for combining data in an Import or Export.
void blockJacobiUpdate(const Scalar &alpha, const Kokkos::View< const impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > &D, const BlockMultiVector< Scalar, LO, GO, Node > &X, BlockMultiVector< Scalar, LO, GO, Node > &Z, const Scalar &beta)
Block Jacobi update .
void blockWiseMultiply(const Scalar &alpha, const Kokkos::View< const impl_scalar_type ***, device_type, Kokkos::MemoryUnmanaged > &D, const BlockMultiVector< Scalar, LO, GO, Node > &X)
*this := alpha * D * X, where D is a block diagonal matrix.
bool getLocalRowView(const LO localRowIndex, const LO colIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a local index. ...
bool need_sync_host() const
Whether this MultiVector needs synchronization to the host.
void modify_device()
Mark data as modified on the device side.
typename dist_object_type::buffer_device_type buffer_device_type
Kokkos::Device specialization used for communication buffers.
Abstract base class for objects that can be the source of an Import or Export operation.
bool isValidLocalMeshIndex(const LO meshLocalIndex) const
True if and only if meshLocalIndex is a valid local index in the mesh Map.
void modify_host()
Mark data as modified on the host side.
typename map_type::device_type device_type
This class' preferred Kokkos device type.
void modify()
Mark data as modified on the given memory space.
map_type getPointMap() const
Get this BlockMultiVector's (previously computed) point Map.
Scalar scalar_type
The type of entries in the object.
typename Kokkos::Details::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
virtual bool checkSizes(const Tpetra::SrcDistObject &source)
Compare the source and target (this) objects for compatibility.
void sync_device()
Update data to the device.
Kokkos::View< const impl_scalar_type *, Kokkos::LayoutRight, device_type, Kokkos::MemoryTraits< Kokkos::Unmanaged > > const_little_vec_type
"Const block view" of all degrees of freedom at a mesh point, for a single column of the MultiVector...
size_t getStrideY() const
Stride between consecutive local entries in the same row.
size_t getStride() const
Stride between columns in the multivector.
BlockMultiVector()
Default constructor.
typename mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the object.
GO global_ordinal_type
The type of global indices.
bool replaceLocalValues(const LO localRowIndex, const LO colIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using local row and column indices.
Kokkos::Device< typename device_type::execution_space, buffer_memory_space > buffer_device_type
size_t getStrideX() const
Stride between consecutive local entries in the same column.
Base class for distributed Tpetra objects that support data redistribution.
bool sumIntoLocalValues(const LO localRowIndex, const LO colIndex, const Scalar vals[]) const
Sum into all values at the given mesh point, using a local index.
typename mv_type::device_type device_type
The Kokkos Device type.
void sync_device()
Synchronize to Device.
bool getGlobalRowView(const GO globalRowIndex, const LO colIndex, Scalar *&vals) const
Get a writeable view of the entries at the given mesh point, using a global index.