/[escript]/trunk/escriptcore/src/SolverOptions.h
ViewVC logotype

Diff of /trunk/escriptcore/src/SolverOptions.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5147 by sshaw, Tue Apr 1 05:46:07 2014 UTC revision 5148 by caltinay, Mon Sep 15 01:25:23 2014 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
17  #ifndef SOLVER_OPTIONS_H  #ifndef __ESCRIPT_SOLVEROPTIONS_H__
18  #define SOLVER_OPTIONS_H  #define __ESCRIPT_SOLVEROPTIONS_H__
19    
20  #include <boost/python/object.hpp>  #include <boost/python/object.hpp>
21  #include "system_dep.h"  #include "system_dep.h"
22    
23  namespace escript {  namespace escript {
24    
25  /**  /**
26  This enum defines the solver options for a linear or non-linear solver.  This enum defines the options for solving linear/non-linear systems with escript.
   
 ESCRIPT_DEFAULT: The default method used to solve the system of linear equations  
 ESCRIPT_DIRECT: The direct solver based on LDU factorization  
 ESCRIPT_CHOLEVSKY: The direct solver based on LDLT factorization (can only be applied for symmetric PDEs)  
 ESCRIPT_PCG: The preconditioned conjugate gradient method (can only be applied for symmetric PDEs)  
 ESCRIPT_CR: The conjugate residual method  
 ESCRIPT_CGS: The conjugate gradient square method  
 ESCRIPT_BICGSTAB: The stabilized Bi-Conjugate Gradient method  
 ESCRIPT_TFQMR: Transpose Free Quasi Minimal Residual method  
 ESCRIPT_MINRES: Minimum residual method  
 ESCRIPT_ILU0: The incomplete LU factorization preconditioner with no fill-in  
 ESCRIPT_ILUT: The incomplete LU factorization preconditioner with fill-in  
 ESCRIPT_JACOBI: The Jacobi preconditioner  
 ESCRIPT_GMRES: The Gram-Schmidt minimum residual method  
 ESCRIPT_PRES20: Special ESCRIPT_GMRES with restart after 20 steps and truncation after 5 residuals  
 ESCRIPT_ROWSUM_LUMPING: Matrix lumping using row sum  
 ESCRIPT_HRZ_LUMPING: Matrix lumping using the HRZ approach  
 ESCRIPT_NO_REORDERING: No matrix reordering allowed  
 ESCRIPT_MINIMUM_FILL_IN: Reorder matrix to reduce fill-in during factorization  
 ESCRIPT_NESTED_DISSECTION: Reorder matrix to improve load balancing during factorization  
 ESCRIPT_PASO: PASO solver package  
 ESCRIPT_SCSL: SGI SCSL solver library  
 ESCRIPT_MKL: Intel's MKL solver library  
 ESCRIPT_UMFPACK: The UMFPACK library  
 ESCRIPT_TRILINOS: The TRILINOS parallel solver class library from Sandia National Labs  
 ESCRIPT_ITERATIVE: The default iterative solver  
 ESCRIPT_AMG: Algebraic Multi Grid  
 ESCRIPT_AMLI: Algebraic Multi Level Iteration  
 ESCRIPT_REC_ILU: recursive ESCRIPT_ILU0  
 ESCRIPT_RILU: relaxed ESCRIPT_ILU0  
 ESCRIPT_GAUSS_SEIDEL: Gauss-Seidel preconditioner  
 ESCRIPT_DEFAULT_REORDERING: the reordering method recommended by the solver  
 ESCRIPT_SUPER_LU: the Super_LU solver package  
 ESCRIPT_PASTIX: the Pastix direct solver_package  
 ESCRIPT_YAIR_SHAPIRA_COARSENING: ESCRIPT_AMG and ESCRIPT_AMLI coarsening method by Yair-Shapira  
 ESCRIPT_RUGE_STUEBEN_COARSENING: ESCRIPT_AMG and ESCRIPT_AMLI coarsening method by Ruge and Stueben  
 ESCRIPT_AGGREGATION_COARSENING: ESCRIPT_AMG and ESCRIPT_AMLI coarsening using (symmetric) aggregation  
 ESCRIPT_STANDARD_COARSENING: ESCRIPT_AMG and ESCRIPT_AMLI standard coarsening using measure of importance of the unknowns  
 ESCRIPT_MIN_COARSE_MATRIX_SIZE: minimum size of the coarsest level matrix to use direct solver.  
 ESCRIPT_NO_PRECONDITIONER: no preconditioner is applied.  
 ESCRIPT_CLASSIC_INTERPOLATION_WITH_FF_COUPLING: classical interpolation in AMG with enforced  
 ESCRIPT_CLASSIC_INTERPOLATION: classical interpolation in AMG  
 ESCRIPT_DIRECT_INTERPOLATION: direct interploation in AMG  
 ESCRIPT_BOOMERAMG: Boomer AMG in hypre library  
 ESCRIPT_CIJP_FIXED_RANDOM_COARSENING: BoomerAMG parallel coarsening method CIJP by using fixed random vector  
 ESCRIPT_CIJP_COARSENING: BoomerAMG parallel coarsening method CIJP  
 ESCRIPT_PAESCRIPT_FALGOUT_COARSENING: BoomerAMG parallel coarsening method falgout  
 ESCRIPT_PMIS_COARSENING: BoomerAMG parallel coarsening method PMIS  
 ESCRIPT_HMIS_COARSENING: BoomerAMG parallel coarsening method HMIS  
 ESCRIPT_BACKWARD_EULER: backward Euler scheme  
 ESCRIPT_CRANK_NICOLSON: Crank-Nicolson scheme  
 ESCRIPT_LINEAR_CRANK_NICOLSON: linerized Crank-Nicolson scheme  
27    
28    SO_DEFAULT: use escript defaults for specific option
29    SO_TARGET_CPU: use CPUs to solve system
30    SO_TARGET_GPU: use GPUs to solve system
31    
32    SO_PACKAGE_CUSP: CUDA sparse linear algebra package
33    SO_PACKAGE_MKL: Intel's MKL solver library
34    SO_PACKAGE_PASO: PASO solver package
35    SO_PACKAGE_PASTIX: the Pastix direct solver_package
36    SO_PACKAGE_SUPER_LU: the Super_LU solver package
37    SO_PACKAGE_TRILINOS: The TRILINOS parallel solver class library from Sandia National Labs
38    SO_PACKAGE_UMFPACK: The UMFPACK library
39    
40    SO_METHOD_BICGSTAB: The stabilized Bi-Conjugate Gradient method
41    SO_METHOD_CHOLEVSKY: The direct solver based on LDLT factorization (can only be applied for symmetric PDEs)
42    SO_METHOD_CGS: The conjugate gradient square method
43    SO_METHOD_CR: The conjugate residual method
44    SO_METHOD_DIRECT: The direct solver based on LDU factorization
45    SO_METHOD_GMRES: The Gram-Schmidt minimum residual method
46    SO_METHOD_HRZ_LUMPING: Matrix lumping using the HRZ approach
47    SO_METHOD_ITERATIVE: The default iterative solver
48    SO_METHOD_LSQR: Least squares with QR factorization
49    SO_METHOD_MINRES: Minimum residual method
50    SO_METHOD_PCG: The preconditioned conjugate gradient method (can only be applied for symmetric PDEs)
51    SO_METHOD_PRES20: Special GMRES with restart after 20 steps and truncation after 5 residuals
52    SO_METHOD_ROWSUM_LUMPING: Matrix lumping using row sum
53    SO_METHOD_TFQMR: Transpose Free Quasi Minimal Residual method
54    
55    SO_PRECONDITIONER_AMG: Algebraic Multi Grid
56    SO_PRECONDITIONER_AMLI: Algebraic Multi Level Iteration
57    SO_PRECONDITIONER_BOOMERAMG: Boomer AMG (from the hypre library)
58    SO_PRECONDITIONER_GAUSS_SEIDEL: Gauss-Seidel preconditioner
59    SO_PRECONDITIONER_ILU0: The incomplete LU factorization preconditioner with no fill-in
60    SO_PRECONDITIONER_ILUT: The incomplete LU factorization preconditioner with fill-in
61    SO_PRECONDITIONER_JACOBI: The Jacobi preconditioner
62    SO_PRECONDITIONER_NONE: no preconditioner is applied
63    SO_PRECONDITIONER_REC_ILU: recursive ILU0
64    SO_PRECONDITIONER_RILU: relaxed ILU0
65    
66    SO_ODESOLVER_BACKWARD_EULER: backward Euler scheme
67    SO_ODESOLVER_CRANK_NICOLSON: Crank-Nicolson scheme
68    SO_ODESOLVER_LINEAR_CRANK_NICOLSON: linerized Crank-Nicolson scheme
69    
70    SO_INTERPOLATION_CLASSIC: classical interpolation in AMG
71    SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING: classical interpolation in AMG with enforced
72    SO_INTERPOLATION_DIRECT: direct interpolation in AMG
73    
74    SO_COARSENING_AGGREGATION: AMG and AMLI coarsening using (symmetric) aggregation
75    SO_COARSENING_CIJP: BoomerAMG parallel coarsening method CIJP
76    SO_COARSENING_CIJP_FIXED_RANDOM: BoomerAMG parallel coarsening method CIJP by using fixed random vector
77    SO_COARSENING_FALGOUT: BoomerAMG parallel coarsening method falgout
78    SO_COARSENING_HMIS: BoomerAMG parallel coarsening method HMIS
79    SO_COARSENING_PMIS: BoomerAMG parallel coarsening method PMIS
80    SO_COARSENING_RUGE_STUEBEN: AMG and AMLI coarsening method by Ruge and Stueben
81    SO_COARSENING_STANDARD: AMG and AMLI standard coarsening using measure of importance of the unknowns
82    SO_COARSENING_YAIR_SHAPIRA: AMG and AMLI coarsening method by Yair-Shapira
83    
84    SO_REORDERING_DEFAULT: the reordering method recommended by the solver
85    SO_REORDERING_MINIMUM_FILL_IN: Reorder matrix to reduce fill-in during factorization
86    SO_REORDERING_NESTED_DISSECTION: Reorder matrix to improve load balancing during factorization
87    SO_REORDERING_NONE: No matrix reordering allowed
88  */  */
89  enum SolverOptions {  enum SolverOptions
90      ESCRIPT_DEFAULT,  {
91      ESCRIPT_DIRECT = 1,      SO_DEFAULT,
92      ESCRIPT_CHOLEVSKY = 2,  
93      ESCRIPT_PCG = 3,      // Solver targets
94      ESCRIPT_CR = 4,      SO_TARGET_CPU,
95      ESCRIPT_CGS = 5,      SO_TARGET_GPU,
96      ESCRIPT_BICGSTAB = 6,  
97      ESCRIPT_ILU0 = 8,      // Solver packages
98      ESCRIPT_ILUT = 9,      SO_PACKAGE_CUSP,
99      ESCRIPT_JACOBI = 10,      SO_PACKAGE_MKL,
100      ESCRIPT_GMRES = 11,      SO_PACKAGE_PASO,
101      ESCRIPT_PRES20 = 12,      SO_PACKAGE_PASTIX,
102      ESCRIPT_LUMPING = 13,      SO_PACKAGE_SUPER_LU,
103      ESCRIPT_ROWSUM_LUMPING = 13,      SO_PACKAGE_TRILINOS,
104      ESCRIPT_HRZ_LUMPING = 14,      SO_PACKAGE_UMFPACK,
105      ESCRIPT_NO_REORDERING = 17,  
106      ESCRIPT_MINIMUM_FILL_IN = 18,      // Solver methods
107      ESCRIPT_NESTED_DISSECTION = 19,      SO_METHOD_BICGSTAB,
108      ESCRIPT_MKL = 15,      SO_METHOD_CGLS,
109      ESCRIPT_UMFPACK = 16,      SO_METHOD_CGS,
110      ESCRIPT_ITERATIVE = 20,      SO_METHOD_CHOLEVSKY,
111      ESCRIPT_PASO = 21,      SO_METHOD_CR,
112      ESCRIPT_AMG = 22,      SO_METHOD_DIRECT,
113      ESCRIPT_REC_ILU = 23,      SO_METHOD_GMRES,
114      ESCRIPT_TRILINOS = 24,      SO_METHOD_HRZ_LUMPING,
115      ESCRIPT_NONLINEAR_GMRES = 25,      SO_METHOD_ITERATIVE,
116      ESCRIPT_TFQMR = 26,      SO_METHOD_LSQR,
117      ESCRIPT_MINRES = 27,      SO_METHOD_MINRES,
118      ESCRIPT_GAUSS_SEIDEL = 28,      SO_METHOD_NONLINEAR_GMRES,
119      ESCRIPT_RILU = 29,      SO_METHOD_PCG,
120      ESCRIPT_DEFAULT_REORDERING = 30,      SO_METHOD_PRES20,
121      ESCRIPT_SUPER_LU = 31,      SO_METHOD_ROWSUM_LUMPING,
122      ESCRIPT_PASTIX = 32,      SO_METHOD_TFQMR,
123      ESCRIPT_YAIR_SHAPIRA_COARSENING = 33,  
124      ESCRIPT_RUGE_STUEBEN_COARSENING = 34,      // Preconditioners
125      ESCRIPT_AGGREGATION_COARSENING = 35,      SO_PRECONDITIONER_AMG,
126      ESCRIPT_NO_PRECONDITIONER = 36,      SO_PRECONDITIONER_AMLI,
127      ESCRIPT_MIN_COARSE_MATRIX_SIZE = 37,      SO_PRECONDITIONER_BOOMERAMG,
128      ESCRIPT_AMLI = 38,      SO_PRECONDITIONER_GAUSS_SEIDEL,
129      ESCRIPT_STANDARD_COARSENING = 39,      SO_PRECONDITIONER_ILU0,
130      ESCRIPT_CLASSIC_INTERPOLATION_WITH_FF_COUPLING = 50,      SO_PRECONDITIONER_ILUT,
131      ESCRIPT_CLASSIC_INTERPOLATION = 51,      SO_PRECONDITIONER_JACOBI,
132      ESCRIPT_DIRECT_INTERPOLATION = 52,      SO_PRECONDITIONER_NONE,
133      ESCRIPT_BOOMERAMG = 60,      SO_PRECONDITIONER_REC_ILU,
134      ESCRIPT_CIJP_FIXED_RANDOM_COARSENING = 61,      SO_PRECONDITIONER_RILU,
135      ESCRIPT_CIJP_COARSENING = 62,  
136      ESCRIPT_FALGOUT_COARSENING = 63,      // ODE solvers
137      ESCRIPT_PMIS_COARSENING = 64,      SO_ODESOLVER_BACKWARD_EULER,
138      ESCRIPT_HMIS_COARSENING = 65,      SO_ODESOLVER_CRANK_NICOLSON,
139      ESCRIPT_LINEAR_CRANK_NICOLSON = 66,      SO_ODESOLVER_LINEAR_CRANK_NICOLSON,
140      ESCRIPT_CRANK_NICOLSON = 67,  
141      ESCRIPT_BACKWARD_EULER = 68      // Interpolation methods
142        SO_INTERPOLATION_CLASSIC,
143        SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING,
144        SO_INTERPOLATION_DIRECT,
145    
146        // Coarsening methods
147        SO_COARSENING_AGGREGATION,
148        SO_COARSENING_CIJP,
149        SO_COARSENING_CIJP_FIXED_RANDOM,
150        SO_COARSENING_FALGOUT,
151        SO_COARSENING_HMIS,
152        SO_COARSENING_PMIS,
153        SO_COARSENING_RUGE_STUEBEN,
154        SO_COARSENING_STANDARD,
155        SO_COARSENING_YAIR_SHAPIRA,
156    
157        SO_REORDERING_DEFAULT,
158        SO_REORDERING_MINIMUM_FILL_IN,
159        SO_REORDERING_NESTED_DISSECTION,
160        SO_REORDERING_NONE
161  };  };
162    
163  class SolverBuddy {  class ESCRIPT_DLL_API SolverBuddy
164    {
165  public:  public:
166      ESCRIPT_DLL_API SolverBuddy();      SolverBuddy();
167    
168      /**      /**
169          Returns a string reporting the current settings          Returns a string reporting the current settings
170      */      */
171      ESCRIPT_DLL_API std::string getSummary() const;      std::string getSummary() const;
172    
173      /**      /**
174          Returns the name of a given key          Returns the name of a given key
175    
176          \param key a valid key from SolverOptions          \param key a valid key from SolverOptions
177      */      */
178      ESCRIPT_DLL_API const char *getName(int key) const;      const char* getName(int key) const;
179    
180      /**      /**
181          Resets the diagnostics          Resets the diagnostics
# Line 153  public: Line 183  public:
183          \param all if ``all`` is ``true`` all diagnostics including accumulative          \param all if ``all`` is ``true`` all diagnostics including accumulative
184                  counters are reset.                  counters are reset.
185      */      */
186      ESCRIPT_DLL_API void resetDiagnostics(bool all=false);      void resetDiagnostics(bool all=false);
187    
188      /**      /**
189          Updates diagnostic information          Updates diagnostic information
# Line 163  public: Line 193  public:
193                   "net_time", "residual_norm", "converged").                   "net_time", "residual_norm", "converged").
194          \param value new value of the diagnostic information          \param value new value of the diagnostic information
195      */      */
196      ESCRIPT_DLL_API void updateDiagnostics(std::string key, boost::python::object value);      void updateDiagnostics(const std::string key,
197                               const boost::python::object& value);
198    
199      /**      /**
200      Returns the diagnostic information for the given ``name``. Possible values are:          Returns the diagnostic information for the given ``name``.
201            Possible values are:
     - "num_iter": the number of iteration steps  
     - "cum_num_iter": the cumulative number of iteration steps  
     - "num_level": the number of level in multi level solver  
     - "num_inner_iter": the number of inner iteration steps  
     - "cum_num_inner_iter": the cumulative number of inner iteration steps  
     - "time": execution time  
     - "cum_time": cumulative execution time  
     - "set_up_time": time to set up of the solver, typically this includes factorization and reordering  
     - "cum_set_up_time": cumulative time to set up of the solver  
     - "net_time": net execution time, excluding setup time for the solver and execution time for preconditioner  
     - "cum_net_time": cumulative net execution time  
     - "preconditioner_size": size of preconditioner [Bytes]  
     - "converged": return true if solution has converged.  
     - "time_step_backtracking_used": returns true if time step back tracking has been used.  
     - "coarse_level_sparsity": returns the sparsity of the matrix on the coarsest level  
     - "num_coarse_unknowns": returns the number of unknowns on the coarsest level  
202    
203            - "num_iter": the number of iteration steps
204            - "cum_num_iter": the cumulative number of iteration steps
205            - "num_level": the number of level in multi level solver
206            - "num_inner_iter": the number of inner iteration steps
207            - "cum_num_inner_iter": the cumulative number of inner iteration steps
208            - "time": execution time
209            - "cum_time": cumulative execution time
210            - "set_up_time": time to set up the solver, typically this includes factorization and reordering
211            - "cum_set_up_time": cumulative time to set up the solver
212            - "net_time": net execution time, excluding setup time for the solver and execution time for preconditioner
213            - "cum_net_time": cumulative net execution time
214            - "preconditioner_size": size of preconditioner [Bytes]
215            - "converged": true if solution has converged
216            - "time_step_backtracking_used": true if time step back tracking has been used
217            - "coarse_level_sparsity": sparsity of the matrix on the coarsest level
218            - "num_coarse_unknowns": number of unknowns on the coarsest level
219    
220            \param name name of diagnostic information to return
221    
222            \return requested value or 0 if the value is yet to be defined.
223    
224      \param name name of diagnostic information to return          \note If the solver has thrown an exception diagnostic values have an
225                      undefined status.
     \returns requested value. 0 is returned if the value is yet to be defined.  
   
     \note If the solver has thrown an exception diagnostic values have an undefined status.  
226      */      */
227      ESCRIPT_DLL_API double getDiagnostics(std::string name) const;      double getDiagnostics(const std::string name) const;
228    
229      /**      /**
230          Returns ``true`` if the last solver call has been finalized successfully.          Returns ``true`` if the last solver call has been finalized
231            successfully.
232    
233          \note if an exception has been thrown by the solver the status of this          \note if an exception has been thrown by the solver the status of this
234                   flag is undefined.                   flag is undefined.
235      */      */
236      ESCRIPT_DLL_API bool hasConverged() const;      bool hasConverged() const;
237    
238      /**      /**
239      Sets the key of the coarsening method to be applied in AMG or AMLI or BoomerAMG          Sets the key of the coarsening method to be applied in AMG, AMLI
240            or BoomerAMG.
241    
242      \param coarsening selects the coarsening method, should be in          \param coarsening the coarsening method, one of
243              `ESCRIPT_DEFAULT`, `ESCRIPT_YAIR_SHAPIRA_COARSENING`,              `SO_DEFAULT`, `SO_COARSENING_YAIR_SHAPIRA`,
244              `ESCRIPT_RUGE_STUEBEN_COARSENING`, `ESCRIPT_AGGREGATION_COARSENING`,              `SO_COARSENING_RUGE_STUEBEN`, `SO_COARSENING_AGGREGATION`,
245              `ESCRIPT_CIJP_FIXED_RANDOM_COARSENING`, `ESCRIPT_CIJP_COARSENING`,              `SO_COARSENING_CIJP_FIXED_RANDOM`, `SO_COARSENING_CIJP`,
246              `ESCRIPT_FALGOUT_COARSENING`, `ESCRIPT_PMIS_COARSENING`,              `SO_COARSENING_FALGOUT`, `SO_COARSENING_PMIS`,
247              `ESCRIPT_HMIS_COARSENING`              `SO_COARSENING_HMIS`
248      */      */
249      ESCRIPT_DLL_API void setCoarsening(int coarsening);      void setCoarsening(int coarsening);
250    
251      /**      /**
252          Returns the key of the coarsening algorithm to be applied AMG, AMLI          Returns the key of the coarsening algorithm to be applied for AMG, AMLI
253          or BoomerAMG          or BoomerAMG
   
254      */      */
255      ESCRIPT_DLL_API SolverOptions getCoarsening() const;      SolverOptions getCoarsening() const;
256    
257      /**      /**
258          Sets the minimum size of the coarsest level matrix in AMG or AMLI          Sets the minimum size of the coarsest level matrix in AMG or AMLI
259    
260          \param size minimum size of the coarsest level matrix .          \param size minimum size of the coarsest level matrix .
261      */      */
262      ESCRIPT_DLL_API void setMinCoarseMatrixSize(int size);      void setMinCoarseMatrixSize(int size);
263    
264      /**      /**
265          Returns the minimum size of the coarsest level matrix in AMG or AMLI          Returns the minimum size of the coarsest level matrix in AMG or AMLI
266      */      */
267      ESCRIPT_DLL_API int getMinCoarseMatrixSize() const;      int getMinCoarseMatrixSize() const;
268    
269      /**      /**
270      Sets the preconditioner to be used.          Sets the preconditioner to be used.
271    
272      \param preconditioner key of the preconditioner to be used, should be in          \param preconditioner key of the preconditioner to be used, one of
273          `ESCRIPT_ILU0`, `ESCRIPT_ILUT`,              `SO_PRECONDITIONER_ILU0`, `SO_PRECONDITIONER_ILUT`,
274          `ESCRIPT_JACOBI`, `ESCRIPT_AMG`, `ESCRIPT_AMLI`,              `SO_PRECONDITIONER_JACOBI`, `SO_PRECONDITIONER_AMG`,
275          `ESCRIPT_REC_ILU`, `ESCRIPT_GAUSS_SEIDEL`,              `SO_PRECONDITIONER_AMLI`, `SO_PRECONDITIONER_REC_ILU`,
276          `ESCRIPT_RILU`, `ESCRIPT_BOOMERAMG`,              `SO_PRECONDITIONER_GAUSS_SEIDEL`, `SO_PRECONDITIONER_RILU`,
277          `ESCRIPT_NO_PRECONDITIONER`              `SO_PRECONDITIONER_BOOMERAMG`, `SO_PRECONDITIONER_NONE`
278        
279      \note Not all packages support all preconditioner. It can be assumed that          \note Not all packages support all preconditioners. It can be assumed
280              a package makes a reasonable choice if it encounters an unknown                that a package makes a reasonable choice if it encounters an
281              preconditioner.                unknown preconditioner.
282      */      */
283      ESCRIPT_DLL_API void setPreconditioner(int preconditioner);      void setPreconditioner(int preconditioner);
284    
285      /**      /**
286      Returns the key of the preconditioner to be used.          Returns the key of the preconditioner to be used.
   
287      */      */
288      ESCRIPT_DLL_API SolverOptions getPreconditioner() const;      SolverOptions getPreconditioner() const;
289    
290      /**      /**
291      Sets the smoother to be used.          Sets the smoother to be used.
292    
293      \param smoother key of the smoother to be used, should be in          \param smoother key of the smoother to be used, should be in
294              `ESCRIPT_JACOBI`, `ESCRIPT_GAUSS_SEIDEL`                 `SO_PRECONDITIONER_JACOBI`, `SO_PRECONDITIONER_GAUSS_SEIDEL`
295    
296      \note Not all packages support all smoothers. It can be assumed that a          \note Not all packages support all smoothers. It can be assumed that a
297              package makes a reasonable choice if it encounters an unknown                package makes a reasonable choice if it encounters an unknown
298              smoother.                smoother.
299      */      */
300      ESCRIPT_DLL_API void setSmoother(int smoother);      void setSmoother(int smoother);
301    
302      /**      /**
303      Returns key of the smoother to be used.          Returns the key of the smoother to be used.
   
304      */      */
305      ESCRIPT_DLL_API SolverOptions getSmoother() const;      SolverOptions getSmoother() const;
306    
307      /**      /**
308      Sets the solver method to be used. Use ``method``=``ESCRIPT_DIRECT`` to          Sets the solver method to be used. Use ``method``=``SO_METHOD_DIRECT``
309      indicate that a direct rather than an iterative solver should be used and          to indicate that a direct rather than an iterative solver should be
310      use ``method``=``ESCRIPT_ITERATIVE`` to indicate that an iterative rather          used and use ``method``=``SO_METHOD_ITERATIVE`` to indicate that an
311      than a direct solver should be used.          iterative rather than a direct solver should be used.
312    
313            \param method key of the solver method to be used, should be in
314                `SO_DEFAULT`, `SO_METHOD_DIRECT`, `SO_METHOD_CHOLEVSKY`,
315                `SO_METHOD_PCG`, `SO_METHOD_CR`, `SO_METHOD_CGS`,
316                `SO_METHOD_BICGSTAB`, `SO_METHOD_GMRES`, `SO_METHOD_PRES20`,
317                `SO_METHOD_ROWSUM_LUMPING`, `SO_METHOD_HRZ_LUMPING`,
318                `SO_METHOD_ITERATIVE`, `SO_METHOD_LSQR`,
319                `SO_METHOD_NONLINEAR_GMRES`, `SO_METHOD_TFQMR`, `SO_METHOD_MINRES`
320    
321      \param method key of the solver method to be used, should be in          \note Not all packages support all solvers. It can be assumed that a
322              `ESCRIPT_DEFAULT`, `ESCRIPT_DIRECT`, `ESCRIPT_CHOLEVSKY`,                package makes a reasonable choice if it encounters an unknown
323              `ESCRIPT_PCG`, `ESCRIPT_CR`, `ESCRIPT_CGS`, `ESCRIPT_BICGSTAB`,                solver method.
             `ESCRIPT_GMRES`, `ESCRIPT_PRES20`, `ROWSUM_ESCRIPT_LUMPING`,  
             `HRZ_ESCRIPT_LUMPING`, `ESCRIPT_ITERATIVE`,  
             `ESCRIPT_NONLINEAR_GMRES`, `ESCRIPT_TFQMR`, `ESCRIPT_MINRES`  
       
     \note Not all packages support all solvers. It can be assumed that a  
             package makes a reasonable choice if it encounters an unknown  
             solver method.  
324      */      */
325      ESCRIPT_DLL_API void setSolverMethod(int method);      void setSolverMethod(int method);
326    
327      /**      /**
328      Returns key of the solver method to be used.          Returns key of the solver method to be used.
   
329      */      */
330      ESCRIPT_DLL_API SolverOptions getSolverMethod() const;      SolverOptions getSolverMethod() const;
331    
332      /**      /**
333      Sets the solver package to be used as a solver.          Sets the solver target to be used. By default the solver is run on
334            the host CPU(s). If escript was compiled with GPU support then
335            `SO_TARGET_GPU` is a valid option and the solver will run on GPU(s)
336            if the package supports it.
337    
338      \param package key of the solver package to be used, should be in          \param target key of the solver target. Valid settings:
339              `ESCRIPT_DEFAULT`, `ESCRIPT_PASO`, `ESCRIPT_SUPER_LU`,                 `SO_TARGET_CPU`, `SO_TARGET_GPU`
             `ESCRIPT_PASTIX`, `ESCRIPT_MKL`, `ESCRIPT_UMFPACK`,  
             `ESCRIPT_TRILINOS`  
340    
     \note Not all packages are support on all implementation. An exception may  
             be thrown on some platforms if a particular is requested.  
341      */      */
342      ESCRIPT_DLL_API void setPackage(int package);      void setSolverTarget(int target);
343    
344      /**      /**
345      Returns the solver package key          Returns the key of the solver target.
   
346      */      */
347      ESCRIPT_DLL_API SolverOptions getPackage() const;      SolverOptions getSolverTarget() const;
348    
349      /**      /**
350      Sets the key of the reordering method to be applied if supported by the          Sets the solver package to be used as a solver.
     solver. Some direct solvers support reordering  
     to optimize compute time and storage use during elimination.  
351    
352      \param ordering selects the reordering strategy, should be in          \param package key of the solver package to be used, should be in
353              'ESCRIPT_NO_REORDERING', 'ESCRIPT_MINIMUM_FILL_IN',                 `SO_DEFAULT`, `SO_PACKAGE_CUSP`, `SO_PACKAGE_PASO`,
354              'ESCRIPT_NESTED_DISSECTION', 'ESCRIPT_DEFAULT_REORDERING'                 `SO_PACKAGE_PASTIX`, `SO_PACKAGE_MKL`, `SO_PACKAGE_UMFPACK`,
355                   `SO_PACKAGE_SUPER_LU`, `SO_PACKAGE_TRILINOS`
356    
357            \note Not all packages are supported on all implementation.
358                  An exception may be thrown on some platforms if the selected
359                  package is unsupported.
360      */      */
361      ESCRIPT_DLL_API void setReordering(int ordering);      void setPackage(int package);
362    
363      /**      /**
364      Returns the key of the reordering method to be applied if supported by the          Returns the solver package key
     solver.  
   
365      */      */
366      ESCRIPT_DLL_API SolverOptions getReordering() const;      SolverOptions getPackage() const;
367    
368      /**      /**
369      Sets the number of iterations steps after which GMRES performs a restart.          Sets the key of the reordering method to be applied if supported by the
370            solver. Some direct solvers support reordering
371            to optimize compute time and storage use during elimination.
372    
373      \param restart number of iteration steps after which to perform a          \param ordering selects the reordering strategy, should be in
374          restart. If 0 no restart is performed.                 `SO_REORDERING_NONE`, `SO_REORDERING_MINIMUM_FILL_IN`,
375                   `SO_REORDERING_NESTED_DISSECTION`, 'SO_REORDERING_DEFAULT`
376      */      */
377      ESCRIPT_DLL_API void setRestart(int restart);      void setReordering(int ordering);
378    
379      /**      /**
380      Returns the number of iterations steps after which GMRES performs a          Returns the key of the reordering method to be applied if supported by
381      restart. If 0 is returned no restart is performed.          the solver.
   
382      */      */
383      ESCRIPT_DLL_API int getRestart() const;      SolverOptions getReordering() const;
384    
385      /**      /**
386      Returns the number of iterations steps after which GMRES performs a          Sets the number of iterations steps after which GMRES performs a
387      restart. If -1 is returned no restart is performed.          restart.
388    
389            \param restart number of iteration steps after which to perform a
390                   restart. If 0 no restart is performed.
391      */      */
392      ESCRIPT_DLL_API int _getRestartForC() const;      void setRestart(int restart);
393    
394      /**      /**
395      Sets the threshold for diagonal dominant rows which are eliminated during          Returns the number of iterations steps after which GMRES performs a
396      AMG coarsening.          restart. 0 means no restart is performed.
   
397      */      */
398      ESCRIPT_DLL_API void setDiagonalDominanceThreshold(double threshold);      int getRestart() const;
399    
400      /**      /**
401      Returns the threshold for diagonal dominant rows which are eliminated          Returns the number of iterations steps after which GMRES performs a
402      during AMG coarsening.          restart. If -1 is returned no restart is performed.
   
403      */      */
404      ESCRIPT_DLL_API double getDiagonalDominanceThreshold() const;      int _getRestartForC() const;
405    
406      /**      /**
407      Sets the number of residuals in GMRES to be stored for orthogonalization.          Sets the threshold for diagonal dominant rows which are eliminated
408      The more residuals are stored the faster GMRES converged but          during AMG coarsening.
409        */
410        void setDiagonalDominanceThreshold(double threshold);
411    
412        /**
413            Returns the threshold for diagonal dominant rows which are eliminated
414            during AMG coarsening.
415      */      */
416      ESCRIPT_DLL_API void setTruncation(int truncation);      double getDiagonalDominanceThreshold() const;
417    
418      /**      /**
419      Returns the number of residuals in GMRES to be stored for orthogonalization          Sets the number of residuals in GMRES to be stored for
420            orthogonalization. The more residuals are stored the faster GMRES
421            converges but more memory is required.
422        */
423        void setTruncation(int truncation);
424    
425        /**
426            Returns the number of residuals in GMRES to be stored for
427            orthogonalization.
428      */      */
429      ESCRIPT_DLL_API int getTruncation() const;      int getTruncation() const;
430    
431      /**      /**
432      Sets the maximum number of iteration steps for the inner iteration.          Sets the maximum number of iteration steps for the inner iteration.
433    
434      \param iter_max maximum number of inner iterations          \param iter_max maximum number of inner iterations
435      */      */
436      ESCRIPT_DLL_API void setInnerIterMax(int iter_max);      void setInnerIterMax(int iter_max);
437    
438      /**      /**
439      Returns maximum number of inner iteration steps          Returns maximum number of inner iteration steps
   
440      */      */
441      ESCRIPT_DLL_API int getInnerIterMax() const;      int getInnerIterMax() const;
442    
443      /**      /**
444      Sets the maximum number of iteration steps          Sets the maximum number of iteration steps
445    
446      \param iter_max maximum number of iteration steps          \param iter_max maximum number of iteration steps
447      */      */
448      ESCRIPT_DLL_API void setIterMax(int iter_max);      void setIterMax(int iter_max);
449    
450      /**      /**
451      Returns maximum number of iteration steps          Returns maximum number of iteration steps
   
452      */      */
453      ESCRIPT_DLL_API int getIterMax() const;      int getIterMax() const;
454    
455      /**      /**
456      Sets the maximum number of coarsening levels to be used in an algebraic          Sets the maximum number of coarsening levels to be used in an algebraic
457      multi level solver or preconditioner          multi level solver or preconditioner
458    
459      \param level_max maximum number of levels          \param level_max maximum number of levels
460      */      */
461      ESCRIPT_DLL_API void setLevelMax(int level_max);      void setLevelMax(int level_max);
462    
463      /**      /**
464      Returns the maximum number of coarsening levels to be used in an algebraic          Returns the maximum number of coarsening levels to be used in an
465      multi level solver or preconditioner          algebraic multi level solver or preconditioner
   
466      */      */
467      ESCRIPT_DLL_API int getLevelMax() const;      int getLevelMax() const;
468    
469      /**      /**
470      Sets the cycle type (V-cycle or W-cycle) to be used in an algebraic multi          Sets the cycle type (V-cycle or W-cycle) to be used in an algebraic
471      level solver or preconditioner          multi level solver or preconditioner
472    
473      \param cycle_type the type of cycle          \param cycle_type the type of cycle
474      */      */
475      ESCRIPT_DLL_API void setCycleType(int cycle_type);      void setCycleType(int cycle_type);
476    
477      /**      /**
478      Returns the cycle type (V- or W-cycle) to be used in an algebraic multi          Returns the cycle type (V- or W-cycle) to be used in an algebraic multi
479      level solver or preconditioner          level solver or preconditioner
   
480      */      */
481      ESCRIPT_DLL_API int getCycleType() const;      int getCycleType() const;
482    
483      /**      /**
484      Sets the threshold for coarsening in the algebraic multi level solver or          Sets the threshold for coarsening in the algebraic multi level solver
485      preconditioner          or preconditioner
486    
487      \param theta threshold for coarsening          \param theta threshold for coarsening
488      */      */
489      ESCRIPT_DLL_API void setCoarseningThreshold(double theta);      void setCoarseningThreshold(double theta);
490    
491      /**      /**
492      Returns the threshold for coarsening in the algebraic multi level solver          Returns the threshold for coarsening in the algebraic multi level
493      or preconditioner          solver or preconditioner
   
494      */      */
495      ESCRIPT_DLL_API double getCoarseningThreshold() const;      double getCoarseningThreshold() const;
496    
497      /**      /**
498      Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.          Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR
499            preconditioner.
500    
501      \param sweeps number of sweeps          \param sweeps number of sweeps
502      */      */
503      ESCRIPT_DLL_API void setNumSweeps(int sweeps);      void setNumSweeps(int sweeps);
504    
505      /**      /**
506      Returns the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.          Returns the number of sweeps in a Jacobi or Gauss-Seidel/SOR
507            preconditioner.
508      */      */
509      ESCRIPT_DLL_API int getNumSweeps() const;      int getNumSweeps() const;
510    
511      /**      /**
512      Sets the number of sweeps in the pre-smoothing step of a multi level          Sets the number of sweeps in the pre-smoothing step of a multi level
513      solver or preconditioner          solver or preconditioner
514    
515      \param sweeps number of sweeps          \param sweeps number of sweeps
516      */      */
517      ESCRIPT_DLL_API void setNumPreSweeps(int sweeps);      void setNumPreSweeps(int sweeps);
518    
519      /**      /**
520      Returns he number of sweeps in the pre-smoothing step of a multi level          Returns he number of sweeps in the pre-smoothing step of a multi level
521      solver or preconditioner          solver or preconditioner
   
522      */      */
523      ESCRIPT_DLL_API int getNumPreSweeps() const;      int getNumPreSweeps() const;
524    
525      /**      /**
526      Sets the number of sweeps in the post-smoothing step of a multi level          Sets the number of sweeps in the post-smoothing step of a multi level
527      solver or preconditioner          solver or preconditioner
528    
529      \param sweeps number of sweeps          \param sweeps number of sweeps
530      */      */
531      ESCRIPT_DLL_API void setNumPostSweeps(int sweeps);      void setNumPostSweeps(int sweeps);
532    
533      /**      /**
534      Returns the number of sweeps in the post-smoothing step of a multi level          Returns the number of sweeps in the post-smoothing step of a multi level
535      solver or preconditioner          solver or preconditioner
   
536      */      */
537      ESCRIPT_DLL_API int getNumPostSweeps() const;      int getNumPostSweeps() const;
538    
539      /**      /**
540      Sets the relative tolerance for the solver          Sets the relative tolerance for the solver
541    
542      \param rtol relative tolerance          \param rtol relative tolerance
543      */      */
544      ESCRIPT_DLL_API void setTolerance(double rtol);      void setTolerance(double rtol);
545    
546      /**      /**
547      Returns the relative tolerance for the solver          Returns the relative tolerance for the solver
   
548      */      */
549      ESCRIPT_DLL_API double getTolerance() const;      double getTolerance() const;
550    
551      /**      /**
552      Sets the absolute tolerance for the solver          Sets the absolute tolerance for the solver
553    
554      \param atol absolute tolerance          \param atol absolute tolerance
555      */      */
556      ESCRIPT_DLL_API void setAbsoluteTolerance(double atol);      void setAbsoluteTolerance(double atol);
557    
558      /**      /**
559      Returns the absolute tolerance for the solver          Returns the absolute tolerance for the solver
   
560      */      */
561      ESCRIPT_DLL_API double getAbsoluteTolerance() const;      double getAbsoluteTolerance() const;
562    
563      /**      /**
564       Sets the relative tolerance for an inner iteration scheme for instance on          Sets the relative tolerance for an inner iteration scheme for instance
565       the coarsest level in a multi-level scheme.          on the coarsest level in a multi-level scheme.
566    
567      \param rtol inner relative tolerance          \param rtol inner relative tolerance
568      */      */
569      ESCRIPT_DLL_API void setInnerTolerance(double rtol);      void setInnerTolerance(double rtol);
570    
571      /**      /**
572      Returns the relative tolerance for an inner iteration scheme          Returns the relative tolerance for an inner iteration scheme
   
573      */      */
574      ESCRIPT_DLL_API double getInnerTolerance() const;      double getInnerTolerance() const;
575    
576      /**      /**
577      Sets the relative drop tolerance in ILUT          Sets the relative drop tolerance in ILUT
578    
579      \param drop_tol drop tolerance          \param drop_tol drop tolerance
580      */      */
581      ESCRIPT_DLL_API void setDropTolerance(double drop_tol);      void setDropTolerance(double drop_tol);
582    
583      /**      /**
584      Returns the relative drop tolerance in ILUT          Returns the relative drop tolerance in ILUT
   
585      */      */
586      ESCRIPT_DLL_API double getDropTolerance() const;      double getDropTolerance() const;
587    
588      /**      /**
589      Sets the maximum allowed increase in storage for ILUT. An increase of 2 would          Sets the maximum allowed increase in storage for ILUT. An increase of
590      mean that a doubling of the storage needed for the coefficient matrix is          2 would mean that a doubling of the storage needed for the coefficient
591      allowed during ILUT factorization.          matrix is allowed during ILUT factorization.
592    
593      \param storage allowed storage increase          \param drop allowed storage increase
594      */      */
595      ESCRIPT_DLL_API void setDropStorage(double drop);      void setDropStorage(double drop);
596    
597      /**      /**
598      Returns the maximum allowed increase in storage for ILUT          Returns the maximum allowed increase in storage for ILUT
   
599      */      */
600      ESCRIPT_DLL_API double getDropStorage() const;      double getDropStorage() const;
601    
602      /**      /**
603      Sets the relaxation factor used to add dropped elements in RILU to the          Sets the relaxation factor used to add dropped elements in RILU to the
604      main diagonal.          main diagonal.
605    
606      \param factor relaxation factor          \param factor relaxation factor
607      \note RILU with a relaxation factor 0 is identical to ILU0          \note RILU with a relaxation factor 0 is identical to ILU0
608      */      */
609      ESCRIPT_DLL_API void setRelaxationFactor(double factor);      void setRelaxationFactor(double factor);
   
610    
611      /**      /**
612      Returns the relaxation factor used to add dropped elements in RILU to the          Returns the relaxation factor used to add dropped elements in RILU to
613      main diagonal.          the main diagonal.
   
614      */      */
615      ESCRIPT_DLL_API double getRelaxationFactor() const;      double getRelaxationFactor() const;
616    
617      /**      /**
618      Checks if symmetry of the coefficient matrix is indicated.          Checks if symmetry of the coefficient matrix is indicated.
619    
620      \return true if a symmetric PDE is indicated, false otherwise          \return true if a symmetric PDE is indicated, false otherwise
621      */      */
622      ESCRIPT_DLL_API bool isSymmetric() const;      bool isSymmetric() const;
623    
624      /**      /**
625      Sets the symmetry flag to indicate that the coefficient matrix is symmetric.          Sets the symmetry flag to indicate that the coefficient matrix is
626            symmetric.
627      */      */
628      ESCRIPT_DLL_API void setSymmetryOn();      void setSymmetryOn();
629    
630      /**      /**
631      Clears the symmetry flag for the coefficient matrix.          Clears the symmetry flag for the coefficient matrix.
632      */      */
633      ESCRIPT_DLL_API void setSymmetryOff();      void setSymmetryOff();
634    
635      /**      /**
636      Sets the symmetry flag for the coefficient matrix to ``flag``.          Sets the symmetry flag for the coefficient matrix to ``flag``.
637    
638      \param flag If true, the symmetry flag is set otherwise reset.          \param flag If true, the symmetry flag is set otherwise reset.
639      */ESCRIPT_DLL_API void setSymmetry(bool symmetry);      */
640        void setSymmetry(bool symmetry);
641    
642      /**      /**
643      Returns ``true`` if the solver is expected to be verbose.          Returns ``true`` if the solver is expected to be verbose.
644    
645      \return true if verbosity is switched on.          \return true if verbosity is on
646      */      */
647      ESCRIPT_DLL_API bool isVerbose() const;      bool isVerbose() const;
648    
649      /**      /**
650      Switches the verbosity of the solver on.          Switches the verbosity of the solver on.
651      */      */
652      ESCRIPT_DLL_API void setVerbosityOn();      void setVerbosityOn();
653    
654      /**      /**
655      Switches the verbosity of the solver off.          Switches the verbosity of the solver off.
656      */      */
657      ESCRIPT_DLL_API void setVerbosityOff();      void setVerbosityOff();
658    
659      /**      /**
660      Sets the verbosity flag for the solver to ``flag``.          Sets the verbosity flag for the solver to ``flag``.
661    
662      \param verbose If ``true``, the verbosity of the solver is switched on.          \param verbose If ``true``, the verbosity of the solver is switched on.
663      */      */
664      ESCRIPT_DLL_API void setVerbosity(bool verbosity);      void setVerbosity(bool verbose);
665    
666      /**      /**
667      Returns ``true`` if the tolerance of the inner solver is selected          Returns ``true`` if the tolerance of the inner solver is selected
668      automatically. Otherwise the inner tolerance set by `setInnerTolerance` is          automatically. Otherwise the inner tolerance set by `setInnerTolerance`
669      used.          is used.
670    
671      \returns ``true`` if inner tolerance adaption is chosen.          \returns ``true`` if inner tolerance adaption is chosen.
672      */      */
673      ESCRIPT_DLL_API bool adaptInnerTolerance() const;      bool adaptInnerTolerance() const;
674    
675      /**      /**
676      Switches the automatic selection of inner tolerance on          Switches the automatic selection of inner tolerance on
677      */      */
678      ESCRIPT_DLL_API void setInnerToleranceAdaptionOn();      void setInnerToleranceAdaptionOn();
679    
680      /**      /**
681      Switches the automatic selection of inner tolerance off.          Switches the automatic selection of inner tolerance off
682      */      */
683      ESCRIPT_DLL_API void setInnerToleranceAdaptionOff();      void setInnerToleranceAdaptionOff();
684    
685      /**      /**
686      Sets the flag to indicate automatic selection of the inner tolerance.          Sets the flag to indicate automatic selection of the inner tolerance.
687    
688      \param adapt If ``true``, the inner tolerance is selected automatically.          \param adapt If ``true``, the inner tolerance is selected automatically
689      */      */
690      ESCRIPT_DLL_API void setInnerToleranceAdaption(bool adaption);      void setInnerToleranceAdaption(bool adaption);
691    
692      /**      /**
693      Returns ``true`` if a failure to meet the stopping criteria within the          Returns ``true`` if a failure to meet the stopping criteria within the
694      given number of iteration steps is not raising in exception. This is useful          given number of iteration steps does not raise an exception.
695      if a solver is used in a non-linear context where the non-linear solver can          This is useful if a solver is used in a non-linear context where the
696      continue even if the returned the solution does not necessarily meet the          non-linear solver can continue even if the returned solution does not
697      stopping criteria. One can use the `hasConverged` method to check if the          necessarily meet the stopping criteria. One can use the `hasConverged`
698      last call to the solver was successful.          method to check if the last call to the solver was successful.
699    
700      \returns ``true`` if a failure to achieve convergence is accepted.          \returns ``true`` if a failure to achieve convergence is accepted.
701      */      */
702      ESCRIPT_DLL_API bool acceptConvergenceFailure() const;      bool acceptConvergenceFailure() const;
703    
704      /**      /**
705      Switches the acceptance of a failure of convergence on          Switches the acceptance of a failure of convergence on
706      */      */
707      ESCRIPT_DLL_API void setAcceptanceConvergenceFailureOn();      void setAcceptanceConvergenceFailureOn();
708    
709      /**      /**
710      Switches the acceptance of a failure of convergence off.          Switches the acceptance of a failure of convergence off
711      */      */
712      ESCRIPT_DLL_API void setAcceptanceConvergenceFailureOff();      void setAcceptanceConvergenceFailureOff();
713    
714      /**      /**
715      Sets the flag to indicate the acceptance of a failure of convergence.          Sets the flag to indicate the acceptance of a failure of convergence.
716    
717      \param accept If ``true``, any failure to achieve convergence is accepted.          \param accept If ``true``, any failure to achieve convergence is
718                   accepted.
719      */      */
720      ESCRIPT_DLL_API void setAcceptanceConvergenceFailure(bool acceptance);      void setAcceptanceConvergenceFailure(bool acceptance);
721    
722      /**      /**
723      Returns ``true`` if the preconditoner is applied locally on each MPI. This          Returns ``true`` if the preconditoner is applied locally on each MPI
724      reduces communication costs and speeds up the application of the          rank. This reduces communication costs and speeds up the application of
725      preconditioner but at the costs of more iteration steps. This can be an          the preconditioner but at the cost of more iteration steps.
726      advantage on clusters with slower interconnects.          This can be an advantage on clusters with slower interconnects.
727      */      */
728      ESCRIPT_DLL_API bool useLocalPreconditioner() const;      bool useLocalPreconditioner() const;
729    
730      /**      /**
731      Sets the flag to use local preconditioning to on          Sets the flag to use local preconditioning to on
732      */      */
733      ESCRIPT_DLL_API void setLocalPreconditionerOn();      void setLocalPreconditionerOn();
734    
735      /**      /**
736      Sets the flag to use local preconditioning to off          Sets the flag to use local preconditioning to off
737      */      */
738      ESCRIPT_DLL_API void setLocalPreconditionerOff();      void setLocalPreconditionerOff();
739    
740      /**      /**
741      Sets the flag to use local preconditioning          Sets the flag to use local preconditioning
742    
743      \param use If ``true``, local proconditioning on each MPI rank is applied          \param use If ``true``, local proconditioning on each MPI rank is
744                   applied
745      */      */
746      ESCRIPT_DLL_API void setLocalPreconditioner(bool local);      void setLocalPreconditioner(bool local);
747    
748      /**      /**
749      Sets the minimum sparsity at the coarsest level. Typically          Sets the minimum sparsity at the coarsest level. Typically a direct
750      a direct solver is used when the sparsity becomes bigger than          solver is used when the sparsity becomes larger than the set limit.
     the set limit.  
751    
752      \param sparsity minimal sparsity          \param sparsity minimal sparsity
753      */      */
754      ESCRIPT_DLL_API void setMinCoarseMatrixSparsity(double sparsity);      void setMinCoarseMatrixSparsity(double sparsity);
755    
756      /**      /**
757      Returns the minimum sparsity on the coarsest level. Typically          Returns the minimum sparsity on the coarsest level. Typically
758      a direct solver is used when the sparsity becomes bigger than          a direct solver is used when the sparsity becomes bigger than
759      the set limit.          the set limit.
760    
761      \returns minimal sparsity          \returns minimal sparsity
762      */      */
763      ESCRIPT_DLL_API double getMinCoarseMatrixSparsity() const;      double getMinCoarseMatrixSparsity() const;
764    
765      /**      /**
766      Sets the number of refinement steps to refine the solution when a direct          Sets the number of refinement steps to refine the solution when a
767      solver is applied.          direct solver is applied.
768    
769      \param refinements number of refinements          \param refinements number of refinements
770      */      */
771      ESCRIPT_DLL_API void setNumRefinements(int refinements);      void setNumRefinements(int refinements);
772    
773      /**      /**
774      Returns the number of refinement steps to refine the solution when a direct          Returns the number of refinement steps to refine the solution when a
775      solver is applied.          direct solver is applied.
   
776      */      */
777      ESCRIPT_DLL_API int getNumRefinements() const;      int getNumRefinements() const;
778    
779      /**      /**
780      Sets the number of refinement steps to refine the solution on the coarsest          Sets the number of refinement steps to refine the solution on the
781      level when a direct solver is applied.          coarsest level when a direct solver is applied.
782    
783      \param refinements number of refinements          \param refinements number of refinements
784      */      */
785      ESCRIPT_DLL_API void setNumCoarseMatrixRefinements(int refinements);      void setNumCoarseMatrixRefinements(int refinements);
786    
787      /**      /**
788      Returns the number of refinement steps to refine the solution on the          Returns the number of refinement steps to refine the solution on the
789      coarsest level when a direct solver is applied.          coarsest level when a direct solver is applied.
   
790      */      */
791      ESCRIPT_DLL_API int getNumCoarseMatrixRefinements() const;      int getNumCoarseMatrixRefinements() const;
792    
793      /**      /**
794      Returns ``true`` if a panel is used to search for unknown in the AMG          Returns ``true`` if a panel is used to search for unknowns in the AMG
795      coarsening, The panel approach is normally faster          coarsening, The panel approach is normally faster but can lead to
796      but can lead to larger coarse level systems.          larger coarse level systems.
   
797      */      */
798      ESCRIPT_DLL_API bool usePanel() const;      bool usePanel() const;
799    
800      /**      /**
801      Sets the flag to use a panel to find unknowns in AMG coarsening          Sets the flag to use a panel to find unknowns in AMG coarsening
802      */      */
803      ESCRIPT_DLL_API void setUsePanelOn();      void setUsePanelOn();
804    
805      /**      /**
806      Sets the flag to use a panel to find unknowns in AMG coarsening to off          Sets the flag to use a panel to find unknowns in AMG coarsening to off
807      */      */
808      ESCRIPT_DLL_API void setUsePanelOff();      void setUsePanelOff();
809    
810      /**      /**
811      Sets the flag to use  a panel to find unknowns in AMG coarsening          Sets the flag to use a panel to find unknowns in AMG coarsening
812    
813      \param use If ``true``,a panel is used to find unknowns in AMG coarsening          \param use If ``true``, a panel is used to find unknowns in AMG
814                   coarsening
815      */      */
816      ESCRIPT_DLL_API void setUsePanel(bool use);      void setUsePanel(bool use);
817    
818      /**      /**
819      Set the interpolation method for the AMG preconditioner.          Sets the interpolation method for the AMG preconditioner.
820    
821      \param method key of the interpolation method to be used, should be in          \param method key of the interpolation method to be used, should be in
822              `ESCRIPT_CLASSIC_INTERPOLATION_WITH_FF_COUPLING`,                 `SO_INTERPOLATION_CLASSIC_WITH_FF_COUPLING`,
823              `ESCRIPT_CLASSIC_INTERPOLATION`, `ESCRIPT_DIRECT_INTERPOLATION`                 `SO_INTERPOLATION_CLASSIC`, `SO_INTERPOLATION_DIRECT`
824      */      */
825      ESCRIPT_DLL_API void setAMGInterpolation(int interpolation);      void setAMGInterpolation(int interpolation);
826    
827      /**      /**
828      Returns key of the interpolation method for the SAMG preconditioner          Returns key of the interpolation method for the AMG preconditioner
   
829      */      */
830      ESCRIPT_DLL_API SolverOptions getAMGInterpolation() const;      SolverOptions getAMGInterpolation() const;
831    
832      /**      /**
833      Set the solver method for ODEs.          Sets the solver method for ODEs.
834    
835      \param method key of the ODE solver method to be used, should be in          \param solver key of the ODE solver method to be used, should be in
836              `ESCRIPT_CRANK_NICOLSON`, `ESCRIPT_BACKWARD_EULER`,                 `SO_ODESOLVER_CRANK_NICOLSON`, `SO_ODESOLVER_BACKWARD_EULER`,
837              `ESCRIPT_LINEAR_CRANK_NICOLSON`                 `SO_ODESOLVER_LINEAR_CRANK_NICOLSON`
838      */      */
839      ESCRIPT_DLL_API void setODESolver(int solver);      void setODESolver(int solver);
840    
841      /**      /**
842      Returns key of the solver method for ODEs.          Returns the key of the solver method for ODEs.
   
843      */      */
844      ESCRIPT_DLL_API SolverOptions getODESolver() const;      SolverOptions getODESolver() const;
845    
846    
847  protected:  protected:
848        SolverOptions target;
849        SolverOptions package;
850        SolverOptions method;
851        SolverOptions preconditioner;
852        SolverOptions ode_solver;
853        SolverOptions smoother;
854        SolverOptions reordering;
855        SolverOptions coarsening;
856        SolverOptions amg_interpolation_method;
857      int level_max;      int level_max;
858      double coarsening_threshold;      double coarsening_threshold;
     SolverOptions smoother;  
859      int sweeps;      int sweeps;
860      int pre_sweeps;      int pre_sweeps;
861      int post_sweeps;      int post_sweeps;
# Line 834  protected: Line 872  protected:
872      bool verbose;      bool verbose;
873      bool adapt_inner_tolerance;      bool adapt_inner_tolerance;
874      bool accept_convergence_failure;      bool accept_convergence_failure;
875      SolverOptions reordering;      int min_coarse_matrix_size;
     SolverOptions package;  
     SolverOptions method;  
     SolverOptions preconditioner;  
     SolverOptions coarsening;  
     int MinCoarseMatrixSize;  
876      double relaxation;      double relaxation;
877      bool use_local_preconditioner;      bool use_local_preconditioner;
878      double min_sparsity;      double min_sparsity;
# Line 847  protected: Line 880  protected:
880      int coarse_refinements;      int coarse_refinements;
881      bool use_panel;      bool use_panel;
882      double diagonal_dominance_threshold;      double diagonal_dominance_threshold;
     SolverOptions amg_interpolation_method;  
883      int cycle_type;      int cycle_type;
     SolverOptions ode_solver;  
884    
885      int num_iter;      int num_iter;
886      int num_level;      int num_level;
# Line 861  protected: Line 892  protected:
892      bool converged;      bool converged;
893      int preconditioner_size;      int preconditioner_size;
894      bool time_step_backtracking_used;      bool time_step_backtracking_used;
895        double coarse_level_sparsity;
896        int num_coarse_unknowns;
897      int cum_num_inner_iter;      int cum_num_inner_iter;
898      int cum_num_iter;      int cum_num_iter;
899      double cum_time;      double cum_time;
900      double cum_set_up_time;      double cum_set_up_time;
901      double cum_net_time;      double cum_net_time;
     double coarse_level_sparsity;  
     int num_coarse_unknowns;  
902  };  };
903    
904  typedef boost::shared_ptr<SolverBuddy> SB_ptr;  typedef boost::shared_ptr<SolverBuddy> SB_ptr;
905    
906  }  } // namespace escript
907    
908    #endif // __ESCRIPT_SOLVEROPTIONS_H__
909    
 #endif  

Legend:
Removed from v.5147  
changed lines
  Added in v.5148

  ViewVC Help
Powered by ViewVC 1.1.26