17 #ifndef MUELU_PERMUTATIONFACTORY_DEF_HPP_
18 #define MUELU_PERMUTATIONFACTORY_DEF_HPP_
25 #include <Xpetra_Map.hpp>
26 #include <Xpetra_StridedMap.hpp>
30 #include <Xpetra_CrsMatrixWrap.hpp>
39 #include "MueLu_AlgebraicPermutationStrategy.hpp"
40 #include "MueLu_LocalPermutationStrategy.hpp"
45 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
48 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
57 validParamList->
set<std::string>(
"PermutationRowMapName",
"",
"Name of input row map for which rows the permutation shall be done. (default='')");
58 validParamList->
set<
RCP<const FactoryBase> >(
"PermutationRowMapFactory", Teuchos::null,
"Generating factory of the input row map for the permutation.");
60 validParamList->
set<std::string>(
"PermutationStrategy",
"Algebraic",
"Permutation strategy (default = 'Algebraic', 'Local'");
62 return validParamList;
65 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 Input(currentLevel,
"A");
70 std::string mapName = pL.
get<std::string>(
"PermutationRowMapName");
73 if (mapName.length() > 0) {
74 currentLevel.
DeclareInput(mapName, mapFactory.get(),
this);
78 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 std::string mapName = pL.get<std::string>(
"PermutationRowMapName");
89 if (mapName.length() > 0) {
90 permRowMap = currentLevel.Get<
RCP<const Map> >(mapName, mapFactory.get());
92 permRowMap = A->getRowMap();
95 std::string strStrategy = pL.
get<std::string>(
"PermutationStrategy");
96 if (strStrategy ==
"Algebraic") {
99 }
else if (strStrategy ==
"Local") {
105 "`PermutationStrategy' has incorrect value (" << strStrategy <<
") in input to PermutationFactory."
106 <<
"Check the documentation for a list of valid choices");
108 GetOStream(
Runtime0) <<
"Using " << strStrategy <<
" permutation strategy." << std::endl;
void BuildPermutation(const Teuchos::RCP< Matrix > &A, const Teuchos::RCP< const Map > &permRowMap, Level ¤tLevel, const FactoryBase *genFactory) const
build permutation operators
void BuildPermutation(const Teuchos::RCP< Matrix > &A, const Teuchos::RCP< const Map > permRowMap, Level ¤tLevel, const FactoryBase *genFactory) const
build permutation operators
T & get(const std::string &name, T def_value)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual ~PermutationFactory()
Destructor.
Local permutation strategy.
PermutationFactory()
Constructor.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Algebraic permutation strategy.
void Build(Level ¤tLevel) const
Build an object with this factory.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()