10 #ifndef MUELU_UTILITIES_DECL_HPP
11 #define MUELU_UTILITIES_DECL_HPP
17 #include <Teuchos_DefaultComm.hpp>
21 #include <Xpetra_TpetraBlockCrsMatrix_fwd.hpp>
24 #include <Xpetra_CrsMatrixWrap.hpp>
35 #ifdef HAVE_MUELU_EPETRA
47 #ifdef HAVE_MUELU_EPETRAEXT
54 #include <Tpetra_CrsMatrix.hpp>
55 #include <Tpetra_BlockCrsMatrix.hpp>
56 #include <Tpetra_BlockCrsMatrix_Helpers.hpp>
57 #include <Tpetra_FECrsMatrix.hpp>
58 #include <Tpetra_RowMatrixTransposer.hpp>
59 #include <Tpetra_Map.hpp>
60 #include <Tpetra_MultiVector.hpp>
61 #include <Tpetra_FEMultiVector.hpp>
66 #include <MueLu_UtilitiesBase.hpp>
70 #ifdef HAVE_MUELU_EPETRA
72 template <
typename SC,
typename LO,
typename GO,
typename NO>
73 RCP<Xpetra::CrsMatrixWrap<SC, LO, GO, NO>>
76 template <
typename SC,
typename LO,
typename GO,
typename NO>
77 RCP<Xpetra::Matrix<SC, LO, GO, NO>>
80 template <
typename SC,
typename LO,
typename GO,
typename NO>
81 RCP<Xpetra::MultiVector<SC, LO, GO, NO>>
85 template <
typename SC,
typename LO,
typename GO,
typename NO>
86 RCP<Xpetra::Matrix<SC, LO, GO, NO>>
89 template <
typename SC,
typename LO,
typename GO,
typename NO>
90 RCP<Xpetra::Matrix<SC, LO, GO, NO>>
93 template <
typename SC,
typename LO,
typename GO,
typename NO>
94 RCP<Xpetra::MultiVector<SC, LO, GO, NO>>
97 template <
typename SC,
typename LO,
typename GO,
typename NO>
98 RCP<Xpetra::MultiVector<SC, LO, GO, NO>>
101 template <
typename SC,
typename LO,
typename GO,
typename NO>
104 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
120 class Utilities :
public UtilitiesBase<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
121 #undef MUELU_UTILITIES_SHORT
127 #ifdef HAVE_MUELU_EPETRA
151 bool doFillComplete =
true,
bool doOptimizeStorage =
true);
154 bool doFillComplete,
bool doOptimizeStorage);
156 bool doFillComplete,
bool doOptimizeStorage);
168 #ifdef HAVE_MUELU_EPETRA
186 #undef MUELU_UTILITIES_SHORT
198 if (tmpVec == Teuchos::null)
199 throw Exceptions::BadCast(
"Cast from Xpetra::MultiVector to Xpetra::EpetraMultiVector failed");
200 return tmpVec->getEpetra_MultiVector();
204 if (tmpVec == Teuchos::null)
205 throw Exceptions::BadCast(
"Cast from Xpetra::MultiVector to Xpetra::EpetraMultiVector failed");
206 return tmpVec->getEpetra_MultiVector();
220 if (crsOp == Teuchos::null)
223 if (tmp_ECrsMtx == Teuchos::null)
224 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::EpetraCrsMatrix failed");
225 return tmp_ECrsMtx->getEpetra_CrsMatrix();
229 if (crsOp == Teuchos::null)
232 if (tmp_ECrsMtx == Teuchos::null)
233 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::EpetraCrsMatrix failed");
234 return tmp_ECrsMtx->getEpetra_CrsMatrixNonConst();
239 const CrsMatrixWrap& crsOp =
dynamic_cast<const CrsMatrixWrap&
>(Op);
242 return *tmp_ECrsMtx.getEpetra_CrsMatrix();
243 }
catch (std::bad_cast&) {
244 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::EpetraCrsMatrix failed");
246 }
catch (std::bad_cast&) {
252 CrsMatrixWrap& crsOp =
dynamic_cast<CrsMatrixWrap&
>(Op);
255 return *tmp_ECrsMtx.getEpetra_CrsMatrixNonConst();
256 }
catch (std::bad_cast&) {
257 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::EpetraCrsMatrix failed");
259 }
catch (std::bad_cast&) {
266 if (xeMap == Teuchos::null)
267 throw Exceptions::BadCast(
"Utilities::Map2EpetraMap : Cast from Xpetra::Map to Xpetra::EpetraMap failed");
268 return xeMap->getEpetra_Map();
274 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
275 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
282 if (crsOp == Teuchos::null)
289 return tmp_Crs->getTpetra_CrsMatrixNonConst();
292 if (tmp_BlockCrs.is_null())
293 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::TpetraCrsMatrix and Xpetra::TpetraBlockCrsMatrix failed");
294 return tmp_BlockCrs->getTpetra_BlockCrsMatrixNonConst();
296 }
else if (!rmat.is_null()) {
297 return rmat->getTpetra_RowMatrix();
308 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
309 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
316 if (crsOp == Teuchos::null)
323 return tmp_Crs->getTpetra_CrsMatrixNonConst();
326 if (tmp_BlockCrs.is_null())
327 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::TpetraCrsMatrix and Xpetra::TpetraBlockCrsMatrix failed");
328 return tmp_BlockCrs->getTpetra_BlockCrsMatrixNonConst();
330 }
else if (!rmat.is_null()) {
331 return rmat->getTpetra_RowMatrixNonConst();
342 bool doFillComplete =
true,
bool doOptimizeStorage =
true) {
346 for (
int i = 0; i < scalingVector.
size(); ++i)
347 sv[i] = one / scalingVector[i];
349 for (
int i = 0; i < scalingVector.
size(); ++i)
350 sv[i] = scalingVector[i];
353 switch (Op.getRowMap()->lib()) {
369 bool doFillComplete,
bool doOptimizeStorage) {
370 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
371 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
372 throw Exceptions::RuntimeError(
"Matrix scaling is not possible because Tpetra has not been compiled with support for LO=GO=int.");
382 if (maxRowSize == Teuchos::as<size_t>(-1))
385 std::vector<Scalar> scaledVals(maxRowSize);
389 if (Op.isLocallyIndexed() ==
true) {
392 for (
size_t i = 0; i < rowMap->getLocalNumElements(); ++i) {
395 if (nnz > maxRowSize) {
397 scaledVals.resize(maxRowSize);
399 for (
size_t j = 0; j < nnz; ++j)
400 scaledVals[j] = vals[j] * scalingVector[i];
413 for (
size_t i = 0; i < rowMap->getLocalNumElements(); ++i) {
417 if (nnz > maxRowSize) {
419 scaledVals.resize(maxRowSize);
422 for (
size_t j = 0; j < nnz; ++j)
423 scaledVals[j] = vals[j] * scalingVector[i];
433 if (doFillComplete) {
434 if (domainMap == Teuchos::null || rangeMap == Teuchos::null)
435 throw Exceptions::RuntimeError(
"In Utilities::Scaling: cannot fillComplete because the domain and/or range map hasn't been defined");
438 params->
set(
"Optimize Storage", doOptimizeStorage);
439 params->
set(
"No Nonlocal Changes",
true);
440 Op.fillComplete(Op.getDomainMap(), Op.getRangeMap(), params);
449 #ifdef HAVE_MUELU_EPETRA
461 for (
int j = 0; j < nnz; ++j)
462 vals[j] *= scalingVector[i];
470 #endif // HAVE_MUELU_EPETRA
479 switch (Op.getRowMap()->lib()) {
481 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
482 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
483 throw Exceptions::RuntimeError(
"Utilities::Transpose: Tpetra is not compiled with LO=GO=int. Add TPETRA_INST_INT_INT:BOOL=ON to your configuration!");
487 if (Helpers::isTpetraCrs(Op)) {
498 transposeParams->set(
"sort",
false);
506 if (Op.IsView(
"stridedMaps"))
507 AAAA->CreateView(
"stridedMaps", Teuchos::rcpFromRef(Op),
true );
512 else if (Helpers::isTpetraBlockCrs(Op)) {
515 const BCRS& tpetraOp = toTpetraBlock(Op);
523 transposeParams->set(
"sort",
false);
531 if (Op.IsView(
"stridedMaps"))
532 AAAA->CreateView(
"stridedMaps", Teuchos::rcpFromRef(Op),
true );
539 throw Exceptions::RuntimeError(
"Utilities::Transpose failed, perhaps because matrix is not a Crs or BlockCrs matrix");
544 #if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_EPETRAEXT)
557 if (Op.IsView(
"stridedMaps"))
558 AAAA->CreateView(
"stridedMaps", Teuchos::rcpFromRef(Op),
true );
587 #if (defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_INT)) || \
588 (!defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_INT))
593 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_FLOAT)
606 paramList.
remove(
"Coordinates");
608 #if !defined(HAVE_TPETRA_EXPLICIT_INSTANTIATION) || defined(HAVE_TPETRA_INST_FLOAT)
612 paramList.
remove(
"Coordinates");
613 doubleCoords =
rcp(
new tdMV(floatCoords->getMap(), floatCoords->getNumVectors()));
618 if (doubleCoords != Teuchos::null) {
622 #endif // Tpetra instantiated on GO=int and EpetraNode
624 #if defined(HAVE_MUELU_EPETRA)
628 paramList.
remove(
"Coordinates");
636 if (paramList.
isType<decltype(coordinates)>(
"Coordinates")) {
637 coordinates = paramList.
get<decltype(coordinates)>(
"Coordinates");
646 #endif // HAVE_MUELU_EPETRA
692 #ifdef HAVE_MUELU_EPETRA
697 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
698 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
705 return rcp(
new XCrsMatrixWrap(Atmp));
712 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
713 RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
723 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
724 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
731 return rcp(
new XCrsMatrixWrap(Atmp));
761 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
763 LocalOrdinal nBlks = (Amat.getRowMap()->getLocalNumElements()) / blkSize;
768 for (
size_t i = 0; i < blkSize; i++) rowScaling[i] = 1.0;
769 for (
size_t i = 0; i < blkSize; i++) colScaling[i] = 1.0;
771 for (
size_t k = 0; k < nSweeps; k++) {
773 for (
size_t i = 0; i < blkSize; i++) rowScaleUpdate[i] = 0.0;
776 for (
size_t j = 0; j < blkSize; j++) {
781 for (
size_t kk = 0; kk < Teuchos::as<size_t>(vals.
size()); kk++) {
782 size_t modGuy = (cols[kk] + 1) % blkSize;
783 if (modGuy == 0) modGuy = blkSize;
793 for (
size_t i = 0; i < blkSize; i++) rowScaleUpdate[i] = tempUpdate[i];
801 for (
size_t i = 1; i < blkSize; i++) {
802 Scalar temp = (rowScaleUpdate[i] / rowScaling[i]) / rowScaling[i];
806 for (
size_t i = 0; i < blkSize; i++) rowScaling[i] *= sqrt(minUpdate / rowScaleUpdate[i]);
809 for (
size_t i = 0; i < blkSize; i++) colScaleUpdate[i] = 0.0;
812 for (
size_t j = 0; j < blkSize; j++) {
816 for (
size_t kk = 0; kk < Teuchos::as<size_t>(vals.
size()); kk++) {
817 size_t modGuy = (cols[kk] + 1) % blkSize;
818 if (modGuy == 0) modGuy = blkSize;
826 for (
size_t i = 0; i < blkSize; i++) colScaleUpdate[i] = tempUpdate[i];
834 for (
size_t i = 1; i < blkSize; i++) {
835 Scalar temp = (colScaleUpdate[i] / colScaling[i]) / colScaling[i];
839 for (
size_t i = 0; i < blkSize; i++) colScaling[i] *= sqrt(minUpdate / colScaleUpdate[i]);
847 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
848 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
855 RCP<XCrsMatrix> Atmp =
rcp(
new XTCrsMatrix(rcp_dynamic_cast<tpetra_crs_matrix_type>(Atpetra)));
856 return rcp(
new XCrsMatrixWrap(Atmp));
863 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
864 RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
873 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
874 RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
877 RCP<const MV> Vmv = Teuchos::rcp_dynamic_cast<
const MV>(Vtpetra);
884 std::ostringstream buf;
889 #ifdef HAVE_MUELU_EPETRA
894 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
895 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
902 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
903 RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
911 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
912 RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
919 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
920 RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
927 std::string
lowerCase(
const std::string& s);
929 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
942 toggleVec->putScalar(1);
948 std::vector<GO> finalDropMapEntries = {};
949 auto finalVec_h_2D = finalVec->getHostLocalView(Xpetra::Access::ReadOnly);
950 auto finalVec_h_1D = Kokkos::subview(finalVec_h_2D, Kokkos::ALL(), 0);
951 const size_t localLength = finalVec->getLocalLength();
953 for (
size_t k = 0; k < localLength; ++k) {
955 finalDropMapEntries.push_back(finalVec->getMap()->getGlobalElement(k));
966 #define MUELU_UTILITIES_SHORT
967 #endif // MUELU_UTILITIES_DECL_HPP
Exception indicating invalid cast attempted.
static const Epetra_MultiVector & MV2EpetraMV(const MultiVector &vec)
MueLu::DefaultLocalOrdinal LocalOrdinal
RCP< Xpetra::Matrix< SC, LO, GO, NO > > EpetraCrs_To_XpetraMatrix(const Teuchos::RCP< Epetra_CrsMatrix > &A)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
static void MyOldScaleMatrix(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const Teuchos::ArrayRCP< const Scalar > &scalingVector, bool doInverse=true, bool doFillComplete=true, bool doOptimizeStorage=true)
static RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > RealValuedToScalarMultiVector(RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::coordinateType, LocalOrdinal, GlobalOrdinal, Node >> X)
static const Epetra_Map & Map2EpetraMap(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map)
Teuchos::RCP< const map_type > getRangeMap() const override
T & get(const std::string &name, T def_value)
static RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::magnitudeType, LocalOrdinal, GlobalOrdinal, Node > > ExtractCoordinatesFromParameterList(ParameterList ¶mList)
static RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op2NonConstTpetraRow(RCP< Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >> Op)
bool is_null(const std::shared_ptr< T > &p)
static RCP< Epetra_CrsMatrix > Op2NonConstEpetraCrs(RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> Op)
Teuchos::ScalarTraits< Scalar >::magnitudeType Magnitude
static RCP< const Epetra_CrsMatrix > Op2EpetraCrs(RCP< const Matrix > Op)
RCP< Xpetra::MultiVector< SC, LO, GO, NO > > TpetraMultiVector_To_XpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< SC, LO, GO, NO >> &Vtpetra)
void resumeFill(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
RCP< Xpetra::Matrix< SC, LO, GO, NO > > TpetraFECrs_To_XpetraMatrix(const Teuchos::RCP< Tpetra::FECrsMatrix< SC, LO, GO, NO >> &Atpetra)
static RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op2NonConstTpetraRow(RCP< Operator > Op)
static RCP< const Epetra_MultiVector > MV2EpetraMV(RCP< MultiVector > const vec)
Helper utility to pull out the underlying Epetra objects from an Xpetra object.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
bool IsParamMuemexVariable(const std::string &name)
static void MyOldScaleMatrix_Tpetra(Matrix &Op, const Teuchos::ArrayRCP< Scalar > &scalingVector, bool doFillComplete, bool doOptimizeStorage)
static RCP< Time > getNewTimer(const std::string &name)
int ExtractMyRowView(int MyRow, int &NumEntries, double *&Values, int *&Indices) const
RCP< Xpetra::MultiVector< SC, LO, GO, NO > > TpetraFEMultiVector_To_XpetraMultiVector(const Teuchos::RCP< Tpetra::FEMultiVector< SC, LO, GO, NO >> &Vtpetra)
const Epetra_Map & RowMap() const
bool isParameter(const std::string &name) const
int NumMyElements() const
void deep_copy(MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
bool remove(std::string const &name, bool throwIfNotExists=true)
static Epetra_CrsMatrix & Op2NonConstEpetraCrs(Matrix &Op)
size_t getLocalMaxNumRowEntries() const override
virtual void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const =0
static RCP< Epetra_CrsMatrix > Op2NonConstEpetraCrs(RCP< Matrix > Op)
bool isFillComplete() const override
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static RCP< Epetra_MultiVector > MV2NonConstEpetraMV(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> vec)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int >> &comm, LocalGlobal lg=Xpetra::GloballyDistributed)
static Epetra_MultiVector & MV2NonConstEpetraMV(MultiVector &vec)
static RCP< Epetra_MultiVector > MV2NonConstEpetraMV(RCP< MultiVector > vec)
void leftRghtDofScalingWithinNode(const Xpetra::Matrix< SC, LO, GO, NO > &Atpetra, size_t blkSize, size_t nSweeps, Teuchos::ArrayRCP< SC > &rowScaling, Teuchos::ArrayRCP< SC > &colScaling)
RCP< Xpetra::Matrix< SC, LO, GO, NO > > TpetraCrs_To_XpetraMatrix(const Teuchos::RCP< Tpetra::CrsMatrix< SC, LO, GO, NO >> &Atpetra)
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Transpose(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, bool optimizeTranspose=false, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
static RCP< Matrix > Transpose(Matrix &Op, bool=false, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Transpose a Xpetra::Matrix.
local_ordinal_type replaceGlobalValues(const global_ordinal_type globalRow, const Kokkos::View< const global_ordinal_type *, Kokkos::AnonymousSpace > &inputInds, const Kokkos::View< const impl_scalar_type *, Kokkos::AnonymousSpace > &inputVals)
RCP< Xpetra::CrsMatrixWrap< SC, LO, GO, NO > > Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap(RCP< Epetra_CrsMatrix > &epAB)
size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const override
bool IsParamValidVariable(const std::string &name)
static RCP< Vector > Build(const Teuchos::RCP< const Map > &map, bool zeroOut=true)
static RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::magnitudeType, LocalOrdinal, GlobalOrdinal, Node > > RealValuedToScalarMultiVector(RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::coordinateType, LocalOrdinal, GlobalOrdinal, Node >> X)
Teuchos::RCP< bcrs_matrix_type > createTranspose(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
static magnitudeType magnitude(T a)
std::string lowerCase(const std::string &s)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
Teuchos::RCP< crs_matrix_type > createTranspose(const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
static RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op2TpetraRow(RCP< const Operator > Op)
Helper utility to pull out the underlying Tpetra objects from an Xpetra object.
static void MyOldScaleMatrix_Epetra(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const Teuchos::ArrayRCP< Scalar > &scalingVector, bool doFillComplete, bool doOptimizeStorage)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Teuchos::RCP< const map_type > getDomainMap() const override
Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > importOffRankDroppingInfo(Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node >> &localDropMap, Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &Ain)
bool isType(const std::string &name) const
static RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op2TpetraRow(RCP< const Xpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node >> Op)
Helper utility to pull out the underlying Tpetra objects from an Xpetra object.
virtual void getGlobalRowView(GlobalOrdinal GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const =0
Wraps an existing MueLu::Hierarchy as a Tpetra::Operator.
EpetraCrsMatrixT< int, EpetraNode > EpetraCrsMatrix
static RCP< const Epetra_MultiVector > MV2EpetraMV(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> const vec)
Helper utility to pull out the underlying Epetra objects from an Xpetra object.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const override
Exception throws to report errors in the internal logical of the program.
virtual void getLocalRowView(LocalOrdinal LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const =0
local_ordinal_type replaceLocalValues(const local_ordinal_type localRow, const Kokkos::View< const local_ordinal_type *, Kokkos::AnonymousSpace > &inputInds, const Kokkos::View< const impl_scalar_type *, Kokkos::AnonymousSpace > &inputVals)
static const Epetra_Map & Map2EpetraMap(const Map &map)
void TokenizeStringAndStripWhiteSpace(const std::string &stream, std::vector< std::string > &tokenList, const char *delimChars)
static void MyOldScaleMatrix(Matrix &Op, const Teuchos::ArrayRCP< const Scalar > &scalingVector, bool doInverse=true, bool doFillComplete=true, bool doOptimizeStorage=true)
static void MyOldScaleMatrix_Epetra(Matrix &Op, const Teuchos::ArrayRCP< Scalar > &scalingVector, bool, bool)
static void MyOldScaleMatrix_Tpetra(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const Teuchos::ArrayRCP< Scalar > &scalingVector, bool doFillComplete, bool doOptimizeStorage)
Teuchos::RCP< const Teuchos::Comm< int > > GenerateNodeComm(RCP< const Teuchos::Comm< int > > &baseComm, int &NodeId, const int reductionFactor)
RCP< Xpetra::MultiVector< SC, LO, GO, NO > > EpetraMultiVector_To_XpetraMultiVector(const Teuchos::RCP< Epetra_MultiVector > &V)
static const Epetra_CrsMatrix & Op2EpetraCrs(const Matrix &Op)
Teuchos::ScalarTraits< Scalar >::magnitudeType Magnitude
static RCP< const Epetra_CrsMatrix > Op2EpetraCrs(RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> Op)
static RCP< Xpetra::MultiVector< typename Teuchos::ScalarTraits< Scalar >::magnitudeType, LocalOrdinal, GlobalOrdinal, Node > > ExtractCoordinatesFromParameterList(ParameterList ¶mList)
Extract coordinates from parameter list and return them in a Xpetra::MultiVector. ...
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
static RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
Extract non-serializable data from level-specific sublists and move it to a separate parameter list...
Teuchos::RCP< const map_type > getRowMap() const override