42 #ifndef TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP 43 #define TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP 45 #include <Tpetra_MultiVector.hpp> 49 namespace Experimental {
51 #ifndef DOXYGEN_SHOULD_SKIP_THIS 53 template<
class S,
class LO,
class GO,
class N>
class BlockCrsMatrix;
54 #endif // DOXYGEN_SHOULD_SKIP_THIS 146 class GO = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
153 typedef Teuchos::ScalarTraits<Scalar> STS;
156 typedef Scalar packet_type;
204 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
215 Kokkos::MemoryTraits<Kokkos::Unmanaged> >
288 const size_t offset = 0);
296 const size_t offset = 0);
350 void scale (
const Scalar& val);
359 update (
const Scalar& alpha,
450 template<
class TargetMemorySpace>
452 mv_.template sync<typename TargetMemorySpace::memory_space> ();
456 template<
class TargetMemorySpace>
458 return mv_.template need_sync<typename TargetMemorySpace::memory_space> ();
466 template<
class TargetMemorySpace>
468 mv_.template modify<typename TargetMemorySpace::memory_space> ();
492 bool replaceLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
504 bool replaceGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
516 bool sumIntoLocalValues (
const LO localRowIndex,
const LO colIndex,
const Scalar vals[])
const;
528 bool sumIntoGlobalValues (
const GO globalRowIndex,
const LO colIndex,
const Scalar vals[])
const;
540 bool getLocalRowView (
const LO localRowIndex,
const LO colIndex, Scalar*& vals)
const;
552 bool getGlobalRowView (
const GO globalRowIndex,
const LO colIndex, Scalar*& vals)
const;
565 typename little_vec_type::HostMirror
566 getLocalBlock (
const LO localRowIndex,
const LO colIndex)
const;
582 const Teuchos::ArrayView<const LO>& permuteToLIDs,
583 const Teuchos::ArrayView<const LO>& permuteFromLIDs);
587 const Teuchos::ArrayView<const LO>& exportLIDs,
588 Teuchos::Array<impl_scalar_type>& exports,
589 const Teuchos::ArrayView<size_t>& numPacketsPerLID,
590 size_t& constantNumPackets,
595 const Teuchos::ArrayView<const impl_scalar_type> &imports,
596 const Teuchos::ArrayView<size_t> &numPacketsPerLID,
597 size_t constantNumPackets,
610 return static_cast<size_t> (1);
621 return meshLocalIndex != Teuchos::OrdinalTraits<LO>::invalid () &&
627 template<
class Scalar2,
class LO2,
class GO2,
class Node2>
660 replaceLocalValuesImpl (
const LO localRowIndex,
662 const Scalar vals[])
const;
665 sumIntoLocalValuesImpl (
const LO localRowIndex,
667 const Scalar vals[])
const;
669 static Teuchos::RCP<const mv_type>
672 static Teuchos::RCP<const BlockMultiVector<Scalar, LO, GO, Node> >
679 #endif // TPETRA_EXPERIMENTAL_BLOCKMULTIVECTOR_DECL_HPP Node::device_type device_type
The Kokkos Device type.
void sync()
Update data to the given target memory space, only if data in the "other" space have been marked as m...
Namespace Tpetra contains the class and methods constituting the Tpetra library.
size_t getStride() const
Stride between columns in the multivector.
LO local_ordinal_type
The type of local indices.
mv_type mv_
The Tpetra::MultiVector used to represent the data.
LO getBlockSize() const
Get the number of degrees of freedom per mesh point.
bool replaceGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[]) const
Replace all values at the given mesh point, using a global index.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
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.
size_t getStrideY() const
Stride between consecutive local entries in the same row.
void putScalar(const Scalar &val)
Fill all entries with the given value val.
Tpetra::Map< LO, GO, Node > map_type
The specialization of Tpetra::Map that this class uses.
bool need_sync() const
Whether this object needs synchronization to the given memory space.
MultiVector for multiple degrees of freedom per mesh point.
bool isValidLocalMeshIndex(const LO meshLocalIndex) const
True if and only if meshLocalIndex is a valid local index in the mesh Map.
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.
Node node_type
The Kokkos Node type.
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...
virtual void unpackAndCombine(const Teuchos::ArrayView< const LO > &importLIDs, const Teuchos::ArrayView< const impl_scalar_type > &imports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t constantNumPackets, Tpetra::Distributor &distor, Tpetra::CombineMode CM)
Perform any unpacking and combining after communication (old version that uses Teuchos memory managem...
int local_ordinal_type
Default value of LocalOrdinal template parameter.
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.
mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the matrix.
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.
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.
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.
Linear algebra kernels for small dense matrices and vectors.
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.
Abstract base class for objects that can be the source of an Import or Export operation.
double scalar_type
Default value of Scalar template parameter.
mv_type getMultiVectorView() const
Get a Tpetra::MultiVector that views this BlockMultiVector's data.
Kokkos::Details::ArithTraits< Scalar >::val_type impl_scalar_type
The type used internally in place of Scalar.
void modify()
Mark data as modified on the given memory space.
virtual bool checkSizes(const Tpetra::SrcDistObject &source)
Compare the source and target (this) objects for compatibility.
GO global_ordinal_type
The type of global indices.
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 getNumVectors() const
Number of columns in the multivector.
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. ...
Scalar scalar_type
The type of entries in the matrix.
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.
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
BlockMultiVector()
Default constructor.
virtual void copyAndPermute(const Tpetra::SrcDistObject &source, size_t numSameIDs, const Teuchos::ArrayView< const LO > &permuteToLIDs, const Teuchos::ArrayView< const LO > &permuteFromLIDs)
Perform copies and permutations that are local to this process.
size_t getStrideX() const
Stride between consecutive local entries in the same column.
impl_scalar_type * getRawPtr() const
Raw pointer to the MultiVector's data.
map_type getPointMap() const
Get this BlockMultiVector's (previously computed) point Map.
virtual void packAndPrepare(const Tpetra::SrcDistObject &source, const Teuchos::ArrayView< const LO > &exportLIDs, Teuchos::Array< impl_scalar_type > &exports, const Teuchos::ArrayView< size_t > &numPacketsPerLID, size_t &constantNumPackets, Tpetra::Distributor &distor)
Perform any packing or preparation required for communication.
Base class for distributed Tpetra objects that support data redistribution.
bool isNodeLocalElement(LocalOrdinal localIndex) const
Whether the given local index is valid for this Map on the calling process.
Tpetra::MultiVector< Scalar, LO, GO, Node > mv_type
The specialization of Tpetra::MultiVector that this class uses.
LO getNumVectors() const
Get the number of columns (vectors) in the BlockMultiVector.