10#ifndef MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
11#define MUELU_THRESHOLDAFILTERFACTORY_DEF_HPP
13#include <Xpetra_Matrix.hpp>
14#include <Xpetra_CrsMatrixWrap.hpp>
23template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
26 , threshold_(threshold)
27 , keepDiagonal_(keepDiagonal)
28 , expectedNNZperRow_(expectedNNZperRow) {}
30template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 Input(currentLevel, varName_);
35template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 RCP<Matrix> Ain = Get<RCP<Matrix> >(currentLevel, varName_);
41 RCP<CrsMatrixWrap> Aout =
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);
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Timer to be used in factories. Similar to Monitor but with additional timers.
Class that holds all level-specific information.
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
void Build(Level ¤tLevel) const
Build an object with this factory.
void DeclareInput(Level ¤tLevel) const
Input.
ThresholdAFilterFactory(const std::string &ename, const magnitudeType threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Constructor.
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitudeType
static RCP< CrsMatrixWrap > GetThresholdedMatrix(const RCP< Matrix > &Ain, const Magnitude threshold, const bool keepDiagonal=true, const GlobalOrdinal expectedNNZperRow=-1)
Threshold a matrix.
Namespace for MueLu classes and methods.
@ Statistics0
Print statistics that do not involve significant additional computation.