Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90983385
sparse_solver.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 6, 15:49
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Nov 8, 15:49 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22170343
Attached To
rSPECMICP SpecMiCP / ReactMiCP
sparse_solver.hpp
View Options
#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
Log In to Comment