/[escript]/trunk/escript/py_src/linearPDEs.py
ViewVC logotype

Diff of /trunk/escript/py_src/linearPDEs.py

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

revision 2523 by gross, Thu Jun 18 06:50:37 2009 UTC revision 2524 by artak, Wed Jul 8 00:39:26 2009 UTC
# Line 94  class SolverOptions(object): Line 94  class SolverOptions(object):
94      @cvar YAIR_SHAPIRA_COARSENING: AMG coarsening method by Yair-Shapira      @cvar YAIR_SHAPIRA_COARSENING: AMG coarsening method by Yair-Shapira
95      @cvar RUGE_STUEBEN_COARSENING: AMG coarsening method by Ruge and Stueben      @cvar RUGE_STUEBEN_COARSENING: AMG coarsening method by Ruge and Stueben
96      @cvar AGGREGATION_COARSENING: AMG coarsening using (symmetric) aggregation      @cvar AGGREGATION_COARSENING: AMG coarsening using (symmetric) aggregation
97        @cvar MIN_COARSE_MATRIX_SIZE: minimum size of the coarsest level matrix to use direct solver.
98      @cvar NO_PRECONDITIONER: no preconditioner is applied.      @cvar NO_PRECONDITIONER: no preconditioner is applied.
99      """      """
100      DEFAULT= 0      DEFAULT= 0
# Line 132  class SolverOptions(object): Line 133  class SolverOptions(object):
133      RUGE_STUEBEN_COARSENING=34      RUGE_STUEBEN_COARSENING=34
134      AGGREGATION_COARSENING=35      AGGREGATION_COARSENING=35
135      NO_PRECONDITIONER=36      NO_PRECONDITIONER=36
136        MIN_COARSE_MATRIX_SIZE=37
137        
138      def __init__(self):      def __init__(self):
139          self.setLevelMax()          self.setLevelMax()
140          self.setCoarseningThreshold()          self.setCoarseningThreshold()
# Line 156  class SolverOptions(object): Line 159  class SolverOptions(object):
159          self.setSolverMethod()          self.setSolverMethod()
160          self.setPreconditioner()          self.setPreconditioner()
161          self.setCoarsening()          self.setCoarsening()
162            self.setMinCoarseMatrixSize()
163          self.setRelaxationFactor()                  self.setRelaxationFactor()        
164          self.resetDiagnostics(all=True)          self.resetDiagnostics(all=True)
165    
# Line 189  class SolverOptions(object): Line 193  class SolverOptions(object):
193              if self.getPreconditioner() == self.AMG:              if self.getPreconditioner() == self.AMG:
194                  out+="\nMaximum number of levels = %s"%self.LevelMax()                  out+="\nMaximum number of levels = %s"%self.LevelMax()
195                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())                  out+="\nCoarsening method = %s"%self.getName(self.getCoarsening())
196                  out+="\nCoarsening threshold = %e"%self.getCoarseningThreshold()                  out+="\nCoarsening threshold = %e"%self.getMinCoarseMatrixSize()
197                    out+="\nMinimum size of the coarsest level matrix = %e"%self.getCoarseningThreshold()
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              if self.getPreconditioner() == self.GAUSS_SEIDEL:              if self.getPreconditioner() == self.GAUSS_SEIDEL:
200                  out+="\nNumber of sweeps = %s"%self.getNumSweeps()                  out+="\nNumber of sweeps = %s"%self.getNumSweeps()
# Line 242  class SolverOptions(object): Line 247  class SolverOptions(object):
247          if key == self.RUGE_STUEBEN_COARSENING: return "RUGE_STUEBEN_COARSENING"          if key == self.RUGE_STUEBEN_COARSENING: return "RUGE_STUEBEN_COARSENING"
248          if key == self.AGGREGATION_COARSENING: return "AGGREGATION_COARSENING"          if key == self.AGGREGATION_COARSENING: return "AGGREGATION_COARSENING"
249          if key == self.NO_PRECONDITIONER: return "NO_PRECONDITIONER"          if key == self.NO_PRECONDITIONER: return "NO_PRECONDITIONER"
250            if key == self.MIN_COARSE_MATRIX_SIZE: return "MIN_COARSE_MATRIX_SIZE"
251                    
252      def resetDiagnostics(self,all=False):      def resetDiagnostics(self,all=False):
253          """          """
# Line 341  class SolverOptions(object): Line 347  class SolverOptions(object):
347          if not method in [self.DEFAULT, self.YAIR_SHAPIRA_COARSENING, self.RUGE_STUEBEN_COARSENING, self.AGGREGATION_COARSENING]:          if not method in [self.DEFAULT, self.YAIR_SHAPIRA_COARSENING, self.RUGE_STUEBEN_COARSENING, self.AGGREGATION_COARSENING]:
348               raise ValueError,"unknown coarsening method %s"%method               raise ValueError,"unknown coarsening method %s"%method
349          self.__coarsening=method          self.__coarsening=method
350        
351      def getCoarsening(self):      def getCoarsening(self):
352          """          """
353          Returns the key of the coarsening algorithm to be applied AMG.          Returns the key of the coarsening algorithm to be applied AMG.
# Line 349  class SolverOptions(object): Line 356  class SolverOptions(object):
356          L{SolverOptions.RUGE_STUEBEN_COARSENING}, L{SolverOptions.AGGREGATION_COARSENING}          L{SolverOptions.RUGE_STUEBEN_COARSENING}, L{SolverOptions.AGGREGATION_COARSENING}
357          """          """
358          return self.__coarsening          return self.__coarsening
359          
360        def setMinCoarseMatrixSize(self,size=500):
361            """
362            Sets the minumum size of the coarsest level matrix in AMG.
363    
364            @param size: minumum size of the coarsest level matrix .
365            @type size: positive C{int} or C{None}
366            """
367            size=int(size)
368            if size<0:
369               raise ValueError,"minumum size of the coarsest level matrix must be non-negative."
370        if size==None: size=500
371            self.__MinCoarseMatrixSize=size
372            
373        def getMinCoarseMatrixSize(self):
374            """
375            Returns the minumum size of the coarsest level matrix in AMG.
376    
377            @rtype: C{int}
378            """
379            return self.__MinCoarseMatrixSize
380          
381      def setPreconditioner(self, preconditioner=10):      def setPreconditioner(self, preconditioner=10):
382          """          """
383          Sets the preconditioner to be used.          Sets the preconditioner to be used.

Legend:
Removed from v.2523  
changed lines
  Added in v.2524

  ViewVC Help
Powered by ViewVC 1.1.26