30 #include "Ifpack_ConfigDefs.h"
31 #include "Ifpack_DynamicFactory.h"
32 #include "Ifpack_Preconditioner.h"
33 #include "Ifpack_PointRelaxation.h"
34 #include "Ifpack_BlockRelaxation.h"
35 #include "Ifpack_IC.h"
36 #include "Ifpack_ICT.h"
37 #include "Ifpack_ILU.h"
38 #include "Ifpack_ILUT.h"
39 #include "Ifpack_SPARSKIT.h"
40 #include "Ifpack_AdditiveSchwarz.h"
41 #include "Ifpack_DenseContainer.h"
42 #include "Ifpack_SparseContainer.h"
43 #ifdef HAVE_IFPACK_AMESOS
44 #include "Ifpack_Amesos.h"
46 #ifdef HAVE_IFPACK_HIPS
47 #include "Ifpack_HIPS.h"
49 #ifdef HAVE_IFPACK_SUPERLU
50 #include "Ifpack_SILU.h"
53 #include "Ifpack_Chebyshev.h"
54 #include "Ifpack_IHSS.h"
55 #include "Ifpack_SORa.h"
57 #include "Teuchos_StringToIntMap.hpp"
58 #include "Epetra_CrsMatrix.h"
60 std::map<std::string, Ifpack_DynamicFactory::builderFunction>
61 Ifpack_DynamicFactory::PreconditionerMap_;
62 bool Ifpack_DynamicFactory::Initialized_ =
false;
63 int Ifpack_DynamicFactory::NumPreconditioners_ = 0;
68 PreconditionerMap_[
"point relaxation"]
69 = &buildPreconditioner<Ifpack_PointRelaxation, false>;
70 PreconditionerMap_[
"point relaxation stand-alone"]
71 = &buildPreconditioner<Ifpack_PointRelaxation, true>;
72 PreconditionerMap_[
"block relaxation"]
73 = &buildPreconditioner<Ifpack_BlockRelaxation<Ifpack_DenseContainer>,
false>;
74 PreconditionerMap_[
"block relaxation stand-alone"]
75 = &buildPreconditioner<Ifpack_BlockRelaxation<Ifpack_DenseContainer>,
true>;
76 PreconditionerMap_[
"block relaxation stand-alone (ILU)"]
77 = &buildPreconditioner<Ifpack_BlockRelaxation<Ifpack_SparseContainer<Ifpack_ILU> >,
true>;
79 #ifdef HAVE_IFPACK_AMESOS
80 PreconditionerMap_[
"block relaxation stand-alone (Amesos)"]
81 = &buildPreconditioner<Ifpack_BlockRelaxation<Ifpack_SparseContainer<Ifpack_Amesos> >,
true>;
82 PreconditionerMap_[
"block relaxation (Amesos)"]
83 = &buildPreconditioner<Ifpack_BlockRelaxation<Ifpack_SparseContainer<Ifpack_Amesos> >,
false>;
84 PreconditionerMap_[
"Amesos"]
85 = &buildPreconditioner<Ifpack_Amesos, false>;
86 PreconditionerMap_[
"Amesos stand-alone"]
87 = &buildPreconditioner<Ifpack_Amesos, true>;
88 #endif // HAVE_IFPACK_AMESOS
90 PreconditionerMap_[
"IC"] = &buildPreconditioner<Ifpack_IC, false>;
91 PreconditionerMap_[
"IC stand-alone"] = &buildPreconditioner<Ifpack_IC, true>;
92 PreconditionerMap_[
"ICT"] = &buildPreconditioner<Ifpack_ICT, false>;
93 PreconditionerMap_[
"ICT stand-alone"] = &buildPreconditioner<Ifpack_ICT, true>;
94 PreconditionerMap_[
"ILU"] = &buildPreconditioner<Ifpack_ILU, false>;
95 PreconditionerMap_[
"ILU stand-alone"] = &buildPreconditioner<Ifpack_ILU, true>;
96 PreconditionerMap_[
"ILUT"] = &buildPreconditioner<Ifpack_ILUT, false>;
97 PreconditionerMap_[
"ILUT stand-alone"] = &buildPreconditioner<Ifpack_ILUT, true>;
99 #ifdef HAVE_IFPACK_SPARSKIT
100 PreconditionerMap_[
"SPARSKIT"]
101 = &buildPreconditioner<Ifpack_SPARSKIT, true>;
104 #ifdef HAVE_IFPACK_HIPS
105 PreconditionerMap_[
"HIPS"]
106 = &buildPreconditioner<Ifpack_HIPS, true>;
110 PreconditionerMap_[
"Hypre"]
111 = &buildPreconditioner<Ifpack_Hypre, true>;
114 #ifdef HAVE_IFPACK_SUPERLU
115 PreconditionerMap_[
"SILU"]
116 = &buildPreconditioner<Ifpack_SILU, true>;
119 PreconditionerMap_[
"Chebyshev"]
120 = &buildPreconditioner<Ifpack_Chebyshev, true>;
122 #ifdef HAVE_IFPACK_EPETRAEXT
123 PreconditionerMap_[
"IHSS"]
124 = &buildPreconditioner<Ifpack_IHSS, true>;
125 PreconditionerMap_[
"SORa"]
126 = &buildPreconditioner<Ifpack_SORa, true>;
129 NumPreconditioners_ =
131 #ifdef HAVE_IFPACK_AMESOS
135 #ifdef HAVE_IFPACK_SPARSKIT
138 #ifdef HAVE_IFPACK_HIPS
144 #ifdef HAVE_IFPACK_SUPERLU
148 #ifdef HAVE_IFPACK_EPETRAEXT
160 const std::string PrecName,
161 Ifpack_DynamicFactory::builderFunction PrecBuilder)
163 if (PreconditionerMap_.find(PrecName) == PreconditionerMap_.end()) {
164 PreconditionerMap_[PrecName] = PrecBuilder;
165 NumPreconditioners_++;
173 os <<
"Ifpack_DynamicFactory registered preconditioners: " << std::endl;
174 for (std::map<std::string, builderFunction>::const_iterator it = PreconditionerMap_.begin();
175 it != PreconditionerMap_.end(); ++it) {
176 os << it->first << std::endl;
184 bool overrideSerialDefault)
188 std::map<std::string, builderFunction>::const_iterator it
189 = PreconditionerMap_.find(PrecType);
190 bool found = it != PreconditionerMap_.end();
192 builderFunction f = it->second;
193 return f(Matrix, Overlap, serial, overrideSerialDefault);
static void Print(std::ostream &os=std::cout)
Prints the current list of registered preconditioners.
virtual const Epetra_Comm & Comm() const =0
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
static bool Initialize()
Initializes the static data of the Ifpac_DynamicFactory class.
virtual int NumProc() const =0
Ifpack_Preconditioner * Create(const std::string PrecType, Epetra_RowMatrix *Matrix, const int overlap=0, bool overrideSerialDefault=false)
Creates an instance of Ifpack_Preconditioner given the std::string name of the preconditioner type (c...
static int RegisterPreconditioner(const std::string PrecName, builderFunction PrecBuilder)
Register a new preconditioner with the factory.