46 #ifndef MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
47 #define MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
50 #include <Xpetra_CrsMatrixWrap.hpp>
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
62 , threshold_(threshold)
63 , keepDiagonal_(keepDiagonal)
64 , expectedNNZperRow_(expectedNNZperRow) {}
66 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 Input(currentLevel, varName_);
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 RCP<Matrix> Ain = Get<RCP<Matrix> >(currentLevel, varName_);
80 GetOStream(
Statistics0) <<
"Nonzeros in " << varName_ <<
"(input): " << Ain->getGlobalNumEntries() <<
", Nonzeros after filtering " << varName_ <<
" (parameter: " << threshold_ <<
"): " << Aout->getGlobalNumEntries() << std::endl;
81 currentLevel.Set(varName_, Teuchos::rcp_dynamic_cast<Matrix>(Aout),
this);
86 #endif // MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
static RCP< CrsMatrixWrap > GetThresholdedMatrix(const RCP< Matrix > &Ain, const Scalar threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Threshold a matrix.
void DeclareInput(Level ¤tLevel) const
Input.
Timer to be used in factories. Similar to Monitor but with additional timers.
Print statistics that do not involve significant additional computation.
ThresholdAFilterFactory(const std::string &ename, const Scalar threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Constructor.
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
void Build(Level ¤tLevel) const
Build an object with this factory.