53 #ifndef MUELU_PERMUTATIONFACTORY_DEF_HPP_
54 #define MUELU_PERMUTATIONFACTORY_DEF_HPP_
61 #include <Xpetra_Map.hpp>
62 #include <Xpetra_StridedMap.hpp>
63 #include <Xpetra_Vector.hpp>
64 #include <Xpetra_VectorFactory.hpp>
65 #include <Xpetra_Matrix.hpp>
66 #include <Xpetra_CrsMatrixWrap.hpp>
67 #include <Xpetra_Export.hpp>
68 #include <Xpetra_ExportFactory.hpp>
69 #include <Xpetra_Import.hpp>
70 #include <Xpetra_ImportFactory.hpp>
73 #include "MueLu_Utilities.hpp"
76 #include "MueLu_AlgebraicPermutationStrategy.hpp"
77 #include "MueLu_LocalPermutationStrategy.hpp"
82 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
86 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
89 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
95 validParamList->
set< std::string > (
"PermutationRowMapName",
"",
"Name of input row map for which rows the permutation shall be done. (default='')");
96 validParamList->
set<
RCP<const FactoryBase> >(
"PermutationRowMapFactory", Teuchos::null,
"Generating factory of the input row map for the permutation.");
98 validParamList->
set< std::string > (
"PermutationStrategy",
"Algebraic",
"Permutation strategy (default = 'Algebraic', 'Local'");
100 return validParamList;
103 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
105 Input(currentLevel,
"A");
108 std::string mapName = pL.
get<std::string> (
"PermutationRowMapName");
111 if(mapName.length() > 0 ) {
112 currentLevel.
DeclareInput(mapName,mapFactory.get(),
this);
116 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
123 std::string mapName = pL.get<std::string> (
"PermutationRowMapName");
127 if(mapName.length() > 0 ) {
128 permRowMap = currentLevel.Get<
RCP<const Map> >(mapName,mapFactory.get());
130 permRowMap = A->getRowMap();
133 std::string strStrategy = pL.
get<std::string> (
"PermutationStrategy");
134 if( strStrategy ==
"Algebraic" ) {
137 }
else if( strStrategy ==
"Local" ) {
143 "`PermutationStrategy' has incorrect value (" << strStrategy <<
") in input to PermutationFactory."
144 <<
"Check the documentation for a list of valid choices");
146 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)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.
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()