/[escript]/trunk/escriptcore/src/escriptcpp.cpp
ViewVC logotype

Diff of /trunk/escriptcore/src/escriptcpp.cpp

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

revision 4820 by jfenwick, Mon Mar 17 07:52:26 2014 UTC revision 4821 by sshaw, Tue Apr 1 04:58:33 2014 UTC
# Line 28  Line 28 
28  #include "esysUtils/Esys_MPI.h"  #include "esysUtils/Esys_MPI.h"
29  #include "EscriptParams.h"  #include "EscriptParams.h"
30  #include "TestDomain.h"  #include "TestDomain.h"
31    #include "SolverOptions.h"
32    #include "SolverOptionsException.h"
33    
34  #include "esysUtils/blocktimer.h"  #include "esysUtils/blocktimer.h"
35    
# Line 692  args("source", "q", "r","factor"), Line 693  args("source", "q", "r","factor"),
693       .def("getSafeTimeStepSize",&escript::AbstractTransportProblem::getSafeTimeStepSize)       .def("getSafeTimeStepSize",&escript::AbstractTransportProblem::getSafeTimeStepSize)
694       .def("getUnlimitedTimeStepSize",&escript::AbstractTransportProblem::getUnlimitedTimeStepSize);       .def("getUnlimitedTimeStepSize",&escript::AbstractTransportProblem::getUnlimitedTimeStepSize);
695    
696      enum_<escript::SolverOptions>("SolverOptions")
697        .value("DEFAULT", escript::ESCRIPT_DEFAULT)
698        .value("DIRECT", escript::ESCRIPT_DIRECT)
699        .value("CHOLEVSKY", escript::ESCRIPT_CHOLEVSKY)
700        .value("PCG", escript::ESCRIPT_PCG)
701        .value("CR", escript::ESCRIPT_CR)
702        .value("CGS", escript::ESCRIPT_CGS)
703        .value("BICGSTAB", escript::ESCRIPT_BICGSTAB)
704        .value("ILU0", escript::ESCRIPT_ILU0)
705        .value("ILUT", escript::ESCRIPT_ILUT)
706        .value("JACOBI", escript::ESCRIPT_JACOBI)
707        .value("GMRES", escript::ESCRIPT_GMRES)
708        .value("PRES20", escript::ESCRIPT_PRES20)
709        .value("LUMPING", escript::ESCRIPT_LUMPING)
710        .value("ROWSUM_LUMPING", escript::ESCRIPT_ROWSUM_LUMPING)
711        .value("HRZ_LUMPING", escript::ESCRIPT_HRZ_LUMPING)
712        .value("NO_REORDERING", escript::ESCRIPT_NO_REORDERING)
713        .value("MINIMUM_FILL_IN", escript::ESCRIPT_MINIMUM_FILL_IN)
714        .value("NESTED_DISSECTION", escript::ESCRIPT_NESTED_DISSECTION)
715        .value("MKL", escript::ESCRIPT_MKL)
716        .value("UMFPACK", escript::ESCRIPT_UMFPACK)
717        .value("ITERATIVE", escript::ESCRIPT_ITERATIVE)
718        .value("PASO", escript::ESCRIPT_PASO)
719        .value("AMG", escript::ESCRIPT_AMG)
720        .value("REC_ILU", escript::ESCRIPT_REC_ILU)
721        .value("TRILINOS", escript::ESCRIPT_TRILINOS)
722        .value("NONLINEAR_GMRES", escript::ESCRIPT_NONLINEAR_GMRES)
723        .value("TFQMR", escript::ESCRIPT_TFQMR)
724        .value("MINRES", escript::ESCRIPT_MINRES)
725        .value("GAUSS_SEIDEL", escript::ESCRIPT_GAUSS_SEIDEL)
726        .value("RILU", escript::ESCRIPT_RILU)
727        .value("DEFAULT_REORDERING", escript::ESCRIPT_DEFAULT_REORDERING)
728        .value("SUPER_LU", escript::ESCRIPT_SUPER_LU)
729        .value("PASTIX", escript::ESCRIPT_PASTIX)
730        .value("YAIR_SHAPIRA_COARSENING", escript::ESCRIPT_YAIR_SHAPIRA_COARSENING)
731        .value("RUGE_STUEBEN_COARSENING", escript::ESCRIPT_RUGE_STUEBEN_COARSENING)
732        .value("AGGREGATION_COARSENING", escript::ESCRIPT_AGGREGATION_COARSENING)
733        .value("NO_PRECONDITIONER", escript::ESCRIPT_NO_PRECONDITIONER)
734        .value("MIN_COARSE_MATRIX_SIZE", escript::ESCRIPT_MIN_COARSE_MATRIX_SIZE)
735        .value("AMLI", escript::ESCRIPT_AMLI)
736        .value("STANDARD_COARSENING", escript::ESCRIPT_STANDARD_COARSENING)
737        .value("CLASSIC_INTERPOLATION_WITH_FF_COUPLING", escript::ESCRIPT_CLASSIC_INTERPOLATION_WITH_FF_COUPLING)
738        .value("CLASSIC_INTERPOLATION", escript::ESCRIPT_CLASSIC_INTERPOLATION)
739        .value("DIRECT_INTERPOLATION", escript::ESCRIPT_DIRECT_INTERPOLATION)
740        .value("BOOMERAMG", escript::ESCRIPT_BOOMERAMG)
741        .value("CIJP_FIXED_RANDOM_COARSENING", escript::ESCRIPT_CIJP_FIXED_RANDOM_COARSENING)
742        .value("CIJP_COARSENING", escript::ESCRIPT_CIJP_COARSENING)
743        .value("FALGOUT_COARSENING", escript::ESCRIPT_FALGOUT_COARSENING)
744        .value("PMIS_COARSENING", escript::ESCRIPT_PMIS_COARSENING)
745        .value("HMIS_COARSENING", escript::ESCRIPT_HMIS_COARSENING)
746        .value("LINEAR_CRANK_NICOLSON", escript::ESCRIPT_LINEAR_CRANK_NICOLSON)
747        .value("CRANK_NICOLSON", escript::ESCRIPT_CRANK_NICOLSON)
748        .value("BACKWARD_EULER", escript::ESCRIPT_BACKWARD_EULER);
749    
750    
751      class_<escript::SolverBuddy, escript::SB_ptr >("SolverBuddy","",init<>())
752        .def("getSummary", &escript::SolverBuddy::getSummary,"Returns a string reporting the current settings")
753        .def("__str__", &escript::SolverBuddy::getSummary)
754        .def("getName", &escript::SolverBuddy::getName, args("key"),"Returns the name of a given key\n\n:param key: a valid key")
755        .def("resetDiagnostics", &escript::SolverBuddy::resetDiagnostics, args("all")=false,"Resets the diagnostics\n\n:param all: if ``all`` is ``True`` all diagnostics including accumulative counters are reset.\n:type all: ``bool``")
756        .def("_updateDiagnostics", &escript::SolverBuddy::updateDiagnostics, args("key", "value"),"Updates diagnostic information\n\n:param name: name of  diagnostic information\n:type name: ``str`` in the list 'num_iter', 'num_level',\n'num_inner_iter', 'time', 'set_up_time', 'net_time',\n'residual_norm', 'converged'.\n:param value: new value of the diagnostic information\n:note: this function is used by a solver to report diagnostics\ninformations.")
757        .def("getDiagnostics", &escript::SolverBuddy::getDiagnostics, args("name"),"Returns the diagnostic information ``name``. Possible values are:\n\n- 'num_iter': the number of iteration steps\n- 'cum_num_iter': the cumulative number of iteration steps\n- 'num_level': the number of level in multi level solver\n- 'num_inner_iter': the number of inner iteration steps\n- 'cum_num_inner_iter': the cumulative number of inner iteration steps\n- 'time': execution time\n- 'cum_time': cumulative execution time\n- 'set_up_time': time to set up of the solver, typically this includes factorization and reordering\n- 'cum_set_up_time': cumulative time to set up of the solver\n- 'net_time': net execution time, excluding setup time for the solver and execution time for preconditioner\n- 'cum_net_time': cumulative net execution time\n- 'preconditioner_size': size of preconditioner [Bytes]\n- 'converged': return True if solution has converged.\n- 'time_step_backtracking_used': returns True if time step back tracking has been used.\n- 'coarse_level_sparsity': returns the sparsity of the matrix on the coarsest level\n- 'num_coarse_unknowns': returns the number of unknowns on the coarsest level\n\n\n:param name: name of diagnostic information to return\n:type name: ``str`` in the list above.\n:return: requested value. 0 is returned if the value is yet to be defined.\n:note: If the solver has thrown an exception diagnostic values have an undefined status.")
758        .def("hasConverged", &escript::SolverBuddy::hasConverged,"Returns ``True`` if the last solver call has been finalized successfully.\n\n:note: if an exception has been thrown by the solver the status of this\nflag is undefined.")
759        .def("setCoarsening", &escript::SolverBuddy::setCoarsening, args("coarsening"),"Sets the key of the coarsening method to be applied in AMG or AMLI or BoomerAMG\n\n:param method: selects the coarsening method .\n:type method: in `DEFAULT`, `YAIR_SHAPIRA_COARSENING`, `RUGE_STUEBEN_COARSENING`, `AGGREGATION_COARSENING`, `CIJP_FIXED_RANDOM_COARSENING`, `CIJP_COARSENING`, `FALGOUT_COARSENING`, `PMIS_COARSENING`, `HMIS_COARSENING`")
760        .def("getCoarsening", &escript::SolverBuddy::getCoarsening,"Returns the key of the coarsening algorithm to be applied AMG, AMLI or BoomerAMG\n\n:rtype: in the list `DEFAULT`, `YAIR_SHAPIRA_COARSENING`, `RUGE_STUEBEN_COARSENING`, `AGGREGATION_COARSENING`, `CIJP_FIXED_RANDOM_COARSENING`, `CIJP_COARSENING`, `FALGOUT_COARSENING`, `PMIS_COARSENING`, `HMIS_COARSENING`")
761        .def("setMinCoarseMatrixSize", &escript::SolverBuddy::setMinCoarseMatrixSize, args("size"),"Sets the minimum size of the coarsest level matrix in AMG or AMLI\n\n:param size: minimum size of the coarsest level matrix .\n:type size: positive ``int``")
762        .def("getMinCoarseMatrixSize", &escript::SolverBuddy::getMinCoarseMatrixSize,"Returns the minimum size of the coarsest level matrix in AMG or AMLI")
763        .def("setPreconditioner", &escript::SolverBuddy::setPreconditioner, args("preconditioner"),"Sets the preconditioner to be used.\n\n:param preconditioner: key of the preconditioner to be used.\n:type preconditioner: in `ILU0`, `ILUT`, `JACOBI`, `AMG`, `AMLI`, `REC_ILU`, `GAUSS_SEIDEL`, `RILU`, `BOOMERAMG`, `NO_PRECONDITIONER`\n:note: Not all packages support all preconditioner. It can be assumed that a package makes a reasonable choice if it encounters an unknown\npreconditioner.")
764        .def("getPreconditioner", &escript::SolverBuddy::getPreconditioner,"Returns the key of the preconditioner to be used.\n\n:rtype: in the list `ILU0`, `ILUT`, `JACOBI`, `AMLI`, `AMG`, `REC_ILU`, `GAUSS_SEIDEL`, `RILU`, `BOOMERAMG`, `NO_PRECONDITIONER`")
765        .def("setSmoother", &escript::SolverBuddy::setSmoother, args("smoother"),"Sets the smoother to be used.\n\n:param smoother: key of the smoother to be used.\n:type smoother: in `JACOBI`, `GAUSS_SEIDEL`\n:note: Not all packages support all smoothers. It can be assumed that a package makes a reasonable choice if it encounters an unknown smoother.")
766        .def("getSmoother", &escript::SolverBuddy::getSmoother,"Returns key of the smoother to be used.\n\n:rtype: in the list `JACOBI`, `GAUSS_SEIDEL`")
767        .def("setSolverMethod", &escript::SolverBuddy::setSolverMethod, args("method"),"Sets the solver method to be used. Use ``method``=``DIRECT`` to indicate that a direct rather than an iterative solver should be used and use ``method``=``ITERATIVE`` to indicate that an iterative rather than a direct solver should be used.\n\n:param method: key of the solver method to be used.\n:type method: in `DEFAULT`, `DIRECT`, `CHOLEVSKY`, `PCG`, `CR`, `CGS`, `BICGSTAB`, `GMRES`, `PRES20`, `ROWSUM_LUMPING`, `HRZ_LUMPING`, `ITERATIVE`, `NONLINEAR_GMRES`, `TFQMR`, `MINRES`\n: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.")
768        .def("getSolverMethod", &escript::SolverBuddy::getSolverMethod,"Returns key of the solver method to be used.\n\n:rtype: in the list `DEFAULT`, `DIRECT`, `CHOLEVSKY`, `PCG`, `CR`, `CGS`, `BICGSTAB`, `GMRES`, `PRES20`, `ROWSUM_LUMPING`, `HRZ_LUMPING`, `MINRES`, `ITERATIVE`, `NONLINEAR_GMRES`, `TFQMR`")
769        .def("setPackage", &escript::SolverBuddy::setPackage, args("package"),"Sets the solver package to be used as a solver.\n\n:param package: key of the solver package to be used.\n:type package: in `DEFAULT`, `PASO`, `SUPER_LU`, `PASTIX`, `MKL`, `UMFPACK`, `TRILINOS`\n:note: Not all packages are support on all implementation. An exception may be thrown on some platforms if a particular package is requested.")
770        .def("getPackage", &escript::SolverBuddy::getPackage,"Returns the solver package key\n\n:rtype: in the list `DEFAULT`, `PASO`, `SUPER_LU`, `PASTIX`, `MKL`, `UMFPACK`, `TRILINOS`")
771        .def("setReordering", &escript::SolverBuddy::setReordering, args("ordering"),"Sets the key of the reordering method to be applied if supported by the solver. Some direct solvers support reordering to optimize compute time and storage use during elimination.\n\n:param ordering: selects the reordering strategy.\n:type ordering: in 'NO_REORDERING', 'MINIMUM_FILL_IN', 'NESTED_DISSECTION', 'DEFAULT_REORDERING'")
772        .def("getReordering", &escript::SolverBuddy::getReordering,"Returns the key of the reordering method to be applied if supported by the solver.\n\n:rtype: in `NO_REORDERING`, `MINIMUM_FILL_IN`, `NESTED_DISSECTION`, `DEFAULT_REORDERING`")
773        .def("setRestart", &escript::SolverBuddy::setRestart, args("restart"),"Sets the number of iterations steps after which GMRES performs a restart.\n\n:param restart: number of iteration steps after which to perform a restart. If 0 no restart is performed.\n:type restart: ``int``")
774        .def("getRestart", &escript::SolverBuddy::getRestart,"Returns the number of iterations steps after which GMRES performs a restart. If 0 is returned no restart is performed.\n\n:rtype: ``int``")
775        .def("setDiagonalDominanceThreshold", &escript::SolverBuddy::setDiagonalDominanceThreshold, args("threshold"),"Sets the threshold for diagonal dominant rows which are eliminated during AMG coarsening.\n\n:param value: threshold\n:type value: ``float``")
776        .def("getDiagonalDominanceThreshold", &escript::SolverBuddy::getDiagonalDominanceThreshold,"Returns the threshold for diagonal dominant rows which are eliminated during AMG coarsening.\n\n:rtype: ``float``")
777        .def("setTruncation", &escript::SolverBuddy::setTruncation, args("truncation"),"Sets the number of residuals in GMRES to be stored for orthogonalization. The more residuals are stored the faster GMRES converged\n\n:param truncation: truncation\n:type truncation: ``int``")
778        .def("getTruncation", &escript::SolverBuddy::getTruncation,"Returns the number of residuals in GMRES to be stored for orthogonalization\n\n:rtype: ``int``")
779        .def("setInnerIterMax", &escript::SolverBuddy::setInnerIterMax, args("iter_max"),"Sets the maximum number of iteration steps for the inner iteration.\n\n:param iter_max: maximum number of inner iterations\n:type iter_max: ``int``")
780        .def("getInnerIterMax", &escript::SolverBuddy::getInnerIterMax,"Returns maximum number of inner iteration steps\n\n:rtype: ``int``")
781        .def("setIterMax", &escript::SolverBuddy::setIterMax, args("iter_max"),"Sets the maximum number of iteration steps\n\n:param iter_max: maximum number of iteration steps\n:type iter_max: ``int``")
782        .def("getIterMax", &escript::SolverBuddy::getIterMax,"Returns maximum number of iteration steps\n\n:rtype: ``int``")
783        .def("setLevelMax", &escript::SolverBuddy::setLevelMax, args("level_max"),"Sets the maximum number of coarsening levels to be used in an algebraic multi-level solver or preconditioner\n\n:param level_max: maximum number of levels\n:type level_max: ``int``")
784        .def("getLevelMax", &escript::SolverBuddy::getLevelMax,"Returns the maximum number of coarsening levels to be used in an algebraic multi level solver or preconditioner\n\n:rtype: ``int``")
785        .def("setCycleType", &escript::SolverBuddy::setCycleType, args("cycle_type"),"Sets the cycle type (V-cycle or W-cycle) to be used in an algebraic multi-level solver or preconditioner\n\n:param cycle_type: the type of cycle\n:type cycle_type: ``int``")
786        .def("getCycleType", &escript::SolverBuddy::getCycleType,"Returns the cyle type (V- or W-cycle) to be used in an algebraic multi level solver or preconditioner\n\n:rtype: ``int``")
787        .def("setCoarseningThreshold", &escript::SolverBuddy::setCoarseningThreshold, args("theta"),"Sets the threshold for coarsening in the algebraic multi level solver or\npreconditioner\n\n:param theta: threshold for coarsening\n:type theta: positive ``float``")
788        .def("getCoarseningThreshold", &escript::SolverBuddy::getCoarseningThreshold,"Returns the threshold for coarsening in the algebraic multi level solver\nor preconditioner\n\n:rtype: ``float``")
789        .def("setNumSweeps", &escript::SolverBuddy::setNumSweeps, args("sweeps"),"Sets the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.\n\n:param sweeps: number of sweeps\n:type sweeps: positive ``int``")
790        .def("getNumSweeps", &escript::SolverBuddy::getNumSweeps,"Returns the number of sweeps in a Jacobi or Gauss-Seidel/SOR preconditioner.\n\n:rtype: ``int``")
791        .def("setNumPreSweeps", &escript::SolverBuddy::setNumPreSweeps, args("sweeps"),"Sets the number of sweeps in the pre-smoothing step of a multi level\nsolver or preconditioner\n\n:param sweeps: number of sweeps\n:type sweeps: positive ``int``")
792        .def("getNumPreSweeps", &escript::SolverBuddy::getNumPreSweeps,"Returns he number of sweeps in the pre-smoothing step of a multi level solver or preconditioner\n\n:rtype: ``int``")
793        .def("setNumPostSweeps", &escript::SolverBuddy::setNumPostSweeps, args("sweeps"),"Sets the number of sweeps in the post-smoothing step of a multi level\nsolver or preconditioner\n\n:param sweeps: number of sweeps\n:type sweeps: positive ``int``")
794        .def("getNumPostSweeps", &escript::SolverBuddy::getNumPostSweeps,"Returns he number of sweeps in the post-smoothing step of a multi level solver or preconditioner\n\n:rtype: ``int``")
795        .def("setTolerance", &escript::SolverBuddy::setTolerance, args("rtol"),"Sets the relative tolerance for the solver\n\n:param rtol: relative tolerance\n:type rtol: non-negative ``float``")
796        .def("getTolerance", &escript::SolverBuddy::getTolerance,"Returns the relative tolerance for the solver\n\n:rtype: ``float``")
797        .def("setAbsoluteTolerance", &escript::SolverBuddy::setAbsoluteTolerance, args("atol"),"Sets the absolute tolerance for the solver\n\n:param atol:  absolute tolerance\n:type atol: non-negative ``float``")
798        .def("getAbsoluteTolerance", &escript::SolverBuddy::getAbsoluteTolerance,"Returns the absolute tolerance for the solver\n\n:rtype: ``float``")
799        .def("setInnerTolerance", &escript::SolverBuddy::setInnerTolerance, args("rtol"),"Sets the relative tolerance for an inner iteration scheme, for instance on the coarsest level in a multi-level scheme.\n\n:param rtol: inner relative tolerance\n:type rtol: positive ``float``")
800        .def("getInnerTolerance", &escript::SolverBuddy::getInnerTolerance,"Returns the relative tolerance for an inner iteration scheme\n\n:rtype: ``float``")
801        .def("setDropTolerance", &escript::SolverBuddy::setDropTolerance, args("drop_tol"),"Sets the relative drop tolerance in ILUT\n\n:param drop_tol: drop tolerance\n:type drop_tol: positive ``float``")
802        .def("getDropTolerance", &escript::SolverBuddy::getDropTolerance,"Returns the relative drop tolerance in ILUT\n\n:rtype: ``float``")
803        .def("setDropStorage", &escript::SolverBuddy::setDropStorage, args("drop"),"Sets the maximum allowed increase in storage for ILUT. ``storage`` =2 would mean that a doubling of the storage needed for the coefficient matrix is\nallowed in the ILUT factorization.\n\n:param storage: allowed storage increase\n:type storage: ``float``")
804        .def("getDropStorage", &escript::SolverBuddy::getDropStorage,"Returns the maximum allowed increase in storage for ILUT\n\n:rtype: ``float``")
805        .def("setRelaxationFactor", &escript::SolverBuddy::setRelaxationFactor, args("relaxation"),"Sets the relaxation factor used to add dropped elements in RILU to the main diagonal.\n\n:param factor: relaxation factor\n:type factor: ``float``\n:note: RILU with a relaxation factor 0 is identical to ILU0")
806        .def("getRelaxationFactor", &escript::SolverBuddy::getRelaxationFactor,"Returns the relaxation factor used to add dropped elements in RILU to the main diagonal.\n\n:rtype: ``float``")
807        .def("isSymmetric", &escript::SolverBuddy::isSymmetric,"Checks if symmetry of the coefficient matrix is indicated.\n\n:return: True if a symmetric PDE is indicated, False otherwise\n:rtype: ``bool``")
808        .def("setSymmetryOn", &escript::SolverBuddy::setSymmetryOn,"Sets the symmetry flag to indicate that the coefficient matrix is symmetric.")
809        .def("setSymmetryOff", &escript::SolverBuddy::setSymmetryOff,"Clears the symmetry flag for the coefficient matrix.")
810        .def("setSymmetry", &escript::SolverBuddy::setSymmetry, args("symmetry"),"Sets the symmetry flag for the coefficient matrix to ``flag``.\n\n:param flag: If True, the symmetry flag is set otherwise reset.\n:type flag: ``bool``")
811        .def("isVerbose", &escript::SolverBuddy::isVerbose,"Returns ``True`` if the solver is expected to be verbose.\n\n:return: True if verbosity of switched on.\n:rtype: ``bool``")
812        .def("setVerbosityOn", &escript::SolverBuddy::setVerbosityOn,"Switches the verbosity of the solver on.")
813        .def("setVerbosityOff", &escript::SolverBuddy::setVerbosityOff,"Switches the verbosity of the solver off.")
814        .def("setVerbosity", &escript::SolverBuddy::setVerbosity, args("verbosity"),"Sets the verbosity flag for the solver to ``flag``.\n\n:param verbose: If ``True``, the verbosity of the solver is switched on.\n:type verbose: ``bool``")
815        .def("adaptInnerTolerance", &escript::SolverBuddy::adaptInnerTolerance,"Returns ``True`` if the tolerance of the inner solver is selected automatically. Otherwise the inner tolerance set by `setInnerTolerance` is used.\n\n:return: ``True`` if inner tolerance adaption is chosen.\n:rtype: ``bool``")
816        .def("setInnerToleranceAdaptionOn", &escript::SolverBuddy::setInnerToleranceAdaptionOn,"Switches the automatic selection of inner tolerance on")
817        .def("setInnerToleranceAdaptionOff", &escript::SolverBuddy::setInnerToleranceAdaptionOff,"Switches the automatic selection of inner tolerance off.")
818        .def("setInnerToleranceAdaption", &escript::SolverBuddy::setInnerToleranceAdaption, args("adapt"),"Sets the flag to indicate automatic selection of the inner tolerance.\n\n:param adapt: If ``True``, the inner tolerance is selected automatically.\n:type adapt: ``bool``")
819        .def("acceptConvergenceFailure", &escript::SolverBuddy::acceptConvergenceFailure,"Returns ``True`` if a failure to meet the stopping criteria within the given number of iteration steps is not raising in exception. This is useful\nif a solver is used in a non-linear context where the non-linear solver can continue even if the returned the solution does not necessarily meet the stopping criteria. One can use the `hasConverged` method to check if the\nlast call to the solver was successful.\n\n:return: ``True`` if a failure to achieve convergence is accepted.\n:rtype: ``bool``")
820        .def("setAcceptanceConvergenceFailureOn", &escript::SolverBuddy::setAcceptanceConvergenceFailureOn,"Switches the acceptance of a failure of convergence on")
821        .def("setAcceptanceConvergenceFailureOff", &escript::SolverBuddy::setAcceptanceConvergenceFailureOff,"Switches the acceptance of a failure of convergence off.")
822        .def("setAcceptanceConvergenceFailure", &escript::SolverBuddy::setAcceptanceConvergenceFailure, args("accept"),"Sets the flag to indicate the acceptance of a failure of convergence.\n\n:param accept: If ``True``, any failure to achieve convergence is accepted.\n:type accept: ``bool``")
823        .def("useLocalPreconditioner", &escript::SolverBuddy::useLocalPreconditioner,"Returns ``True`` if the preconditoner is applied locally on each MPI. This reduces communication costs and speeds up the application of the preconditioner but at the costs of more iteration steps. This can be an advantage on clusters with slower interconnects.\n\n:return: ``True`` if local preconditioning is applied\n:rtype: ``bool``")
824        .def("setLocalPreconditionerOn", &escript::SolverBuddy::setLocalPreconditionerOn,"Sets the flag to use  local preconditioning to on")
825        .def("setLocalPreconditionerOff", &escript::SolverBuddy::setLocalPreconditionerOff,"Sets the flag to use  local preconditioning to off")
826        .def("setLocalPreconditioner", &escript::SolverBuddy::setLocalPreconditioner, args("local"),"Sets the flag to use  local preconditioning\n\n:param use: If ``True``, local preconditioning on each MPI rank is applied\n:type use: ``bool``")
827        .def("setMinCoarseMatrixSparsity", &escript::SolverBuddy::setMinCoarseMatrixSparsity, args("sparsity"),"Sets the minimum sparsity on the coarsest level. Typically a direct solver is used when the sparsity becomes bigger than the set limit.\n\n:param sparsity: minimal sparsity\n:type sparsity: ``float``")
828        .def("getMinCoarseMatrixSparsity", &escript::SolverBuddy::getMinCoarseMatrixSparsity,"Returns the minimum sparsity on the coarsest level. Typically a direct solver is used when the sparsity becomes bigger than the set limit.\n\n:return: minimal sparsity\n:rtype: ``float``")
829        .def("setNumRefinements", &escript::SolverBuddy::setNumRefinements, args("refinements"),"Sets the number of refinement steps to refine the solution when a direct solver is applied.\n\n:param refinements: number of refinements\n:type refinements: non-negative ``int``")
830        .def("getNumRefinements", &escript::SolverBuddy::getNumRefinements,"Returns the number of refinement steps to refine the solution when a direct solver is applied.\n\n:rtype: non-negative ``int``")
831        .def("setNumCoarseMatrixRefinements", &escript::SolverBuddy::setNumCoarseMatrixRefinements, args("refinements"),"Sets the number of refinement steps to refine the solution on the coarsest level when a direct solver is applied.\n\n:param refinements: number of refinements\n:type refinements: non-negative ``int``")
832        .def("getNumCoarseMatrixRefinements", &escript::SolverBuddy::getNumCoarseMatrixRefinements,"Returns the number of refinement steps to refine the solution on the coarsest level when a direct solver is applied.\n\n:rtype: non-negative ``int``")
833        .def("usePanel", &escript::SolverBuddy::usePanel,"Returns ``True`` if a panel is used to search for unknown in the AMG coarsening, The panel approach is normally faster but can lead to larger coarse level systems.\n\n:return: ``True`` if a panel is used to find unknowns in AMG coarsening\n:rtype: ``bool``")
834        .def("setUsePanelOn", &escript::SolverBuddy::setUsePanelOn,"Sets the flag to use a panel to find unknowns in AMG coarsening")
835        .def("setUsePanelOff", &escript::SolverBuddy::setUsePanelOff,"Sets the flag to use a panel to find unknowns in AMG coarsening to off")
836        .def("setUsePanel", &escript::SolverBuddy::setUsePanel, args("use"),"Sets the flag to use  a panel to find unknowns in AMG coarsening\n\n:param use: If ``True``,a panel is used to find unknowns in AMG coarsening\n:type use: ``bool``")
837        .def("setAMGInterpolation", &escript::SolverBuddy::setAMGInterpolation, args("interpolation"),"Set the interpolation method for the AMG preconditioner.\n\n:param method: key of the interpolation method to be used.\n:type method: in `CLASSIC_INTERPOLATION_WITH_FF_COUPLING`, `CLASSIC_INTERPOLATION`, `DIRECT_INTERPOLATION`")
838        .def("getAMGInterpolation", &escript::SolverBuddy::getAMGInterpolation,"Returns key of the interpolation method for the SAMG preconditioner\n\n:rtype: in the list `CLASSIC_INTERPOLATION_WITH_FF_COUPLING`, `CLASSIC_INTERPOLATION`, `DIRECT_INTERPOLATION`")
839        .def("setODESolver", &escript::SolverBuddy::setODESolver, args("solver"),"Set the solver method for ODEs.\n\n:param method: key of the ODE solver method to be used.\n:type method: in `CRANK_NICOLSON`, `BACKWARD_EULER`, `LINEAR_CRANK_NICOLSON`")
840        .def("getODESolver", &escript::SolverBuddy::getODESolver,"Returns key of the solver method for ODEs.\n\n:param method: key of the ODE solver method to be used.\n:type method: in `CRANK_NICOLSON`, `BACKWARD_EULER`, `LINEAR_CRANK_NICOLSON`");
841    
842    
843    // Functions to modify global parameters    // Functions to modify global parameters
844    def("setEscriptParamInt",escript::setEscriptParamInt,    def("setEscriptParamInt",escript::setEscriptParamInt,
845        (arg("name"), arg("value")=0), "Modify the value of an escript tuning parameter\n\n"        (arg("name"), arg("value")=0), "Modify the value of an escript tuning parameter\n\n"
# Line 718  arg("in2")) Line 866  arg("in2"))
866    //    //
867    // Register esysExceptionTranslator    // Register esysExceptionTranslator
868    //    //
869    register_exception_translator<esysUtils::EsysException>(&esysUtils::esysExceptionTranslator);    register_exception_translator<esysUtils::EsysException>(&esysUtils::RuntimeErrorTranslator);
870      register_exception_translator<escript::SolverOptionsException>(&esysUtils::ValueErrorTranslator);
871  }  }

Legend:
Removed from v.4820  
changed lines
  Added in v.4821

  ViewVC Help
Powered by ViewVC 1.1.26