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 #ifndef PLAYA_ILUKPRECONDITIONERFACTORY_HPP
00043 #define PLAYA_ILUKPRECONDITIONERFACTORY_HPP
00044
00045 #include "PlayaDefs.hpp"
00046 #include "PlayaPreconditionerFactoryBase.hpp"
00047 #include "PlayaLinearOperatorDecl.hpp"
00048 #include "Teuchos_ParameterList.hpp"
00049 #include "PlayaILUFactorizableOp.hpp"
00050 #include "PlayaLinearSolverBaseDecl.hpp"
00051
00052 namespace Playa
00053 {
00054 using namespace Teuchos;
00055
00056
00057
00058
00059 template <class Scalar>
00060 class ILUKPreconditionerFactory
00061 : public PreconditionerFactoryBase<Scalar>
00062 {
00063 public:
00064
00065 ILUKPreconditionerFactory(const ParameterList& params)
00066 : fillLevels_(1),
00067 overlapFill_(0),
00068 relaxationValue_(0.0),
00069 relativeThreshold_(1.0),
00070 absoluteThreshold_(0.0),
00071 leftOrRight_(Right)
00072 {
00073 LinearSolverBase<Scalar>::template setParameter<int>(params, &fillLevels_,
00074 "Graph Fill");
00075
00076 LinearSolverBase<Scalar>::template setParameter<int>(params, &overlapFill_,
00077 "Overlap");
00078
00079 LinearSolverBase<Scalar>::template setParameter<double>(params, &relaxationValue_,
00080 "Relaxation");
00081
00082 LinearSolverBase<Scalar>::template setParameter<double>(params, &absoluteThreshold_,
00083 "Absolute Threshold");
00084
00085 LinearSolverBase<Scalar>::template setParameter<double>(params, &relativeThreshold_,
00086 "Relative Threshold");
00087
00088 bool isLeft = false;
00089
00090 LinearSolverBase<Scalar>::template setParameter<bool>(params, &isLeft, "Left");
00091
00092 if (isLeft) leftOrRight_ = Left;
00093
00094 }
00095
00096
00097
00098 virtual ~ILUKPreconditionerFactory(){;}
00099
00100
00101
00102 virtual Preconditioner <Scalar>
00103 createPreconditioner(const LinearOperator<Scalar>& A) const
00104 {
00105
00106
00107
00108
00109 const ILUFactorizableOp<Scalar>* fop
00110 = dynamic_cast<const ILUFactorizableOp<Scalar>*>(A.ptr().get());
00111
00112 TEUCHOS_TEST_FOR_EXCEPTION(fop==0, std::runtime_error,
00113 "ILUKPreconditionerFactory attempted to "
00114 "create an ILU preconditioner for an operator type "
00115 "that does not implement the ILUFactorizableOp "
00116 "interface. The op is " << A.description());
00117
00118
00119
00120
00121 Preconditioner<Scalar> P;
00122 fop->getILUKPreconditioner(fillLevels_,
00123 overlapFill_,
00124 relaxationValue_,
00125 relativeThreshold_,
00126 absoluteThreshold_,
00127 leftOrRight_,
00128 P);
00129
00130 return P;
00131 }
00132
00133
00134 GET_RCP(PreconditionerFactoryBase<Scalar>);
00135 private:
00136
00137 int fillLevels_;
00138 int overlapFill_;
00139 Scalar relaxationValue_;
00140 Scalar relativeThreshold_;
00141 Scalar absoluteThreshold_;
00142 LeftOrRight leftOrRight_;
00143 };
00144
00145
00146 }
00147
00148 #endif