19 template<
typename T>
class gsEigenCGIdentity;
20 template<
typename T>
class gsEigenCGDiagonal;
21 template<
typename T>
class gsEigenBiCGSTABIdentity;
22 template<
typename T>
class gsEigenBiCGSTABDiagonal;
23 template<
typename T>
class gsEigenBiCGSTABILUT;
24 template<
typename T>
class gsEigenSparseLU;
25 template<
typename T>
class gsEigenSparseQR;
26 template<
typename T>
class gsEigenSimplicialLDLT;
27 template<
typename T>
class gsEigenSimplicialDLT;
29 template<
typename T>
class gsEigenSuperLU;
30 template<
typename T>
class gsEigenPardisoLDLT;
31 template<
typename T>
class gsEigenPardisoLLT;
32 template<
typename T>
class gsEigenPardisoLU;
34 template<
typename T>
class gsEigenMINRES;
35 template<
typename T>
class gsEigenGMRES;
36 template<
typename T>
class gsEigenDGMRES;
65 template <
typename T = real_t>
69 typedef memory::unique_ptr<gsSparseSolver> uPtr;
71 typedef gsEigenCGIdentity<T> CGIdentity ;
72 typedef gsEigenCGDiagonal<T> CGDiagonal;
73 typedef gsEigenBiCGSTABDiagonal<T> BiCGSTABDiagonal;
74 typedef gsEigenBiCGSTABIdentity<T> BiCGSTABIdentity;
75 typedef gsEigenBiCGSTABILUT<T> BiCGSTABILUT;
76 typedef gsEigenSparseLU<T> LU;
77 typedef gsEigenSparseQR<T> QR;
78 typedef gsEigenSimplicialLDLT<T> SimplicialLDLT;
79 typedef gsEigenSimplicialLDLT<T> SimplicialLLT;
82 typedef gsEigenSuperLU<T> SuperLU;
83 typedef gsEigenPardisoLDLT<T> PardisoLDLT;
84 typedef gsEigenPardisoLLT<T> PardisoLLT;
85 typedef gsEigenPardisoLU<T> PardisoLU;
87 typedef gsEigenMINRES<T> MINRES;
88 typedef gsEigenGMRES<T> GMRES;
89 typedef gsEigenDGMRES<T> DGMRES;
102 virtual bool succeed ()
const = 0;
104 virtual int info()
const = 0;
107 virtual std::ostream &
print(std::ostream &os)
const
109 os <<
"gsSparseSolver\n";
116 std::ostringstream os;
121 static uPtr
get(
const std::string & slv)
123 if (slv==
"CGDiagonal")
return uPtr(
new CGDiagonal());
124 if (slv==
"SimplicialLDLT")
return uPtr(
new SimplicialLDLT());
125 if (slv==
"SimplicialLLT")
return uPtr(
new SimplicialLLT());
126 # ifdef GISMO_WITH_PARDISO
127 if (slv==
"PardisoLU")
return uPtr(
new PardisoLU());
128 if (slv==
"PardisoLDLT")
return uPtr(
new PardisoLDLT());
129 if (slv==
"PardisoLLT")
return uPtr(
new PardisoLLT());
131 # ifdef GISMO_WITH_SUPERLU
132 if (slv==
"SuperLU")
return uPtr(
new SuperLU());
134 if (slv==
"BiCGSTABILUT")
return uPtr(
new BiCGSTABILUT());
135 if (slv==
"BiCGSTABDiagonal")
return uPtr(
new BiCGSTABDiagonal());
136 if (slv==
"QR")
return uPtr(
new QR());
137 if (slv==
"LU")
return uPtr(
new LU());
138 if (slv==
"CGIdentity")
return uPtr(
new CGIdentity());
139 if (slv==
"BiCGSTABIdentity")
return uPtr(
new BiCGSTABIdentity());
143 GISMO_ERROR(
"Solver \'"<< slv <<
"\' not known to G+Smo");
149 std::ostream &operator<<(std::ostream &os, const gsSparseSolver<T>& b)
150 {
return b.print(os); }
152 #define GISMO_EIGEN_SPARSE_SOLVER(gsname, eigenName) \
153 template<typename T> \
154 class gsname : public gsSparseSolver<T>, public gsEigenAdaptor<T>::eigenName \
156 typedef typename gsSparseSolver<T>::MatrixT MatrixT; \
157 typedef typename gsSparseSolver<T>::VectorT VectorT; \
163 : m_rows(0),m_cols(0) \
165 gsname(const MatrixT &matrix) \
166 : gsEigenAdaptor<T>::eigenName(matrix), m_rows(matrix.rows()),m_cols(matrix.cols()) \
168 gsname& compute (const MatrixT &matrix) \
170 m_rows=matrix.rows(); \
171 m_cols=matrix.cols(); \
172 gsEigenAdaptor<T>::eigenName::compute(matrix); \
175 VectorT solve (const VectorT &rhs) const \
177 return gsEigenAdaptor<T>::eigenName::solve(rhs); \
179 bool succeed() const \
180 { return gsEigenAdaptor<T>::eigenName::info()==gsEigen::Success;} \
182 { return gsEigenAdaptor<T>::eigenName::info();} \
183 index_t rows() const {return m_rows;} \
184 index_t cols() const {return m_cols;} \
185 std::ostream &print(std::ostream &os) const \
187 os <<STRINGIFY(eigenName); \
192 GISMO_EIGEN_SPARSE_SOLVER (gsEigenCGIdentity, CGIdentity)
193 GISMO_EIGEN_SPARSE_SOLVER (gsEigenCGDiagonal, CGDiagonal)
194 GISMO_EIGEN_SPARSE_SOLVER (gsEigenBiCGSTABIdentity, BiCGSTABIdentity)
195 GISMO_EIGEN_SPARSE_SOLVER (gsEigenBiCGSTABDiagonal, BiCGSTABDiagonal)
196 GISMO_EIGEN_SPARSE_SOLVER (gsEigenBiCGSTABILUT, BiCGSTABILUT)
197 GISMO_EIGEN_SPARSE_SOLVER (gsEigenSparseLU, SparseLU)
198 GISMO_EIGEN_SPARSE_SOLVER (gsEigenSparseQR, SparseQR)
199 GISMO_EIGEN_SPARSE_SOLVER (gsEigenSimplicialLDLT, SimplicialLDLT)
200 GISMO_EIGEN_SPARSE_SOLVER (gsEigenSimplicialLLT, SimplicialLLT)
202 #ifdef GISMO_WITH_SUPERLU
203 GISMO_EIGEN_SPARSE_SOLVER (gsEigenSuperLU, SuperLU)
206 #ifdef GISMO_WITH_PARDISO
207 GISMO_EIGEN_SPARSE_SOLVER (gsEigenPardisoLDLT, PardisoLDLT)
208 GISMO_EIGEN_SPARSE_SOLVER (gsEigenPardisoLLT, PardisoLLT)
209 GISMO_EIGEN_SPARSE_SOLVER (gsEigenPardisoLU, PardisoLU)
217 #undef GISMO_EIGEN_SPARSE_SOLVER
virtual std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsSparseSolver.h:107
virtual std::string detail() const
Prints the object as a string with extended details.
Definition: gsSparseSolver.h:114
Abstract class for solvers. The solver interface is base on 3 methods: -compute set the system matrix...
Definition: gsSparseSolver.h:66
#define GISMO_ERROR(message)
Definition: gsDebug.h:118