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_ICCPRECONDITIONERFACTORY_HPP
00043 #define PLAYA_ICCPRECONDITIONERFACTORY_HPP
00044
00045 #include "PlayaDefs.hpp"
00046 #include "PlayaPreconditionerFactoryBase.hpp"
00047 #include "PlayaLinearOperatorDecl.hpp"
00048 #include "Teuchos_ParameterList.hpp"
00049 #include "PlayaICCFactorizableOp.hpp"
00050 #include "PlayaLinearSolverBaseDecl.hpp"
00051
00052 namespace Playa
00053 {
00054 using namespace Teuchos;
00055
00056
00057
00058
00059 template <class Scalar>
00060 class ICCPreconditionerFactory
00061 : public PreconditionerFactoryBase<Scalar>
00062 {
00063 public:
00064
00065 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00066
00067
00068 ICCPreconditionerFactory():
00069 fillLevels_(1),
00070 overlapFill_(0),
00071 dropTolerance_(1.0e-4),
00072 relaxationValue_(0.0),
00073 relativeThreshold_(1.0),
00074 absoluteThreshold_(0.0){;}
00075
00076 ICCPreconditionerFactory(int fillLevels,
00077 int overlapFill,
00078 ScalarMag dropTolerance,
00079 ScalarMag relaxationValue,
00080 ScalarMag relativeThreshold,
00081 ScalarMag absoluteThreshold)
00082 {
00083 fillLevels_=fillLevels;
00084 overlapFill_=overlapFill;
00085 dropTolerance_ = dropTolerance;
00086 relaxationValue_=relaxationValue;
00087 relativeThreshold_=relativeThreshold;
00088 absoluteThreshold_=absoluteThreshold;
00089 }
00090
00091
00092 virtual ~ICCPreconditionerFactory(){;}
00093
00094
00095
00096 virtual Preconditioner <Scalar>
00097 createPreconditioner(const LinearOperator<Scalar>& A) const
00098 {
00099
00100
00101
00102
00103 const ICCFactorizableOp<Scalar>* fop
00104 = dynamic_cast<const ICCFactorizableOp<Scalar>*>(A.ptr().get());
00105
00106 TEUCHOS_TEST_FOR_EXCEPTION(fop==0, std::runtime_error,
00107 "ICCPreconditionerFactory attempted to "
00108 "create an ICC preconditioner for an operator type "
00109 "that does not implement the ICCFactorizableOp "
00110 "interface. The op is " << A.description());
00111
00112
00113
00114
00115 Preconditioner<Scalar> P;
00116 fop->getICCPreconditioner(fillLevels_,
00117 overlapFill_,
00118 dropTolerance_,
00119 relaxationValue_,
00120 relativeThreshold_,
00121 absoluteThreshold_,
00122 P);
00123
00124 return P;
00125 }
00126
00127
00128 GET_RCP(PreconditionerFactoryBase<Scalar>);
00129 private:
00130
00131 int fillLevels_;
00132 int overlapFill_;
00133 ScalarMag dropTolerance_;
00134 ScalarMag relaxationValue_;
00135 ScalarMag relativeThreshold_;
00136 ScalarMag absoluteThreshold_;
00137 };
00138
00139
00140 }
00141
00142 #endif