// ============================================================================ // == == // == AMDiS - Adaptive multidimensional simulations == // == == // ============================================================================ // == == // == crystal growth group == // == == // == Stiftung caesar == // == Ludwig-Erhard-Allee 2 == // == 53175 Bonn == // == germany == // == == // ============================================================================ // == == // == http://www.caesar.de/cg/AMDiS == // == == // ============================================================================ /** \file UmfPackSolver.h */ #ifndef AMDIS_UMFPACKSOLVER_H #define AMDIS_UMFPACKSOLVER_H #ifdef HAVE_UMFPACK #include "OEMSolver.h" #include "MemoryManager.h" namespace AMDiS { // ============================================================================ // ===== class UmfPackSolver ================================================== // ============================================================================ /** * \ingroup Solver * * \brief * Wrapper for the external UMFPACK solver: * http://www.cise.ufl.edu/research/sparse/umfpack/ * * This is a direct solver for large sparse matrices. */ template class UmfPackSolver : public OEMSolver { public: MEMORY_MANAGED(UmfPackSolver); /** \brief * Creator class used in the OEMSolverMap. */ class Creator : public OEMSolverCreator { public: MEMORY_MANAGED(Creator); virtual ~Creator() {}; /** \brief * Returns a new UmfPackSolver object. */ OEMSolver* create() { return NEW UmfPackSolver(this->name); }; }; /** \brief * constructor */ UmfPackSolver(std::string name); /** \brief * destructor */ ~UmfPackSolver(); protected: /** \brief * Implements OEMSolver::init(). */ void init() { p = this->vectorCreator->create(); r = this->vectorCreator->create(); } /** \brief * Implements OEMSolver::exit(). */ void exit() { this->vectorCreator->free(p); this->vectorCreator->free(r); } /** \brief * Implements OEMSolver::solve(). */ int solveSystem(MatVecMultiplier *mv, VectorType *x, VectorType *b, bool reuseMatrix); private: /** \brief * These vectors are justed to calculate the final residual of the solution. */ VectorType *r, *p; /** \brief * Stores the result of umfpack_di_symbolic (the symbolic analysis which is needed * for the numeric factorization). */ void *symbolic_; /** \brief * Stores the result of umfpack_di_numeric, if multiple right hand sides will occure. */ void *numeric; /** \brief * If the symbolic analysis should be done only once (for example, if the matrices * to solve have all the same pattern because of no adaptivity), this variable * is one, otherwise 0 and the symbolic analysis will be performed at every call * of solveSystem(). */ int storeSymbolic_; /** \brief * If not zero, Umfpack is prepared to solve multiple following systems with equal * system matrix but different right hand side vectors. */ int multipleRhs; }; } #include "UmfPackSolver.hh" #endif // HAVE_UMFPACK #endif // AMDIS_UMFPACKSOLVER_H