00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_PRECONDITIONERFACTORY_HPP 00006 #define PLAYA_PRECONDITIONERFACTORY_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaHandle.hpp" 00010 #include "PlayaPreconditionerFactoryBase.hpp" 00011 00012 namespace Playa 00013 { 00014 /** 00015 * PreconditionerFactory builds an implementation-specific preconditioner 00016 * from an abstract specification. 00017 * 00018 * Preconditioners are constructed indirectly through factories 00019 * rather then directly by preconditioner ctor calls. 00020 * The reason for this is that when we create a solver and want to 00021 * specify the preconditioner, we don't yet know the matrix (or even 00022 * the type or size of matrix) on which the solver is going to operate. 00023 * Thus we have to defer construction of the preconditioner until 00024 * the solve() call when the matrix is available. The factory gives 00025 * us a means by which we can build a preconditioner at that point. 00026 */ 00027 template <class Scalar> 00028 class PreconditionerFactory 00029 : public Playa::Handle<PreconditionerFactoryBase<Scalar> > 00030 { 00031 public: 00032 /* Boilerplate ctors */ 00033 HANDLE_CTORS(PreconditionerFactory<Scalar>, PreconditionerFactoryBase<Scalar>); 00034 00035 /** create a concrete preconditioner */ 00036 Preconditioner<Scalar> createPreconditioner(const LinearOperator<Scalar>& A) const 00037 {return this->ptr()->createPreconditioner(A);} 00038 00039 }; 00040 } 00041 00042 #endif