Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef PLAYA_ICCPRECONDITIONERFACTORY_HPP
00006 #define PLAYA_ICCPRECONDITIONERFACTORY_HPP
00007
00008 #include "PlayaDefs.hpp"
00009 #include "PlayaPreconditionerFactoryBase.hpp"
00010 #include "PlayaLinearOperatorDecl.hpp"
00011 #include "Teuchos_ParameterList.hpp"
00012 #include "PlayaICCFactorizableOp.hpp"
00013 #include "PlayaLinearSolverBaseDecl.hpp"
00014
00015 namespace Playa
00016 {
00017 using namespace Teuchos;
00018
00019
00020
00021
00022 template <class Scalar>
00023 class ICCPreconditionerFactory
00024 : public PreconditionerFactoryBase<Scalar>
00025 {
00026 public:
00027
00028
00029 ICCPreconditionerFactory():
00030 fillLevels_(1),
00031 overlapFill_(0),
00032 relaxationValue_(0.0),
00033 relativeThreshold_(1.0),
00034 absoluteThreshold_(0.0){;}
00035
00036 ICCPreconditionerFactory(int fillLevels, int overlapFill, Scalar relaxationValue, Scalar relativeThreshold, Scalar absoluteThreshold)
00037 {
00038 fillLevels_=fillLevels;
00039 overlapFill_=overlapFill;
00040 relaxationValue_=relaxationValue;
00041 relativeThreshold_=relativeThreshold;
00042 absoluteThreshold_=absoluteThreshold;
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 virtual ~ICCPreconditionerFactory(){;}
00064
00065
00066
00067 virtual Preconditioner <Scalar>
00068 createPreconditioner(const LinearOperator<Scalar>& A) const
00069 {
00070
00071
00072
00073
00074 const ICCFactorizableOp<Scalar>* fop
00075 = dynamic_cast<const ICCFactorizableOp<Scalar>*>(A.ptr().get());
00076
00077 TEUCHOS_TEST_FOR_EXCEPTION(fop==0, std::runtime_error,
00078 "ICCPreconditionerFactory attempted to "
00079 "create an ICC preconditioner for an operator type "
00080 "that does not implement the ICCFactorizableOp "
00081 "interface. The op is " << A.description());
00082
00083
00084
00085
00086 Preconditioner<Scalar> P;
00087 fop->getICCPreconditioner(fillLevels_,
00088 overlapFill_,
00089 relaxationValue_,
00090 relativeThreshold_,
00091 absoluteThreshold_,
00092 P);
00093
00094 return P;
00095 }
00096
00097
00098 GET_RCP(PreconditionerFactoryBase<Scalar>);
00099 private:
00100
00101 int fillLevels_;
00102 int overlapFill_;
00103 Scalar relaxationValue_;
00104 Scalar relativeThreshold_;
00105 Scalar absoluteThreshold_;
00106 };
00107
00108
00109 }
00110
00111 #endif