escript  Revision_
SolverOptions.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 #ifndef __ESCRIPT_SOLVEROPTIONS_H__
18 #define __ESCRIPT_SOLVEROPTIONS_H__
19 
20 #include <boost/python/object.hpp>
21 #include "system_dep.h"
22 
23 namespace escript {
24 
90 {
92 
93  // Solver targets
96 
97  // Solver packages
105 
106  // Solver methods
123 
124  // Preconditioners
135 
136  // ODE solvers
140 
141  // Interpolation methods
145 
146  // Coarsening methods
156 
161 };
162 
164 {
165 public:
166  SolverBuddy();
167 
171  std::string getSummary() const;
172 
178  const char* getName(int key) const;
179 
186  void resetDiagnostics(bool all=false);
187 
196  void updateDiagnostics(const std::string key,
197  const boost::python::object& value);
198 
227  double getDiagnostics(const std::string name) const;
228 
236  bool hasConverged() const;
237 
249  void setCoarsening(int coarsening);
250 
255  SolverOptions getCoarsening() const;
256 
262  void setMinCoarseMatrixSize(int size);
263 
267  int getMinCoarseMatrixSize() const;
268 
283  void setPreconditioner(int preconditioner);
284 
288  SolverOptions getPreconditioner() const;
289 
300  void setSmoother(int smoother);
301 
305  SolverOptions getSmoother() const;
306 
325  void setSolverMethod(int method);
326 
330  SolverOptions getSolverMethod() const;
331 
342  void setSolverTarget(int target);
343 
347  SolverOptions getSolverTarget() const;
348 
361  void setPackage(int package);
362 
366  SolverOptions getPackage() const;
367 
377  void setReordering(int ordering);
378 
383  SolverOptions getReordering() const;
384 
392  void setRestart(int restart);
393 
398  int getRestart() const;
399 
404  int _getRestartForC() const;
405 
410  void setDiagonalDominanceThreshold(double threshold);
411 
416  double getDiagonalDominanceThreshold() const;
417 
423  void setTruncation(int truncation);
424 
429  int getTruncation() const;
430 
436  void setInnerIterMax(int iter_max);
437 
441  int getInnerIterMax() const;
442 
448  void setIterMax(int iter_max);
449 
453  int getIterMax() const;
454 
461  void setLevelMax(int level_max);
462 
467  int getLevelMax() const;
468 
475  void setCycleType(int cycle_type);
476 
481  int getCycleType() const;
482 
489  void setCoarseningThreshold(double theta);
490 
495  double getCoarseningThreshold() const;
496 
503  void setNumSweeps(int sweeps);
504 
509  int getNumSweeps() const;
510 
517  void setNumPreSweeps(int sweeps);
518 
523  int getNumPreSweeps() const;
524 
531  void setNumPostSweeps(int sweeps);
532 
537  int getNumPostSweeps() const;
538 
544  void setTolerance(double rtol);
545 
549  double getTolerance() const;
550 
556  void setAbsoluteTolerance(double atol);
557 
561  double getAbsoluteTolerance() const;
562 
569  void setInnerTolerance(double rtol);
570 
574  double getInnerTolerance() const;
575 
581  void setDropTolerance(double drop_tol);
582 
586  double getDropTolerance() const;
587 
595  void setDropStorage(double drop);
596 
600  double getDropStorage() const;
601 
609  void setRelaxationFactor(double factor);
610 
615  double getRelaxationFactor() const;
616 
622  bool isSymmetric() const;
623 
628  void setSymmetryOn();
629 
633  void setSymmetryOff();
634 
640  void setSymmetry(bool symmetry);
641 
647  bool isVerbose() const;
648 
652  void setVerbosityOn();
653 
657  void setVerbosityOff();
658 
664  void setVerbosity(bool verbose);
665 
673  bool adaptInnerTolerance() const;
674 
678  void setInnerToleranceAdaptionOn();
679 
683  void setInnerToleranceAdaptionOff();
684 
690  void setInnerToleranceAdaption(bool adaption);
691 
702  bool acceptConvergenceFailure() const;
703 
707  void setAcceptanceConvergenceFailureOn();
708 
712  void setAcceptanceConvergenceFailureOff();
713 
720  void setAcceptanceConvergenceFailure(bool acceptance);
721 
728  bool useLocalPreconditioner() const;
729 
733  void setLocalPreconditionerOn();
734 
738  void setLocalPreconditionerOff();
739 
746  void setLocalPreconditioner(bool local);
747 
754  void setMinCoarseMatrixSparsity(double sparsity);
755 
763  double getMinCoarseMatrixSparsity() const;
764 
771  void setNumRefinements(int refinements);
772 
777  int getNumRefinements() const;
778 
785  void setNumCoarseMatrixRefinements(int refinements);
786 
791  int getNumCoarseMatrixRefinements() const;
792 
798  bool usePanel() const;
799 
803  void setUsePanelOn();
804 
808  void setUsePanelOff();
809 
816  void setUsePanel(bool use);
817 
826  void setAMGInterpolation(int interpolation);
827 
831  SolverOptions getAMGInterpolation() const;
832 
840  void setODESolver(int solver);
841 
845  SolverOptions getODESolver() const;
846 
847 
848 protected:
860  int sweeps;
863  double tolerance;
867  double drop_storage;
868  int iter_max;
871  int restart; //0 will have to be None in python, will get tricky
872  bool symmetric;
873  bool verbose;
877  double relaxation;
879  double min_sparsity;
882  bool use_panel;
885 
886  int num_iter;
889  double time;
890  double set_up_time;
891  double net_time;
893  bool converged;
900  double cum_time;
902  double cum_net_time;
903 };
904 
905 typedef boost::shared_ptr<SolverBuddy> SB_ptr;
906 
907 } // namespace escript
908 
909 #endif // __ESCRIPT_SOLVEROPTIONS_H__
910 
Definition: SolverOptions.h:150
Definition: SolverOptions.h:95
int refinements
Definition: SolverOptions.h:880
int restart
Definition: SolverOptions.h:871
Definition: SolverOptions.h:163
Definition: SolverOptions.h:114
Definition: SolverOptions.h:99
bool adapt_inner_tolerance
Definition: SolverOptions.h:874
Definition: SolverOptions.h:157
double relaxation
Definition: SolverOptions.h:877
double tolerance
Definition: SolverOptions.h:863
SolverOptions package
Definition: SolverOptions.h:850
Definition: SolverOptions.h:142
SolverOptions
Definition: SolverOptions.h:89
Definition: SolverOptions.h:118
Definition: SolverOptions.h:126
SolverOptions smoother
Definition: SolverOptions.h:854
Definition: AbstractContinuousDomain.cpp:24
int level_max
Definition: SolverOptions.h:858
double cum_set_up_time
Definition: SolverOptions.h:901
Definition: SolverOptions.h:131
int post_sweeps
Definition: SolverOptions.h:862
Definition: SolverOptions.h:134
Definition: SolverOptions.h:154
Definition: SolverOptions.h:110
boost::shared_ptr< SolverBuddy > SB_ptr
Definition: SolverOptions.h:905
double inner_tolerance
Definition: SolverOptions.h:865
Definition: SolverOptions.h:107
Definition: SolverOptions.h:144
int truncation
Definition: SolverOptions.h:870
double residual_norm
Definition: SolverOptions.h:892
Definition: SolverOptions.h:137
Definition: SolverOptions.h:152
int coarse_refinements
Definition: SolverOptions.h:881
Definition: SolverOptions.h:130
Definition: SolverOptions.h:149
Definition: SolverOptions.h:103
int min_coarse_matrix_size
Definition: SolverOptions.h:876
Definition: SolverOptions.h:132
double cum_net_time
Definition: SolverOptions.h:902
Definition: SolverOptions.h:160
Definition: SolverOptions.h:94
bool converged
Definition: SolverOptions.h:893
Definition: SolverOptions.h:159
int cum_num_iter
Definition: SolverOptions.h:899
Definition: SolverOptions.h:119
Definition: SolverOptions.h:111
Definition: SolverOptions.h:98
Definition: SolverOptions.h:108
Definition: SolverOptions.h:133
int cum_num_inner_iter
Definition: SolverOptions.h:898
Definition: SolverOptions.h:102
SolverOptions amg_interpolation_method
Definition: SolverOptions.h:857
Definition: SolverOptions.h:113
bool use_panel
Definition: SolverOptions.h:882
Definition: SolverOptions.h:125
Definition: SolverOptions.h:101
int iter_max
Definition: SolverOptions.h:868
double coarse_level_sparsity
Definition: SolverOptions.h:896
Definition: SolverOptions.h:115
int num_coarse_unknowns
Definition: SolverOptions.h:897
Definition: SolverOptions.h:147
Definition: SolverOptions.h:128
bool symmetric
Definition: SolverOptions.h:872
bool accept_convergence_failure
Definition: SolverOptions.h:875
Definition: SolverOptions.h:127
Definition: SolverOptions.h:121
bool time_step_backtracking_used
Definition: SolverOptions.h:895
Definition: SolverOptions.h:91
double cum_time
Definition: SolverOptions.h:900
double set_up_time
Definition: SolverOptions.h:890
Definition: SolverOptions.h:148
Definition: SolverOptions.h:138
SolverOptions reordering
Definition: SolverOptions.h:855
Definition: SolverOptions.h:109
int inner_iter_max
Definition: SolverOptions.h:869
Definition: SolverOptions.h:117
double absolute_tolerance
Definition: SolverOptions.h:864
Definition: SolverOptions.h:104
SolverOptions target
Definition: SolverOptions.h:849
double drop_storage
Definition: SolverOptions.h:867
SolverOptions coarsening
Definition: SolverOptions.h:856
int num_iter
Definition: SolverOptions.h:886
Definition: SolverOptions.h:112
Definition: SolverOptions.h:129
int num_inner_iter
Definition: SolverOptions.h:888
Definition: SolverOptions.h:100
Definition: SolverOptions.h:151
int pre_sweeps
Definition: SolverOptions.h:861
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:54
double time
Definition: SolverOptions.h:889
bool verbose
Definition: SolverOptions.h:873
Definition: SolverOptions.h:155
int sweeps
Definition: SolverOptions.h:860
SolverOptions preconditioner
Definition: SolverOptions.h:852
double diagonal_dominance_threshold
Definition: SolverOptions.h:883
Definition: SolverOptions.h:122
bool use_local_preconditioner
Definition: SolverOptions.h:878
Definition: SolverOptions.h:139
Definition: SolverOptions.h:120
double drop_tolerance
Definition: SolverOptions.h:866
double min_sparsity
Definition: SolverOptions.h:879
SolverOptions ode_solver
Definition: SolverOptions.h:853
Definition: SolverOptions.h:116
double coarsening_threshold
Definition: SolverOptions.h:859
Definition: SolverOptions.h:153
int preconditioner_size
Definition: SolverOptions.h:894
int num_level
Definition: SolverOptions.h:887
Definition: SolverOptions.h:158
double net_time
Definition: SolverOptions.h:891
SolverOptions method
Definition: SolverOptions.h:851
int cycle_type
Definition: SolverOptions.h:884