10 #ifndef MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
11 #define MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
14 #include <Xpetra_CrsMatrixWrap.hpp>
23 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
26 , threshold_(threshold)
27 , keepDiagonal_(keepDiagonal)
28 , expectedNNZperRow_(expectedNNZperRow) {}
30 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 Input(currentLevel, varName_);
35 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 RCP<Matrix> Ain = Get<RCP<Matrix> >(currentLevel, varName_);
44 GetOStream(
Statistics0) <<
"Nonzeros in " << varName_ <<
"(input): " << Ain->getGlobalNumEntries() <<
", Nonzeros after filtering " << varName_ <<
" (parameter: " << threshold_ <<
"): " << Aout->getGlobalNumEntries() << std::endl;
45 currentLevel.Set(varName_, Teuchos::rcp_dynamic_cast<Matrix>(Aout),
this);
50 #endif // MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
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.
MueLu::DefaultGlobalOrdinal GlobalOrdinal
static RCP< CrsMatrixWrap > GetThresholdedMatrix(const RCP< Matrix > &Ain, const Magnitude threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Threshold a matrix.
Class that holds all level-specific information.
ThresholdAFilterFactory(const std::string &ename, const magnitudeType threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Constructor.
void Build(Level ¤tLevel) const
Build an object with this factory.
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitudeType