46 #ifndef MUELU_UTILITIES_KOKKOS_DEF_HPP
47 #define MUELU_UTILITIES_KOKKOS_DEF_HPP
50 #include <Teuchos_DefaultComm.hpp>
55 #ifdef HAVE_MUELU_EPETRA
57 # include "Epetra_MpiComm.h"
61 #include <Kokkos_Core.hpp>
62 #include <KokkosSparse_CrsMatrix.hpp>
63 #include <KokkosSparse_getDiagCopy.hpp>
65 #if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_EPETRAEXT)
72 #include <Xpetra_EpetraUtils.hpp>
73 #include <Xpetra_EpetraMultiVector.hpp>
77 #ifdef HAVE_MUELU_TPETRA
78 #include <MatrixMarket_Tpetra.hpp>
79 #include <Tpetra_RowMatrixTransposer.hpp>
80 #include <TpetraExt_MatrixMatrix.hpp>
81 #include <Xpetra_TpetraMultiVector.hpp>
82 #include <Xpetra_TpetraCrsMatrix.hpp>
83 #include <Xpetra_TpetraBlockCrsMatrix.hpp>
86 #ifdef HAVE_MUELU_EPETRA
87 #include <Xpetra_EpetraMap.hpp>
90 #include <Xpetra_BlockedCrsMatrix.hpp>
91 #include <Xpetra_DefaultPlatform.hpp>
92 #include <Xpetra_Import.hpp>
93 #include <Xpetra_ImportFactory.hpp>
94 #include <Xpetra_Map.hpp>
95 #include <Xpetra_MapFactory.hpp>
96 #include <Xpetra_Matrix.hpp>
97 #include <Xpetra_MatrixMatrix.hpp>
98 #include <Xpetra_MatrixFactory.hpp>
99 #include <Xpetra_MultiVector.hpp>
100 #include <Xpetra_MultiVectorFactory.hpp>
101 #include <Xpetra_Operator.hpp>
102 #include <Xpetra_Vector.hpp>
103 #include <Xpetra_VectorFactory.hpp>
107 #include <KokkosKernels_Handle.hpp>
108 #include <KokkosSparse_partitioning_impl.hpp>
114 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 GetMatrixDiagonal(
const Matrix& A) {
119 size_t numRows = A.getRowMap()->getNodeNumElements();
124 for (
size_t i = 0; i < numRows; ++i) {
125 A.getLocalRowView(i, cols, vals);
128 for (; j < cols.
size(); ++j) {
129 if (Teuchos::as<size_t>(cols[j]) == i) {
134 if (j == cols.
size()) {
143 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
145 Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
146 GetMatrixDiagonalInverse(
const Matrix& A, Magnitude tol) {
149 using local_matrix_type =
typename Matrix::local_matrix_type;
150 using local_graph_type =
typename local_matrix_type::staticcrsgraph_type;
151 using value_type =
typename local_matrix_type::value_type;
152 using ordinal_type =
typename local_matrix_type::ordinal_type;
153 using execution_space =
typename local_matrix_type::execution_space;
154 using memory_space =
typename local_matrix_type::memory_space;
160 using KAT = Kokkos::ArithTraits<value_type>;
163 RCP<const Map> rowMap = A.getRowMap();
164 RCP<Vector> diag = VectorFactory::Build(rowMap,
false);
167 local_matrix_type localMatrix = A.getLocalMatrix();
168 auto diagVals = diag->template getLocalView<memory_space>();
170 ordinal_type numRows = localMatrix.graph.numRows();
178 KOKKOS_LAMBDA(
const ordinal_type rowIdx) {
179 bool foundDiagEntry =
false;
180 auto myRow = localMatrix.rowConst(rowIdx);
181 for(ordinal_type entryIdx = 0; entryIdx < myRow.length; ++entryIdx) {
182 if(myRow.colidx(entryIdx) == rowIdx) {
183 foundDiagEntry =
true;
184 if(KAT::magnitude(myRow.value(entryIdx)) > KAT::magnitude(tol)) {
185 diagVals(rowIdx, 0) = KAT::one() / myRow.value(entryIdx);
187 diagVals(rowIdx, 0) = KAT::zero();
193 if(!foundDiagEntry) {diagVals(rowIdx, 0) = KAT::zero();}
199 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
200 RCP<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
201 Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
202 GetMatrixOverlappedDiagonal(
const Matrix& A) {
204 RCP<const Map> rowMap = A.getRowMap(), colMap = A.getColMap();
205 RCP<Vector> localDiag = VectorFactory::Build(rowMap);
208 const CrsMatrixWrap* crsOp =
dynamic_cast<const CrsMatrixWrap*
>(&A);
210 throw Exceptions::RuntimeError(
"cast to CrsMatrixWrap failed");
213 crsOp->getLocalDiagOffsets(offsets);
214 crsOp->getLocalDiagCopy(*localDiag,offsets());
217 ArrayRCP<SC> localDiagVals = localDiag->getDataNonConst(0);
219 for (LO i = 0; i < localDiagVals.size(); i++)
220 localDiagVals[i] = diagVals[i];
221 localDiagVals = diagVals = null;
224 RCP<Vector> diagonal = VectorFactory::Build(colMap);
225 RCP< const Import> importer;
226 importer = A.getCrsGraph()->getImporter();
227 if (importer == Teuchos::null) {
228 importer = ImportFactory::Build(rowMap, colMap);
230 diagonal->doImport(*localDiag, *(importer), Xpetra::INSERT);
235 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
236 void Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
238 bool doInverse,
bool doFillComplete,
bool doOptimizeStorage)
243 for (
int i = 0; i < scalingVector.
size(); ++i)
244 sv[i] = one / scalingVector[i];
246 for (
int i = 0; i < scalingVector.
size(); ++i)
247 sv[i] = scalingVector[i];
250 switch (Op.getRowMap()->lib()) {
251 case Xpetra::UseTpetra:
252 MyOldScaleMatrix_Tpetra(Op, sv, doFillComplete, doOptimizeStorage);
255 case Xpetra::UseEpetra:
258 throw std::runtime_error(
"FIXME");
259 #ifndef __NVCC__ //prevent nvcc warning
264 throw Exceptions::RuntimeError(
"Only Epetra and Tpetra matrices can be scaled.");
265 #ifndef __NVCC__ //prevent nvcc warning
271 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
272 void Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::MyOldScaleMatrix_Epetra(Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>& ,
const Teuchos::ArrayRCP<Scalar>& ,
bool ,
bool ) {
273 throw Exceptions::RuntimeError(
"MyOldScaleMatrix_Epetra: Epetra needs SC=double and LO=GO=int.");
276 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
277 void Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::MyOldScaleMatrix_Tpetra(Matrix& Op,
const Teuchos::ArrayRCP<SC>& scalingVector,
279 bool doOptimizeStorage)
281 #ifdef HAVE_MUELU_TPETRA
283 Tpetra::CrsMatrix<SC,LO,GO,NO>& tpOp = Op2NonConstTpetraCrs(Op);
285 const RCP<const Tpetra::Map<LO,GO,NO> > rowMap = tpOp.getRowMap();
286 const RCP<const Tpetra::Map<LO,GO,NO> > domainMap = tpOp.getDomainMap();
287 const RCP<const Tpetra::Map<LO,GO,NO> > rangeMap = tpOp.getRangeMap();
289 size_t maxRowSize = tpOp.getNodeMaxNumRowEntries();
290 if (maxRowSize == Teuchos::as<size_t>(-1))
293 std::vector<SC> scaledVals(maxRowSize);
294 if (tpOp.isFillComplete())
297 if (Op.isLocallyIndexed() ==
true) {
301 for (
size_t i = 0; i < rowMap->getNodeNumElements(); ++i) {
302 tpOp.getLocalRowView(i, cols, vals);
303 size_t nnz = tpOp.getNumEntriesInLocalRow(i);
304 if (nnz > maxRowSize) {
306 scaledVals.resize(maxRowSize);
308 for (
size_t j = 0; j < nnz; ++j)
309 scaledVals[j] = vals[j]*scalingVector[i];
313 tpOp.replaceLocalValues(i, cols, valview);
321 for (
size_t i = 0; i < rowMap->getNodeNumElements(); ++i) {
322 GO gid = rowMap->getGlobalElement(i);
323 tpOp.getGlobalRowView(gid, cols, vals);
324 size_t nnz = tpOp.getNumEntriesInGlobalRow(gid);
325 if (nnz > maxRowSize) {
327 scaledVals.resize(maxRowSize);
330 for (
size_t j = 0; j < nnz; ++j)
331 scaledVals[j] = vals[j]*scalingVector[i];
335 tpOp.replaceGlobalValues(gid, cols, valview);
340 if (doFillComplete) {
341 if (domainMap == Teuchos::null || rangeMap == Teuchos::null)
342 throw Exceptions::RuntimeError(
"In Utils_kokkos::Scaling: cannot fillComplete because the domain and/or range map hasn't been defined");
345 params->set(
"Optimize Storage", doOptimizeStorage);
346 params->set(
"No Nonlocal Changes",
true);
347 Op.fillComplete(Op.getDomainMap(), Op.getRangeMap(), params);
350 throw Exceptions::RuntimeError(
"Only Tpetra::CrsMatrix types can be scaled (Err.1)");
353 throw Exceptions::RuntimeError(
"Matrix scaling is not possible because Tpetra has not been enabled.");
358 template <
class SC,
class LO,
class GO,
class NO>
362 const bool count_twos_as_dirichlet) {
363 using ATS = Kokkos::ArithTraits<SC>;
366 auto localMatrix = A.getLocalMatrix();
367 LO numRows = A.getNodeNumRows();
370 if (count_twos_as_dirichlet)
371 Kokkos::parallel_for(
"MueLu:Utils::DetectDirichletRows_Twos_As_Dirichlet", range_type(0,numRows),
372 KOKKOS_LAMBDA(
const LO row) {
373 auto rowView = localMatrix.row(row);
374 auto length = rowView.length;
376 boundaryNodes(row) =
true;
378 decltype(length) colID;
379 for (colID = 0; colID < length; colID++)
380 if ((rowView.colidx(colID) != row) &&
381 (ATS::magnitude(rowView.value(colID)) > tol)) {
382 if (!boundaryNodes(row))
384 boundaryNodes(row) =
false;
387 boundaryNodes(row) =
true;
392 KOKKOS_LAMBDA(
const LO row) {
393 auto rowView = localMatrix.row(row);
394 auto length = rowView.length;
396 boundaryNodes(row) =
true;
397 for (decltype(length) colID = 0; colID < length; colID++)
398 if ((rowView.colidx(colID) != row) &&
399 (ATS::magnitude(rowView.value(colID)) > tol)) {
400 boundaryNodes(row) =
false;
405 return boundaryNodes;
408 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
412 return MueLu::DetectDirichletRows<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, tol, count_twos_as_dirichlet);
415 template <
class Node>
419 return MueLu::DetectDirichletRows<double,int,int,Node>(A, tol,count_twos_as_dirichlet);
423 template <
class SC,
class LO,
class GO,
class NO>
427 using ATS = Kokkos::ArithTraits<SC>;
428 using impl_ATS = Kokkos::ArithTraits<typename ATS::val_type>;
431 SC zero = ATS::zero();
434 auto localMatrix = A.getLocalMatrix();
435 LO numRows = A.getNodeNumRows();
440 myColsToZero->putScalar(zero);
441 auto myColsToZeroView = myColsToZero->template getLocalView<typename NO::device_type>();
444 KOKKOS_LAMBDA(
const LO row) {
445 if (dirichletRows(row)) {
446 auto rowView = localMatrix.row(row);
447 auto length = rowView.length;
449 for (decltype(length) colID = 0; colID < length; colID++)
450 myColsToZeroView(rowView.colidx(colID),0) = one;
455 globalColsToZero->putScalar(zero);
458 globalColsToZero->doExport(*myColsToZero,*exporter,Xpetra::ADD);
460 myColsToZero->doImport(*globalColsToZero,*exporter,Xpetra::INSERT);
462 auto myCols = myColsToZero->template getLocalView<typename NO::device_type>();
463 size_t numColEntries = colMap->getNodeNumElements();
465 const typename ATS::magnitudeType eps = 2.0*ATS::eps();
468 KOKKOS_LAMBDA (
const size_t i) {
469 dirichletCols(i) = impl_ATS::magnitude(myCols(i,0))>eps;
471 return dirichletCols;
475 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
480 return MueLu::DetectDirichletCols<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, dirichletRows);
483 template <
class Node>
488 return MueLu::DetectDirichletCols<double,int,int,Node>(A, dirichletRows);
493 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
500 auto localMatrix = A->getLocalMatrix();
505 if (dirichletRows(row)) {
506 auto rowView = localMatrix.row(row);
507 auto length = rowView.length;
508 for (decltype(length) colID = 0; colID < length; colID++)
509 rowView.value(colID) = replaceWith;
514 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
517 ZeroDirichletRows(RCP<Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& A,
520 MueLu::ZeroDirichletRows<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, dirichletRows, replaceWith);
523 template <
class Node>
528 double replaceWith) {
529 return MueLu::ZeroDirichletRows<double,int,int,Node>(A, dirichletRows, replaceWith);
534 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
540 auto myCols = X->template getLocalView<typename Node::device_type>();
541 size_t numVecs = X->getNumVectors();
543 KOKKOS_LAMBDA(
const size_t i) {
544 if (dirichletRows(i)) {
545 for(
size_t j=0; j<numVecs; j++)
546 myCols(i,j) = replaceWith;
551 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
554 ZeroDirichletRows(RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& X,
557 MueLu::ZeroDirichletRows<Scalar,LocalOrdinal,GlobalOrdinal,Node>(X, dirichletRows, replaceWith);
560 template <
class Node>
565 double replaceWith) {
566 return MueLu::ZeroDirichletRows<double,int,int,Node>(X, dirichletRows, replaceWith);
571 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
578 auto localMatrix = A->getLocalMatrix();
583 auto rowView = localMatrix.row(row);
584 auto length = rowView.length;
585 for (decltype(length) colID = 0; colID < length; colID++)
586 if (dirichletCols(rowView.colidx(colID))) {
587 rowView.value(colID) = replaceWith;
592 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
595 ZeroDirichletCols(RCP<Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& A,
598 MueLu::ZeroDirichletCols<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, dirichletCols, replaceWith);
601 template <
class Node>
606 double replaceWith) {
607 return MueLu::ZeroDirichletCols<double,int,int,Node>(A, dirichletCols, replaceWith);
611 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
612 RCP<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
613 Utilities_kokkos<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
614 RealValuedToScalarMultiVector(RCP<RealValuedMultiVector > X) {
615 RCP<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > Xscalar;
616 #if defined(HAVE_XPETRA_TPETRA) && (defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) || defined(HAVE_TPETRA_INST_COMPLEX_FLOAT))
620 if ((
typeid(
Scalar).name() ==
typeid(std::complex<double>).name()) ||
621 (
typeid(
Scalar).name() ==
typeid(std::complex<float>).name())) {
622 size_t numVecs = X->getNumVectors();
623 Xscalar = Xpetra::MultiVectorFactory<Scalar,LocalOrdinal,GlobalOrdinal,Node>::Build(X->getMap(),numVecs);
624 auto XVec = X->template getLocalView<typename Node::device_type>();
625 auto XVecScalar = Xscalar->template getLocalView<typename Node::device_type>();
627 Kokkos::parallel_for(
"MueLu:Utils::RealValuedToScalarMultiVector", range_type(0,X->getLocalLength()),
628 KOKKOS_LAMBDA(
const size_t i) {
629 for (
size_t j=0; j<numVecs; j++)
630 XVecScalar(i,j) = XVec(i,j);
634 Xscalar = rcp_dynamic_cast<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >(X);
638 template <
class Node>
639 RCP<Xpetra::MultiVector<double,int,int,Node> >
640 Utilities_kokkos<double,int,int,Node>::
641 RealValuedToScalarMultiVector(RCP<Xpetra::MultiVector<Magnitude,int,int,Node> > X) {
646 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
648 using local_matrix_type =
typename Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::local_matrix_type;
649 using local_graph_type =
typename local_matrix_type::staticcrsgraph_type;
650 using lno_nnz_view_t =
typename local_graph_type::entries_type::non_const_type;
651 using device =
typename local_graph_type::device_type;
652 using execution_space =
typename local_matrix_type::execution_space;
653 using ordinal_type =
typename local_matrix_type::ordinal_type;
655 local_matrix_type localMatrix = Op.getLocalMatrix();
656 using KernelHandle = KokkosKernels::Experimental::KokkosKernelsHandle<
typename local_graph_type::size_type,
LocalOrdinal,
Scalar,
657 typename device::execution_space,
typename device::memory_space,
typename device::memory_space>;
659 using rcm_t = KokkosSparse::Impl::RCM<KernelHandle, typename local_graph_type::row_map_type::const_type, typename local_graph_type::entries_type::non_const_type>;
661 rcm_t rcm(localMatrix.numRows(), localMatrix.graph.row_map, localMatrix.graph.entries);
662 lno_nnz_view_t rcmOrder = rcm.rcm();
665 Xpetra::VectorFactory<LocalOrdinal,LocalOrdinal,GlobalOrdinal,Node>::Build(Op.getRowMap());
668 auto view1D = Kokkos::subview(retval->template getLocalView<device>(),Kokkos::ALL (), 0);
671 KOKKOS_LAMBDA(
const ordinal_type rowIdx) {
672 view1D(rcmOrder(rowIdx)) = rowIdx;
677 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
679 using local_matrix_type =
typename Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::local_matrix_type;
680 using local_graph_type =
typename local_matrix_type::staticcrsgraph_type;
681 using lno_nnz_view_t =
typename local_graph_type::entries_type::non_const_type;
682 using device =
typename local_graph_type::device_type;
683 using execution_space =
typename local_matrix_type::execution_space;
684 using ordinal_type =
typename local_matrix_type::ordinal_type;
686 local_matrix_type localMatrix = Op.getLocalMatrix();
687 using KernelHandle = KokkosKernels::Experimental::KokkosKernelsHandle<
typename local_graph_type::size_type,
LocalOrdinal,
Scalar,
688 typename device::execution_space,
typename device::memory_space,
typename device::memory_space>;
690 using rcm_t = KokkosSparse::Impl::RCM<KernelHandle, typename local_graph_type::row_map_type::const_type, typename local_graph_type::entries_type::non_const_type>;
692 rcm_t rcm(localMatrix.numRows(), localMatrix.graph.row_map, localMatrix.graph.entries);
693 lno_nnz_view_t rcmOrder = rcm.cuthill_mckee();
696 Xpetra::VectorFactory<LocalOrdinal,LocalOrdinal,GlobalOrdinal,Node>::Build(Op.getRowMap());
699 auto view1D = Kokkos::subview(retval->template getLocalView<device>(),Kokkos::ALL (), 0);
702 KOKKOS_LAMBDA(
const ordinal_type rowIdx) {
703 view1D(rcmOrder(rowIdx)) = rowIdx;
708 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
711 return MueLu::ReverseCuthillMcKee<Scalar,LocalOrdinal,GlobalOrdinal,Node>(Op);
714 template <
class Node>
717 return MueLu::ReverseCuthillMcKee<double,int,int,Node>(Op);
720 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
723 return MueLu::CuthillMcKee<Scalar,LocalOrdinal,GlobalOrdinal,Node>(Op);
726 template <
class Node>
729 return MueLu::CuthillMcKee<double,int,int,Node>(Op);
734 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
739 using ATS = Kokkos::ArithTraits<Scalar>;
740 using impl_ATS = Kokkos::ArithTraits<typename ATS::val_type>;
748 TEUCHOS_ASSERT(static_cast<size_t>(dirichletRows.size()) == Rmap->getNodeNumElements());
750 const Scalar one = impl_ATS::one();
751 const Scalar zero = impl_ATS::zero();
753 auto localMatrix = A->getLocalMatrix();
754 auto localRmap = Rmap->getLocalMap();
755 auto localCmap = Cmap->getLocalMap();
759 if (dirichletRows(row)){
760 auto rowView = localMatrix.row(row);
761 auto length = rowView.length;
762 auto row_gid = localRmap.getGlobalElement(row);
763 auto row_lid = localCmap.getLocalElement(row_gid);
765 for (decltype(length) colID = 0; colID < length; colID++)
766 if (rowView.colidx(colID) == row_lid)
767 rowView.value(colID) = one;
769 rowView.value(colID) = zero;
774 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
779 MueLu::ApplyOAZToMatrixRows<Scalar,LocalOrdinal,GlobalOrdinal,Node>(A, dirichletRows);
782 template <
class Node>
787 MueLu::ApplyOAZToMatrixRows<double,int,int,Node>(A, dirichletRows);
792 #define MUELU_UTILITIES_KOKKOS_SHORT
793 #endif // MUELU_UTILITIES_KOKKOS_DEF_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
Teuchos::RCP< Xpetra::Vector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > > ReverseCuthillMcKee(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent(const iType &r) const noexcept
void ZeroDirichletCols(RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Kokkos::View< const bool *, typename Node::device_type > &dirichletCols, Scalar replaceWith)
void ZeroDirichletRows(RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Kokkos::View< const bool *, typename Node::device_type > &dirichletRows, Scalar replaceWith)
Teuchos::RCP< Xpetra::Vector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > > CuthillMcKee(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
void ApplyOAZToMatrixRows(Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Kokkos::View< const bool *, typename Node::device_type > &dirichletRows)
static RCP< Time > getNewTimer(const std::string &name)
Kokkos::View< bool *, typename NO::device_type > DetectDirichletRows(const Xpetra::Matrix< SC, LO, GO, NO > &A, const typename Teuchos::ScalarTraits< SC >::magnitudeType &tol, const bool count_twos_as_dirichlet)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
void parallel_for(const ExecPolicy &policy, const FunctorType &functor, const std::string &str="", typename std::enable_if< Kokkos::Impl::is_execution_policy< ExecPolicy >::value >::type *=nullptr)
#define TEUCHOS_ASSERT(assertion_test)
Kokkos::View< bool *, typename NO::device_type > DetectDirichletCols(const Xpetra::Matrix< SC, LO, GO, NO > &A, const Kokkos::View< const bool *, typename NO::device_type > &dirichletRows)