Page MenuHomec4science

sparse_solver.hpp
No OneTemporary

File Metadata

Created
Wed, Nov 6, 15:49

sparse_solver.hpp

#ifndef SPECMICP_SPARSESOLVERS_SPARSESOLVERS_HPP
#define SPECMICP_SPARSESOLVERS_SPARSESOLVERS_HPP
#include <memory>
#include "sparse_qr.hpp"
#include "sparse_lu.hpp"
#include "sparse_bicgstab.hpp"
#ifdef EIGEN_UNSUPPORTED_FOUND
#include "sparse_gmres.hpp"
#endif
namespace specmicp {
namespace sparse_solvers {
template <class MatrixT, class DerivedR, class DerivedS>
using SparseSolverPtr = std::unique_ptr<SparseSolverBase<MatrixT, DerivedR, DerivedS>>;
template <class MatrixT, class DerivedR, class DerivedS>
SparseSolverPtr<MatrixT, DerivedR, DerivedS> get_sparse_solver(SparseSolver solver_type)
{
SparseSolverPtr<MatrixT, DerivedR, DerivedS> sparse_solver;
switch (solver_type) {
case SparseSolver::SparseQR:
sparse_solver = SparseSolverPtr<MatrixT, DerivedR, DerivedS>(
new SparseSolverQR<MatrixT, DerivedR, DerivedS>);
break;
#ifdef EIGEN_UNSUPPORTED_FOUND
case SparseSolver::GMRES:
sparse_solver = SparseSolverPtr<MatrixT, DerivedR, DerivedS>(
new SparseSolverGMRES<MatrixT, DerivedR, DerivedS>);
break;
#endif
case SparseSolver::SparseLU:
sparse_solver = SparseSolverPtr<MatrixT, DerivedR, DerivedS>(
new SparseSolverLU<MatrixT, DerivedR, DerivedS>);
break;
case SparseSolver::BiCGSTAB:
sparse_solver = SparseSolverPtr<MatrixT, DerivedR, DerivedS>(
new SparseSolverBiCGSTAB<MatrixT, DerivedR, DerivedS>);
break;
}
return sparse_solver;
}
} // end namespace sparse_solvers
} // end namespace specmicp
#endif //SPECMICP_SPARSESOLVERS_SPARSESOLVERS_HPP

Event Timeline