/[escript]/branches/symbolic_from_3470/escript/py_src/linearPDEs.py
ViewVC logotype

Diff of /branches/symbolic_from_3470/escript/py_src/linearPDEs.py

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

revision 3269 by jfenwick, Wed Oct 13 03:21:50 2010 UTC revision 3283 by gross, Mon Oct 18 22:39:28 2010 UTC
# Line 168  class SolverOptions(object): Line 168  class SolverOptions(object):
168          self.setRelaxationFactor()                  self.setRelaxationFactor()        
169          self.setLocalPreconditionerOff()          self.setLocalPreconditionerOff()
170          self.resetDiagnostics(all=True)          self.resetDiagnostics(all=True)
171            self.setMinCoarseMatrixSparsity()
172            self.setNumRefinements()
173            self.setNumCoarseMatrixRefinements()
174            
175    
176      def __str__(self):      def __str__(self):
177          return self.getSummary()          return self.getSummary()
# Line 192  class SolverOptions(object): Line 196  class SolverOptions(object):
196                  out+="\nRestart  = %s"%self.getRestart()                  out+="\nRestart  = %s"%self.getRestart()
197              if self.getSolverMethod() == self.AMG:              if self.getSolverMethod() == self.AMG:
198                  out+="\nNumber of pre / post sweeps = %s / %s, %s"%(self.getNumPreSweeps(), self.getNumPostSweeps(), self.getNumSweeps())                  out+="\nNumber of pre / post sweeps = %s / %s, %s"%(self.getNumPreSweeps(), self.getNumPostSweeps(), self.getNumSweeps())
199                  out+="\nMaximum number of levels = %s"%self.LevelMax()                  out+="\nMaximum number of levels = %s"%self.getLevelMax()
200                  out+="\nCoarsening threshold = %e"%self.getCoarseningThreshold()                  out+="\nCoarsening threshold = %e"%self.getCoarseningThreshold()
201                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())
202              out+="\nPreconditioner = %s"%self.getName(self.getPreconditioner())              out+="\nPreconditioner = %s"%self.getName(self.getPreconditioner())
203              out+="\nApply preconditioner locally = %s"%self.useLocalPreconditioner()              out+="\nApply preconditioner locally = %s"%self.useLocalPreconditioner()
204              if self.getPreconditioner() == self.AMG:              if self.getPreconditioner() == self.AMG:
205                  out+="\nMaximum number of levels = %s"%self.LevelMax()                  out+="\nMaximum number of levels = %s"%self.getLevelMax()
206                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())
207                  out+="\nCoarsening threshold = %e"%self.getMinCoarseMatrixSize()                  out+="\nCoarsening threshold = %e"%self.getMinCoarseMatrixSize()
208                  out+="\nSmoother = %e"%self.getName(self.getSmoother())                  out+="\nSmoother = %s"%self.getName(self.getSmoother())
209                  out+="\nMinimum size of the coarsest level matrix = %e"%self.getCoarseningThreshold()                  out+="\nMinimum size of the coarsest level matrix = %e"%self.getCoarseningThreshold()
210                  out+="\nNumber of pre / post sweeps = %s / %s, %s"%(self.getNumPreSweeps(), self.getNumPostSweeps(), self.getNumSweeps())                  out+="\nNumber of pre / post sweeps = %s / %s, %s"%(self.getNumPreSweeps(), self.getNumPostSweeps(), self.getNumSweeps())
211                    out+="\nMinimal sparsity on coarsest level = %e"%(self.getMinCoarseMatrixSparsity(),)
212                    out+="\nNumber of refinement steps in coarsest level solver = %d"%(self.getNumCoarseMatrixRefinements(),)
213                    
214              if self.getPreconditioner() == self.AMLI:              if self.getPreconditioner() == self.AMLI:
215                  out+="\nMaximum number of levels = %s"%self.LevelMax()                  out+="\nMaximum number of levels = %s"%self.getLevelMax()
216                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())
217                  out+="\nCoarsening threshold = %e"%self.getMinCoarseMatrixSize()                  out+="\nCoarsening threshold = %e"%self.getMinCoarseMatrixSize()
218                  out+="\nMinimum size of the coarsest level matrix = %e"%self.getCoarseningThreshold()                  out+="\nMinimum size of the coarsest level matrix = %e"%self.getCoarseningThreshold()
# Line 607  class SolverOptions(object): Line 614  class SolverOptions(object):
614          :rtype: ``int``          :rtype: ``int``
615          """          """
616          return self.__iter_max          return self.__iter_max
617      def setLevelMax(self,level_max=5):      def setLevelMax(self,level_max=100):
618          """          """
619          Sets the maximum number of coarsening levels to be used in an algebraic multi level solver or preconditioner          Sets the maximum number of coarsening levels to be used in an algebraic multi level solver or preconditioner
620    
# Line 971  class SolverOptions(object): Line 978  class SolverOptions(object):
978              self.setUseLocalPreconditionerOn()              self.setUseLocalPreconditionerOn()
979          else:          else:
980              self.setUseLocalPreconditionerOff()              self.setUseLocalPreconditionerOff()
981                
982        def setMinCoarseMatrixSparsity(self,sparsity=0.05):
983           """
984           Sets the minimum sparsity on the coarsest level. Typically
985           a direct solver is used when the sparsity becomes bigger than
986           the set limit.
987          
988           :param sparsity: minimual sparsity
989           :type sparsity: ``float``
990           """
991           sparsity=float(sparsity)
992           if factor<0:
993         raise ValueError,"sparsity must be non-negative."
994           if factor>1:
995               raise ValueError,"sparsity must be less than 1."
996           self.__min_sparsity=factor
997        def setMinCoarseMatrixSparsity(self,sparsity=0.05):
998           """
999           Sets the minimum sparsity on the coarsest level. Typically
1000           a direct solver is used when the sparsity becomes bigger than
1001           the set limit.
1002          
1003           :param sparsity: minimual sparsity
1004           :type sparsity: ``float``
1005           """
1006           sparsity=float(sparsity)
1007           if sparsity<0:
1008         raise ValueError,"sparsity must be non-negative."
1009           if sparsity>1:
1010              raise ValueError,"sparsity must be less than 1."
1011           self.__min_sparsity=sparsity
1012    
1013        def getMinCoarseMatrixSparsity(self):
1014          """
1015          Returns the minimum sparsity on the coarsest level. Typically
1016          a direct solver is used when the sparsity becomes bigger than
1017          the set limit.
1018      
1019          :return: minimual sparsity
1020          :rtype: ``float``
1021          """
1022          return self.__min_sparsity
1023    
1024        def setNumRefinements(self,refinements=2):
1025          """
1026          Sets the number of refinement steps to refine the solution when a direct solver is applied.
1027      
1028          :param refinements: number of refinements
1029          :type refinements: non-negative ``int``
1030          """
1031          refinements=int(refinements)
1032          if refinements<0:
1033         raise ValueError,"number of refinements must be non-negative."
1034          self.__refinements=refinements
1035      
1036        def getNumRefinements(self):
1037           """
1038           Returns the number of refinement steps to refine the solution when a direct solver is applied.
1039          
1040           :rtype: non-negative ``int``
1041           """
1042           return self.__refinements
1043    
1044        def setNumCoarseMatrixRefinements(self,refinements=2):
1045          """
1046          Sets the number of refinement steps to refine the solution on the coarset level when a direct solver is applied.
1047      
1048          :param refinements: number of refinements
1049          :type refinements: non-negative ``int``
1050          """
1051          refinements=int(refinements)
1052          if refinements<0:
1053         raise ValueError,"number of refinements must be non-negative."
1054          self.__coarse_refinements=refinements
1055      
1056        def getNumCoarseMatrixRefinements(self):
1057          """
1058          Returns the number of resfinement steps to refine the solution on the coarset level when a direct solver is applied.
1059          
1060          :rtype: non-negative ``int``
1061          """
1062          return self.__coarse_refinements
1063          
1064  class IllegalCoefficient(ValueError):  class IllegalCoefficient(ValueError):
1065     """     """
1066     Exception that is raised if an illegal coefficient of the general or     Exception that is raised if an illegal coefficient of the general or

Legend:
Removed from v.3269  
changed lines
  Added in v.3283

  ViewVC Help
Powered by ViewVC 1.1.26