Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "PlayaParameterListPreconditionerFactory.hpp"
00044 #include "PlayaGenericRightPreconditioner.hpp"
00045
00046 #ifndef HAVE_TEUCHOS_EXPLICIT_INSTANTIATION
00047 #include "PlayaVectorImpl.hpp"
00048 #include "PlayaLinearOperatorImpl.hpp"
00049 #endif
00050
00051 using namespace Playa;
00052 using namespace Teuchos;
00053
00054 Preconditioner<double> ParameterListPreconditionerFactory::
00055 createPreconditioner(const LinearOperator<double>& A) const
00056 {
00057 const std::string& pType = params_.get<string>("Type");
00058
00059 Preconditioner<double> rtn;
00060
00061 if (pType=="ML")
00062 {
00063 std::string precType = params_.get<string>("Problem Type");
00064 ParameterList mlParams;
00065 ML_Epetra::SetDefaults(precType, mlParams);
00066 ParameterList::ConstIterator iter;
00067 ParameterList mlSettings = params_.sublist("ML Settings");
00068 for (iter=mlSettings.begin(); iter!=mlSettings.end(); ++iter)
00069 {
00070 const std::string& name = mlSettings.name(iter);
00071 const ParameterEntry& entry = mlSettings.entry(iter);
00072 mlParams.setEntry(name, entry);
00073 }
00074 RCP<LinearOperatorBase<double> > mlp
00075 = rcp(new MLOperator(A, mlParams));
00076 LinearOperator<double> P = mlp;
00077 rtn = new GenericRightPreconditioner<double>(P);
00078 }
00079 else if (pType=="Ifpack")
00080 {
00081 ParameterList iluSettings = params_.sublist("Ifpack Settings");
00082 RCP<PreconditionerFactoryBase<double> > pf
00083 = rcp(new ILUKPreconditionerFactory<double>(iluSettings));
00084 rtn = pf->createPreconditioner(A);
00085 }
00086 else
00087 {
00088 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
00089 "preconditioner type=[" << pType << "] not recognized");
00090 }
00091
00092 return rtn;
00093 }