@@ -54,6 +54,15 @@ class CPreconditioner;
5454 * Absolute tolerance, target residual is tol*||b||. ---*/
5555enum class LinearToleranceType { RELATIVE, ABSOLUTE };
5656
57+ /* !
58+ * \brief Modes of using FGCRODR.
59+ * \ingroup SpLinSys
60+ */
61+ enum class FgcrodrMode {
62+ NORMAL, /* !< \brief Solve the linear system. */
63+ SAME_MAT, /* !< \brief "NORMAL" but knowing the matrix did not change. */
64+ };
65+
5766/* !
5867 * \class CSysSolve
5968 * \ingroup SpLinSys
@@ -99,8 +108,8 @@ class CSysSolve {
99108 mutable VectorType v; /* !< \brief BCGSTAB "v" vector (v = A * M^-1 * p). */
100109
101110 mutable unsigned long k = 0 ;
102- mutable std::vector<VectorType> W , V; /* !< \brief Large matrix used by FGMRES, w ^i+1 = A * z^i. */
103- mutable std::vector<VectorType> Z , T; /* !< \brief Large matrix used by FGMRES, preconditioned W . */
111+ mutable std::vector<VectorType> Z , V; /* !< \brief Large matrices used by FGMRES, v ^i+1 = A * z^i. */
112+ mutable std::vector<VectorType> W , T; /* !< \brief Large matrices used by FGCRODR for deflation vectors . */
104113
105114 /* !< \brief Temporary used when it is necessary to interface between active and passive types. */
106115 VectorType LinSysSol_tmp;
@@ -283,7 +292,8 @@ class CSysSolve {
283292 template <class Dummy = int >
284293 unsigned long FGCRODR_LinSolverImpl (const VectorType& b, VectorType& x, const ProductType& mat_vec,
285294 const PrecondType& precond, ScalarType tol, unsigned long max_iter,
286- ScalarType& residual, bool monitoring, const CConfig* config) const ;
295+ ScalarType& residual, bool monitoring, const CConfig* config,
296+ FgcrodrMode mode) const ;
287297
288298 public:
289299 /* !
@@ -341,10 +351,12 @@ class CSysSolve {
341351 * \param[out] residual - final normalized residual
342352 * \param[in] monitoring - turn on priting residuals from solver to screen.
343353 * \param[in] config - Definition of the particular problem.
354+ * \param[in] mode - See FgcrodrMode.
344355 */
345356 unsigned long FGCRODR_LinSolver (const VectorType& b, VectorType& x, const ProductType& mat_vec,
346357 const PrecondType& precond, ScalarType tol, unsigned long max_iter,
347- ScalarType& residual, bool monitoring, const CConfig* config) const ;
358+ ScalarType& residual, bool monitoring, const CConfig* config,
359+ FgcrodrMode mode = FgcrodrMode::NORMAL) const ;
348360
349361 /* !
350362 * \brief Biconjugate Gradient Stabilized Method (BCGSTAB)
@@ -436,5 +448,5 @@ class CSysSolve {
436448 /* !
437449 * \brief Discard FGCRODR's deflation vectors for the next solve.
438450 */
439- inline void ResetDeflation () { k = 0 ; }
451+ inline void ResetDeflation () const { k = 0 ; }
440452};
0 commit comments