10 #ifndef TPETRA_BLOCKMULTIVECTOR_DEF_HPP
11 #define TPETRA_BLOCKMULTIVECTOR_DEF_HPP
13 #include "Tpetra_BlockMultiVector_decl.hpp"
16 #include "Teuchos_OrdinalTraits.hpp"
20 template <
class Scalar,
class LO,
class GO,
class Node>
21 const typename BlockMultiVector<Scalar, LO, GO, Node>::mv_type&
27 template <
class Scalar,
class LO,
class GO,
class Node>
34 template <
class Scalar,
class LO,
class GO,
class Node>
35 Teuchos::RCP<const BlockMultiVector<Scalar, LO, GO, Node> >
36 BlockMultiVector<Scalar, LO, GO, Node>::
38 typedef BlockMultiVector<Scalar, LO, GO, Node> BMV;
39 const BMV* src_bmv =
dynamic_cast<const BMV*
>(&src);
40 TEUCHOS_TEST_FOR_EXCEPTION(
41 src_bmv ==
nullptr, std::invalid_argument,
43 "BlockMultiVector: The source object of an Import or Export to a "
44 "BlockMultiVector, must also be a BlockMultiVector.");
45 return Teuchos::rcp(src_bmv,
false);
48 template <
class Scalar,
class LO,
class GO,
class Node>
51 const Teuchos::DataAccess copyOrView)
53 , meshMap_(in.meshMap_)
54 , pointMap_(in.pointMap_)
55 , mv_(in.mv_, copyOrView)
56 , blockSize_(in.blockSize_) {}
58 template <
class Scalar,
class LO,
class GO,
class Node>
66 , pointMap_(makePointMapRCP(meshMap, blockSize))
67 , mv_(pointMap_, numVecs)
69 blockSize_(blockSize) {}
71 template <
class Scalar,
class LO,
class GO,
class Node>
81 , mv_(pointMap_, numVecs)
82 , blockSize_(blockSize) {}
84 template <
class Scalar,
class LO,
class GO,
class Node>
92 , blockSize_(blockSize) {
106 RCP<const mv_type> X_view_const;
109 Teuchos::Array<size_t> cols(0);
110 X_view_const = X_mv.
subView(cols());
112 X_view_const = X_mv.
subView(Teuchos::Range1D(0, numCols - 1));
114 TEUCHOS_TEST_FOR_EXCEPTION(
115 X_view_const.is_null(), std::logic_error,
117 "BlockMultiVector constructor: X_mv.subView(...) returned null. This "
118 "should never happen. Please report this bug to the Tpetra developers.");
123 RCP<mv_type> X_view = Teuchos::rcp_const_cast<
mv_type>(X_view_const);
124 TEUCHOS_TEST_FOR_EXCEPTION(
125 X_view->getCopyOrView() != Teuchos::View, std::logic_error,
127 "BlockMultiVector constructor: We just set a MultiVector "
128 "to have view semantics, but it claims that it doesn't have view "
129 "semantics. This should never happen. "
130 "Please report this bug to the Tpetra developers.");
135 Teuchos::RCP<const map_type> pointMap =
mv_.
getMap();
136 pointMap_ = pointMap;
139 template <
class Scalar,
class LO,
class GO,
class Node>
148 , pointMap_(new
map_type(newPointMap))
149 , mv_(X.mv_, newPointMap, offset * X.getBlockSize())
151 blockSize_(X.getBlockSize()) {}
153 template <
class Scalar,
class LO,
class GO,
class Node>
161 , pointMap_(makePointMapRCP(newMeshMap, X.getBlockSize()))
162 , mv_(X.mv_, pointMap_, offset * X.getBlockSize())
164 blockSize_(X.getBlockSize()) {}
166 template <
class Scalar,
class LO,
class GO,
class Node>
172 template <
class Scalar,
class LO,
class GO,
class Node>
177 typedef typename Teuchos::ArrayView<const GO>::size_type size_type;
179 const GST gblNumMeshMapInds =
181 const size_t lclNumMeshMapIndices =
183 const GST gblNumPointMapInds =
184 gblNumMeshMapInds *
static_cast<GST
>(blockSize);
185 const size_t lclNumPointMapInds =
186 lclNumMeshMapIndices *
static_cast<size_t>(blockSize);
190 return map_type(gblNumPointMapInds, lclNumPointMapInds, indexBase,
197 const size_type lclNumMeshGblInds = lclMeshGblInds.size();
198 Teuchos::Array<GO> lclPointGblInds(lclNumPointMapInds);
199 for (size_type g = 0; g < lclNumMeshGblInds; ++g) {
200 const GO meshGid = lclMeshGblInds[g];
201 const GO pointGidStart = indexBase +
202 (meshGid - indexBase) * static_cast<GO>(blockSize);
203 const size_type offset = g *
static_cast<size_type
>(blockSize);
204 for (LO k = 0; k < blockSize; ++k) {
205 const GO pointGid = pointGidStart +
static_cast<GO
>(k);
206 lclPointGblInds[offset +
static_cast<size_type
>(k)] = pointGid;
209 return map_type(gblNumPointMapInds, lclPointGblInds(), indexBase,
214 template <
class Scalar,
class LO,
class GO,
class Node>
215 Teuchos::RCP<const typename BlockMultiVector<Scalar, LO, GO, Node>::map_type>
219 typedef typename Teuchos::ArrayView<const GO>::size_type size_type;
221 const GST gblNumMeshMapInds =
223 const size_t lclNumMeshMapIndices =
225 const GST gblNumPointMapInds =
226 gblNumMeshMapInds *
static_cast<GST
>(blockSize);
227 const size_t lclNumPointMapInds =
228 lclNumMeshMapIndices *
static_cast<size_t>(blockSize);
232 return Teuchos::rcp(
new map_type(gblNumPointMapInds, lclNumPointMapInds, indexBase,
239 const size_type lclNumMeshGblInds = lclMeshGblInds.size();
240 Teuchos::Array<GO> lclPointGblInds(lclNumPointMapInds);
241 for (size_type g = 0; g < lclNumMeshGblInds; ++g) {
242 const GO meshGid = lclMeshGblInds[g];
243 const GO pointGidStart = indexBase +
244 (meshGid - indexBase) * static_cast<GO>(blockSize);
245 const size_type offset = g *
static_cast<size_type
>(blockSize);
246 for (LO k = 0; k < blockSize; ++k) {
247 const GO pointGid = pointGidStart +
static_cast<GO
>(k);
248 lclPointGblInds[offset +
static_cast<size_type
>(k)] = pointGid;
251 return Teuchos::rcp(
new map_type(gblNumPointMapInds, lclPointGblInds(), indexBase,
256 template <
class Scalar,
class LO,
class GO,
class Node>
260 const Scalar vals[]) {
261 auto X_dst = getLocalBlockHost(localRowIndex, colIndex, Access::ReadWrite);
262 typename const_little_vec_type::host_mirror_type::const_type X_src(reinterpret_cast<const impl_scalar_type*>(vals),
265 using exec_space =
typename device_type::execution_space;
269 template <
class Scalar,
class LO,
class GO,
class Node>
273 const Scalar vals[]) {
274 if (!meshMap_.isNodeLocalElement(localRowIndex)) {
277 replaceLocalValuesImpl(localRowIndex, colIndex, vals);
282 template <
class Scalar,
class LO,
class GO,
class Node>
286 const Scalar vals[]) {
287 const LO localRowIndex = meshMap_.getLocalElement(globalRowIndex);
288 if (localRowIndex == Teuchos::OrdinalTraits<LO>::invalid()) {
291 replaceLocalValuesImpl(localRowIndex, colIndex, vals);
296 template <
class Scalar,
class LO,
class GO,
class Node>
300 const Scalar vals[]) {
301 auto X_dst = getLocalBlockHost(localRowIndex, colIndex, Access::ReadWrite);
302 typename const_little_vec_type::host_mirror_type::const_type X_src(reinterpret_cast<const impl_scalar_type*>(vals),
304 AXPY(static_cast<impl_scalar_type>(STS::one()), X_src, X_dst);
307 template <
class Scalar,
class LO,
class GO,
class Node>
311 const Scalar vals[]) {
312 if (!meshMap_.isNodeLocalElement(localRowIndex)) {
315 sumIntoLocalValuesImpl(localRowIndex, colIndex, vals);
320 template <
class Scalar,
class LO,
class GO,
class Node>
324 const Scalar vals[]) {
325 const LO localRowIndex = meshMap_.getLocalElement(globalRowIndex);
326 if (localRowIndex == Teuchos::OrdinalTraits<LO>::invalid()) {
329 sumIntoLocalValuesImpl(localRowIndex, colIndex, vals);
334 template <
class Scalar,
class LO,
class GO,
class Node>
335 typename BlockMultiVector<Scalar, LO, GO, Node>::const_little_host_vec_type
339 const Access::ReadOnlyStruct)
const {
340 if (!isValidLocalMeshIndex(localRowIndex)) {
341 return const_little_host_vec_type();
343 const size_t blockSize = getBlockSize();
344 auto hostView = mv_.getLocalViewHost(Access::ReadOnly);
345 LO startRow = localRowIndex * blockSize;
346 LO endRow = startRow + blockSize;
347 return Kokkos::subview(hostView, Kokkos::make_pair(startRow, endRow),
352 template <
class Scalar,
class LO,
class GO,
class Node>
353 typename BlockMultiVector<Scalar, LO, GO, Node>::little_host_vec_type
354 BlockMultiVector<Scalar, LO, GO, Node>::
355 getLocalBlockHost(
const LO localRowIndex,
357 const Access::OverwriteAllStruct) {
358 if (!isValidLocalMeshIndex(localRowIndex)) {
359 return little_host_vec_type();
361 const size_t blockSize = getBlockSize();
362 auto hostView = mv_.getLocalViewHost(Access::OverwriteAll);
363 LO startRow = localRowIndex * blockSize;
364 LO endRow = startRow + blockSize;
365 return Kokkos::subview(hostView, Kokkos::make_pair(startRow, endRow),
370 template <
class Scalar,
class LO,
class GO,
class Node>
371 typename BlockMultiVector<Scalar, LO, GO, Node>::little_host_vec_type
375 const Access::ReadWriteStruct) {
376 if (!isValidLocalMeshIndex(localRowIndex)) {
377 return little_host_vec_type();
379 const size_t blockSize = getBlockSize();
380 auto hostView = mv_.getLocalViewHost(Access::ReadWrite);
381 LO startRow = localRowIndex * blockSize;
382 LO endRow = startRow + blockSize;
383 return Kokkos::subview(hostView, Kokkos::make_pair(startRow, endRow),
388 template <
class Scalar,
class LO,
class GO,
class Node>
389 Teuchos::RCP<const typename BlockMultiVector<Scalar, LO, GO, Node>::mv_type>
390 BlockMultiVector<Scalar, LO, GO, Node>::
393 using Teuchos::rcpFromRef;
399 typedef BlockMultiVector<Scalar, LO, GO, Node> this_BMV_type;
400 const this_BMV_type* srcBlkVec =
dynamic_cast<const this_BMV_type*
>(&src);
401 if (srcBlkVec ==
nullptr) {
402 const mv_type* srcMultiVec =
dynamic_cast<const mv_type*
>(&src);
403 if (srcMultiVec ==
nullptr) {
407 return rcp(
new mv_type());
409 return rcp(srcMultiVec,
false);
412 return rcpFromRef(srcBlkVec->mv_);
416 template <
class Scalar,
class LO,
class GO,
class Node>
419 return !getMultiVectorFromSrcDistObject(src).is_null();
422 template <
class Scalar,
class LO,
class GO,
class Node>
425 const size_t numSameIDs,
431 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
432 "Tpetra::BlockMultiVector::copyAndPermute: Do NOT use this "
433 "instead, create a point importer using makePointMap function.");
436 template <
class Scalar,
class LO,
class GO,
class Node>
441 Kokkos::DualView<packet_type*,
443 Kokkos::DualView<
size_t*,
446 size_t& constantNumPackets) {
447 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
448 "Tpetra::BlockMultiVector::packAndPrepare: Do NOT use this; "
449 "instead, create a point importer using makePointMap function.");
452 template <
class Scalar,
class LO,
class GO,
class Node>
456 Kokkos::DualView<packet_type*,
459 Kokkos::DualView<
size_t*,
462 const size_t constantNumPackets,
464 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
465 "Tpetra::BlockMultiVector::unpackAndCombine: Do NOT use this; "
466 "instead, create a point importer using makePointMap function.");
469 template <
class Scalar,
class LO,
class GO,
class Node>
472 return meshLocalIndex != Teuchos::OrdinalTraits<LO>::invalid() &&
473 meshMap_.isNodeLocalElement(meshLocalIndex);
476 template <
class Scalar,
class LO,
class GO,
class Node>
482 template <
class Scalar,
class LO,
class GO,
class Node>
488 template <
class Scalar,
class LO,
class GO,
class Node>
492 const Scalar& beta) {
493 mv_.update(alpha, X.
mv_, beta);
498 template <
typename Scalar,
typename ViewY,
typename ViewD,
typename ViewX>
499 struct BlockWiseMultiply {
500 typedef typename ViewD::size_type Size;
503 typedef typename ViewD::device_type Device;
504 typedef typename ViewD::non_const_value_type ImplScalar;
505 typedef Kokkos::MemoryTraits<Kokkos::Unmanaged> Unmanaged;
507 template <
typename View>
508 using UnmanagedView = Kokkos::View<
typename View::data_type,
typename View::array_layout,
509 typename View::device_type, Unmanaged>;
510 typedef UnmanagedView<ViewY> UnMViewY;
511 typedef UnmanagedView<ViewD> UnMViewD;
512 typedef UnmanagedView<ViewX> UnMViewX;
514 const Size block_size_;
521 BlockWiseMultiply(
const Size block_size,
const Scalar& alpha,
522 const ViewY& Y,
const ViewD& D,
const ViewX& X)
523 : block_size_(block_size)
529 KOKKOS_INLINE_FUNCTION
530 void operator()(
const Size k)
const {
531 #if KOKKOS_VERSION >= 40799
532 const auto zero = KokkosKernels::ArithTraits<Scalar>::zero();
534 const auto zero = Kokkos::ArithTraits<Scalar>::zero();
536 auto D_curBlk = Kokkos::subview(D_, k, Kokkos::ALL(), Kokkos::ALL());
537 const auto num_vecs = X_.extent(1);
538 for (Size i = 0; i < num_vecs; ++i) {
539 Kokkos::pair<Size, Size> kslice(k * block_size_, (k + 1) * block_size_);
540 auto X_curBlk = Kokkos::subview(X_, kslice, i);
541 auto Y_curBlk = Kokkos::subview(Y_, kslice, i);
550 template <
typename Scalar,
typename ViewY,
typename ViewD,
typename ViewX>
551 inline BlockWiseMultiply<Scalar, ViewY, ViewD, ViewX>
552 createBlockWiseMultiply(
const int block_size,
const Scalar& alpha,
553 const ViewY& Y,
const ViewD& D,
const ViewX& X) {
554 return BlockWiseMultiply<Scalar, ViewY, ViewD, ViewX>(block_size, alpha, Y, D, X);
557 template <
typename ViewY,
561 typename LO =
typename ViewY::size_type>
562 class BlockJacobiUpdate {
564 typedef typename ViewD::device_type Device;
565 typedef typename ViewD::non_const_value_type ImplScalar;
566 typedef Kokkos::MemoryTraits<Kokkos::Unmanaged> Unmanaged;
568 template <
typename ViewType>
569 using UnmanagedView = Kokkos::View<
typename ViewType::data_type,
570 typename ViewType::array_layout,
571 typename ViewType::device_type,
573 typedef UnmanagedView<ViewY> UnMViewY;
574 typedef UnmanagedView<ViewD> UnMViewD;
575 typedef UnmanagedView<ViewZ> UnMViewZ;
585 BlockJacobiUpdate(
const ViewY& Y,
590 : blockSize_(D.extent(1))
598 static_assert(static_cast<int>(ViewY::rank) == 1,
599 "Y must have rank 1.");
600 static_assert(static_cast<int>(ViewD::rank) == 3,
"D must have rank 3.");
601 static_assert(static_cast<int>(ViewZ::rank) == 1,
602 "Z must have rank 1.");
608 KOKKOS_INLINE_FUNCTION
void
609 operator()(
const LO& k)
const {
611 using Kokkos::subview;
612 typedef Kokkos::pair<LO, LO> range_type;
613 #if KOKKOS_VERSION >= 40799
614 typedef KokkosKernels::ArithTraits<Scalar> KAT;
616 typedef Kokkos::ArithTraits<Scalar> KAT;
621 auto D_curBlk = subview(D_, k, ALL(), ALL());
622 const range_type kslice(k * blockSize_, (k + 1) * blockSize_);
626 auto Z_curBlk = subview(Z_, kslice);
627 auto Y_curBlk = subview(Y_, kslice);
629 if (beta_ == KAT::zero()) {
631 }
else if (beta_ != KAT::one()) {
638 template <
class ViewY,
642 class LO =
typename ViewD::size_type>
643 void blockJacobiUpdate(
const ViewY& Y,
647 const Scalar& beta) {
648 static_assert(Kokkos::is_view<ViewY>::value,
"Y must be a Kokkos::View.");
649 static_assert(Kokkos::is_view<ViewD>::value,
"D must be a Kokkos::View.");
650 static_assert(Kokkos::is_view<ViewZ>::value,
"Z must be a Kokkos::View.");
651 static_assert(static_cast<int>(ViewY::rank) == static_cast<int>(ViewZ::rank),
652 "Y and Z must have the same rank.");
653 static_assert(static_cast<int>(ViewD::rank) == 3,
"D must have rank 3.");
655 const auto lclNumMeshRows = D.extent(0);
657 #ifdef HAVE_TPETRA_DEBUG
661 const auto blkSize = D.extent(1);
662 const auto lclNumPtRows = lclNumMeshRows * blkSize;
663 TEUCHOS_TEST_FOR_EXCEPTION(Y.extent(0) != lclNumPtRows, std::invalid_argument,
664 "blockJacobiUpdate: Y.extent(0) = " << Y.extent(0) <<
" != "
665 "D.extent(0)*D.extent(1) = "
666 << lclNumMeshRows <<
" * " << blkSize
667 <<
" = " << lclNumPtRows <<
".");
668 TEUCHOS_TEST_FOR_EXCEPTION(Y.extent(0) != Z.extent(0), std::invalid_argument,
669 "blockJacobiUpdate: Y.extent(0) = " << Y.extent(0) <<
" != "
671 << Z.extent(0) <<
".");
672 TEUCHOS_TEST_FOR_EXCEPTION(Y.extent(1) != Z.extent(1), std::invalid_argument,
673 "blockJacobiUpdate: Y.extent(1) = " << Y.extent(1) <<
" != "
675 << Z.extent(1) <<
".");
676 #endif // HAVE_TPETRA_DEBUG
678 BlockJacobiUpdate<ViewY, Scalar, ViewD, ViewZ, LO> functor(Y, alpha, D, Z, beta);
679 typedef Kokkos::RangePolicy<typename ViewY::execution_space, LO> range_type;
681 range_type range(0, static_cast<LO>(lclNumMeshRows));
682 Kokkos::parallel_for(range, functor);
687 template <
class Scalar,
class LO,
class GO,
class Node>
694 typedef typename device_type::execution_space exec_space;
695 const LO lclNumMeshRows = meshMap_.getLocalNumElements();
697 if (alpha == STS::zero()) {
698 this->putScalar(STS::zero());
700 const LO blockSize = this->getBlockSize();
703 auto Y_lcl = this->mv_.getLocalViewDevice(Access::ReadWrite);
704 auto bwm = Impl::createBlockWiseMultiply(blockSize, alphaImpl, Y_lcl, D, X_lcl);
711 Kokkos::RangePolicy<exec_space, LO> range(0, lclNumMeshRows);
712 Kokkos::parallel_for(range, bwm);
716 template <
class Scalar,
class LO,
class GO,
class Node>
723 const Scalar& beta) {
725 using Kokkos::subview;
728 const IST alphaImpl =
static_cast<IST
>(alpha);
729 const IST betaImpl =
static_cast<IST
>(beta);
730 const LO numVecs = mv_.getNumVectors();
732 if (alpha == STS::zero()) {
735 Z.
update(STS::one(), X, -STS::one());
736 for (LO j = 0; j < numVecs; ++j) {
737 auto Y_lcl = this->mv_.getLocalViewDevice(Access::ReadWrite);
739 auto Y_lcl_j = subview(Y_lcl, ALL(), j);
740 auto Z_lcl_j = subview(Z_lcl, ALL(), j);
741 Impl::blockJacobiUpdate(Y_lcl_j, alphaImpl, D, Z_lcl_j, betaImpl);
753 #define TPETRA_BLOCKMULTIVECTOR_INSTANT(S, LO, GO, NODE) \
754 template class BlockMultiVector<S, LO, GO, NODE>;
756 #endif // TPETRA_BLOCKMULTIVECTOR_DEF_HPP
Teuchos::RCP< const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subView(const Teuchos::Range1D &colRng) const
Return a const MultiVector with const views of selected columns.
void update(const Scalar &alpha, const BlockMultiVector< Scalar, LO, GO, Node > &X, const Scalar &beta)
Update: this = beta*this + alpha*X.
bool isContiguous() const
True if this Map is distributed contiguously, else false.
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.
size_t getLocalNumElements() const
The number of elements belonging to the calling process.
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.
Linear algebra kernels for small dense matrices and vectors.
KOKKOS_INLINE_FUNCTION void AXPY(const CoefficientType &alpha, const ViewType1 &x, const ViewType2 &y)
y := y + alpha * x (dense vector or matrix update)
bool replaceGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[])
Replace all values at the given mesh point, using a global index.
static Teuchos::RCP< const map_type > makePointMapRCP(const map_type &meshMap, const LO blockSize)
Create and return an owning RCP to the point Map corresponding to the given mesh Map and block size...
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Accessors for the Teuchos::Comm and Kokkos Node objects.
KOKKOS_INLINE_FUNCTION void FILL(const ViewType &x, const InputType &val)
Set every entry of x to val.
bool replaceLocalValues(const LO localRowIndex, const LO colIndex, const Scalar vals[])
Replace all values at the given mesh point, using local row and column indices.
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.
bool sumIntoLocalValues(const LO localRowIndex, const LO colIndex, const Scalar vals[])
Sum into all values at the given mesh point, using a local index.
MultiVector for multiple degrees of freedom per mesh point.
virtual bool checkSizes(const Tpetra::SrcDistObject &source) override
Compare the source and target (this) objects for compatibility.
Teuchos::ArrayView< const global_ordinal_type > getLocalElementList() const
Return a NONOWNING view of the global indices owned by this process.
size_t global_size_t
Global size_t object.
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
Copy the contents of the MultiVector src into dst.
BlockMultiVector()
Default constructor.
const mv_type & getMultiVectorView() const
Get a Tpetra::MultiVector that views this BlockMultiVector's data.
bool isValidLocalMeshIndex(const LO meshLocalIndex) const
True if and only if meshLocalIndex is a valid local index in the mesh Map.
global_ordinal_type getIndexBase() const
The index base for this Map.
virtual void unpackAndCombine(const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode) override
typename mv_type::device_type device_type
The Kokkos Device type.
CombineMode
Rule for combining data in an Import or Export.
bool sumIntoGlobalValues(const GO globalRowIndex, const LO colIndex, const Scalar vals[])
Sum into all values at the given mesh point, using a global index.
mv_type mv_
The Tpetra::MultiVector used to represent the data.
Abstract base class for objects that can be the source of an Import or Export operation.
dual_view_type::t_dev::const_type getLocalViewDevice(Access::ReadOnlyStruct) const
Return a read-only, up-to-date view of this MultiVector's local data on device. This requires that th...
virtual void copyAndPermute(const SrcDistObject &source, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM) override
KOKKOS_INLINE_FUNCTION void GEMV(const CoeffType &alpha, const BlkType &A, const VecType1 &x, const VecType2 &y)
y := y + alpha * A * x (dense matrix-vector multiply)
Teuchos::DataAccess getCopyOrView() const
Get whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics...
typename dist_object_type::buffer_device_type buffer_device_type
Kokkos::Device specialization used for communication buffers.
virtual Teuchos::RCP< const map_type > getMap() const
The Map describing the parallel distribution of this object.
KOKKOS_INLINE_FUNCTION void SCAL(const CoefficientType &alpha, const ViewType &x)
x := alpha*x, where x is either rank 1 (a vector) or rank 2 (a matrix).
void scale(const Scalar &val)
Multiply all entries in place by the given value val.
typename mv_type::impl_scalar_type impl_scalar_type
The implementation type of entries in the object.
virtual void packAndPrepare(const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets) override
global_size_t getGlobalNumElements() const
The number of elements in this Map.
Declaration of Tpetra::Details::Behavior, a class that describes Tpetra's behavior.