LAMA
|
00001 00033 #ifndef LAMA_INVERSESOLVER_HPP_ 00034 #define LAMA_INVERSESOLVER_HPP_ 00035 00036 // for dll_import 00037 #include <lama/config.hpp> 00038 00039 // base classes 00040 #include <lama/solver/Solver.hpp> 00041 00042 // others 00043 #include <lama/matrix/DenseMatrix.hpp> 00044 00045 // logging 00046 #include <logging/Logger.hpp> 00047 00048 namespace lama 00049 { 00050 00054 class LAMA_DLL_IMPORTEXPORT InverseSolver : public Solver 00055 { 00056 public: 00062 InverseSolver(const std::string& id); 00063 00070 InverseSolver(const std::string& id, LoggerPtr logger); 00071 00075 InverseSolver( const InverseSolver& other ); 00076 00077 virtual ~InverseSolver(); 00078 00084 virtual void initialize(const Matrix& coefficients); 00085 00092 virtual void solveImpl(); 00093 00094 virtual void setContext( ContextPtr context ); 00095 00096 void computeInverse( Matrix& matrix ) const; 00097 00098 struct InverseSolverRuntime : SolverRuntime 00099 { 00100 InverseSolverRuntime(); 00101 virtual ~InverseSolverRuntime(); 00102 00103 boost::shared_ptr<Matrix> mInverse; 00104 }; 00105 00106 virtual SolverPtr copy(); 00107 00111 virtual InverseSolverRuntime& getRuntime(); 00112 00116 virtual const InverseSolverRuntime& getConstRuntime() const; 00117 00118 protected: 00119 InverseSolverRuntime mInverseSolverRuntime; 00120 00121 private: 00122 00123 template<typename T> 00124 void invert( DenseMatrix<T>& matrix, IndexType* const permutation ) const; 00125 00126 template<typename T> 00127 void decompose( DenseMatrix<T>& matrix,IndexType* const permutation ) const; 00128 00129 void logStartSolve(); 00130 void logEndSolve(); 00131 00132 LAMA_LOG_DECL_STATIC_LOGGER(logger); 00133 }; 00134 00135 } 00136 00137 #endif // LAMA_INVERSESOLVER_HPP_