42 #ifndef TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP 43 #define TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP 47 #include "Tpetra_MultiVector.hpp" 49 #include "Teuchos_OrdinalTraits.hpp" 52 namespace Experimental {
143 template<
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
145 class GO = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
152 typedef Teuchos::ScalarTraits<Scalar> STS;
199 typedef Kokkos::View<impl_scalar_type*,
202 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
210 typedef Kokkos::View<
const impl_scalar_type*,
213 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
259 const map_type& pointMap,
276 const map_type& meshMap,
284 const map_type& newMeshMap,
285 const map_type& newPointMap,
286 const size_t offset = 0);
293 const map_type& newMeshMap,
294 const size_t offset = 0);
313 makePointMap (
const map_type& meshMap,
const LO blockSize);
348 void scale (
const Scalar& val);
357 update (
const Scalar& alpha,
384 const Kokkos::View<
const impl_scalar_type***,
385 device_type, Kokkos::MemoryUnmanaged>& D,
420 const Kokkos::View<
const impl_scalar_type***,
421 device_type, Kokkos::MemoryUnmanaged>& D,
448 template<
class TargetMemorySpace>
450 mv_.template sync<typename TargetMemorySpace::memory_space> ();
454 template<
class TargetMemorySpace>
456 return mv_.template need_sync<typename TargetMemorySpace::memory_space> ();
464 template<
class TargetMemorySpace>
466 mv_.template modify<typename TargetMemorySpace::memory_space> ();
490 bool replaceLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
502 bool replaceGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
514 bool sumIntoLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
526 bool sumIntoGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
538 bool getLocalRowView (
const LO localRowIndex,
const LO colIndex, Scalar*& vals)
const;
550 bool getGlobalRowView (
const GO globalRowIndex,
const LO colIndex, Scalar*& vals)
const;
563 typename little_vec_type::HostMirror
564 getLocalBlock (
const LO localRowIndex,
const LO colIndex)
const;
580 const Teuchos::ArrayView<const LO>& permuteToLIDs,
581 const Teuchos::ArrayView<const LO>& permuteFromLIDs);
585 const Teuchos::ArrayView<const LO>& exportLIDs,
586 Teuchos::Array<impl_scalar_type>& exports,
587 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
588 size_t& constantNumPackets,
592 unpackAndCombine (
const Teuchos::ArrayView<const LO> &importLIDs,
593 const Teuchos::ArrayView<const impl_scalar_type> &imports,
594 const Teuchos::ArrayView<size_t> &numPacketsPerLID,
595 size_t constantNumPackets,
608 return static_cast<size_t> (1);
619 return meshLocalIndex != Teuchos::OrdinalTraits<LO>::invalid () &&
647 impl_scalar_type* mvData_;
654 replaceLocalValuesImpl (
const LO localRowIndex,
656 const Scalar vals[])
const;
659 sumIntoLocalValuesImpl (
const LO localRowIndex,
661 const Scalar vals[])
const;
663 static Teuchos::RCP<const mv_type>
666 static Teuchos::RCP<const BlockMultiVector<Scalar, LO, GO, Node> >
674 #endif // TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP Base class for distributed Tpetra objects that support data redistribution.
mv_type getMultiVectorView() const
Get a Tpetra::MultiVector that views this BlockMultiVector's data.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Kokkos::Details::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
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...
bool need_sync() const
Whether this object needs synchronization to the given memory space.
LO getNumVectors() const
Get the number of columns (vectors) in the BlockMultiVector.
Forward declaration of Tpetra::Experimental::BlockCrsMatrix.
impl_scalar_type * getRawPtr() const
Raw pointer to the MultiVector's data.
BlockMultiVector()
Default constructor.
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
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.
LO local_ordinal_type
The type of local indices.
void putScalar(const Scalar &val)
Fill all entries with the given value val.
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.
size_t getStrideY() const
Stride between consecutive local entries in the same row.
virtual bool checkSizes(const Tpetra::SrcDistObject &source)
Compare the source and target (this) objects for compatibility.
One or more distributed dense vectors.
Scalar scalar_type
The type of entries in the matrix.
Forward declaration of Tpetra::Experimental::BlockMultiVector.
MultiVector for multiple degrees of freedom per mesh point.
Node node_type
The Kokkos Node type.
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.
int local_ordinal_type
Default value of Scalar template parameter.
size_t getNumVectors() const
Number of columns in 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.
mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
Node::device_type device_type
The Kokkos Device type.
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
LO getBlockSize() const
Get the number of degrees of freedom per mesh point.
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.
Linear algebra kernels for small dense matrices and vectors.
void modify()
Mark data as modified on 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.
Sets up and executes a communication plan for a Tpetra DistObject.
CombineMode
Rule for combining data in an Import or Export.
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 replaceGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a global index.
Abstract base class for objects that can be the source of an Import or Export operation.
void sync()
Update data to the given target memory space, only if data in the "other" space have been marked as m...
::Kokkos::Compat::KokkosDeviceWrapperNode< execution_space > node_type
Default value of Node template parameter.
::Kokkos::Details::ArithTraits< Packet >::val_type packet_type
The type of each datum being sent or received in an Import or Export.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
size_t getStride() const
Stride between columns in the multivector.
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...
A parallel distribution of indices over processes.
size_t getStrideX() const
Stride between consecutive local entries in the same column.
GO global_ordinal_type
The type of global indices.
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 .
map_type getPointMap() const
Get this BlockMultiVector's (previously computed) point Map.
bool isValidLocalMeshIndex(const LO meshLocalIndex) const
True if and only if meshLocalIndex is a valid local index in the mesh Map.
void update(const Scalar &alpha, const BlockMultiVector< Scalar, LO, GO, Node > &X, const Scalar &beta)
Update: this = beta*this + alpha*X.
void scale(const Scalar &val)
Multiply all entries in place by the given value val.
mv_type mv_
The Tpetra::MultiVector used to represent the data.
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.