/[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 3379 by gross, Wed Nov 24 04:48:49 2010 UTC revision 3402 by gross, Tue Dec 7 07:36:12 2010 UTC
# Line 176  class SolverOptions(object): Line 176  class SolverOptions(object):
176          self.setNumCoarseMatrixRefinements()          self.setNumCoarseMatrixRefinements()
177          self.setUsePanel()          self.setUsePanel()
178          self.setUseDirectInterpolation()          self.setUseDirectInterpolation()
179            self.setDiagonalDominanceThreshold()
180                    
181    
182      def __str__(self):      def __str__(self):
# Line 216  class SolverOptions(object): Line 217  class SolverOptions(object):
217                  out+="\nNumber of refinement steps in coarsest level solver = %d"%(self.getNumCoarseMatrixRefinements(),)                  out+="\nNumber of refinement steps in coarsest level solver = %d"%(self.getNumCoarseMatrixRefinements(),)
218                  out+="\nUse node panel = %s"%(self.usePanel())                  out+="\nUse node panel = %s"%(self.usePanel())
219                  out+="\nUse direct interpolation only = %s"%(self.useDirectInterpolation())                  out+="\nUse direct interpolation only = %s"%(self.useDirectInterpolation())
220                    out+="\nThreshold for diagonal dominant rows = %s"%(setDiagonalDominanceThreshold(),)
221    
222              if self.getPreconditioner() == self.AMLI:              if self.getPreconditioner() == self.AMLI:
223                  out+="\nMaximum number of levels = %s"%self.getLevelMax()                  out+="\nMaximum number of levels = %s"%self.getLevelMax()
# Line 333  class SolverOptions(object): Line 335  class SolverOptions(object):
335              self.__converged = (value == True)              self.__converged = (value == True)
336          if name == "time_step_backtracking_used":          if name == "time_step_backtracking_used":
337              self.__time_step_backtracking_used = (value == True)              self.__time_step_backtracking_used = (value == True)
338            if name == "coarse_level_sparsity":
339               self.__coarse_level_sparsity = value
340        if name == "num_coarse_unknowns":
341               self.__num_coarse_unknowns= value
342      def getDiagnostics(self, name):      def getDiagnostics(self, name):
343          """          """
344          Returns the diagnostic information ``name``. Possible values are:          Returns the diagnostic information ``name``. Possible values are:
# Line 349  class SolverOptions(object): Line 355  class SolverOptions(object):
355          - "net_time": net execution time, excluding setup time for the solver and execution time for preconditioner          - "net_time": net execution time, excluding setup time for the solver and execution time for preconditioner
356          - "cum_net_time": cumulative net execution time          - "cum_net_time": cumulative net execution time
357          - "preconditioner_size": size of preconditioner [Bytes]          - "preconditioner_size": size of preconditioner [Bytes]
358          - "converged": return self.__converged          - "converged": return True if solution has converged.
359          - "time_step_backtracking_used": return self.__converged          - "time_step_backtracking_used": returns True if time step back tracking has been used.
360            - "coarse_level_sparsity": returns the sparsity of the matrix on the coarsest level
361            - "num_coarse_unknowns": returns the number of unknowns on the coarsest level
362            
363                    
364          :param name: name of diagnostic information to return          :param name: name of diagnostic information to return
# Line 373  class SolverOptions(object): Line 381  class SolverOptions(object):
381          elif name == "converged": return self.__converged                elif name == "converged": return self.__converged      
382          elif name == "preconditioner_size": return  self.__preconditioner_size          elif name == "preconditioner_size": return  self.__preconditioner_size
383          elif name == "time_step_backtracking_used": return  self.__time_step_backtracking_used          elif name == "time_step_backtracking_used": return  self.__time_step_backtracking_used
384            elif name == "coarse_level_sparsity": return self.__coarse_level_sparsity
385            elif name == "num_coarse_unknowns": return self.__num_coarse_unknowns
386          else:          else:
387              raise ValueError,"unknown diagnostic item %s"%name              raise ValueError,"unknown diagnostic item %s"%name
388      def hasConverged(self):      def hasConverged(self):
# Line 567  class SolverOptions(object): Line 577  class SolverOptions(object):
577              return -1              return -1
578              else:              else:
579              return r              return r
580      
581        def setDiagonalDominanceThreshold(self,value=0.5):
582            """
583            Sets the threshold for diagonal dominant rows which are eliminated during AMG coarsening.
584    
585         :param value: threshold
586         :type value: ``float``
587            """
588            value=float(value)
589            if value<0 or value>1.:
590           raise ValueError,"Diagonal dominance threshold must be between 0 and 1."
591        self.__diagonal_dominance_threshold=value
592            
593        def getDiagonalDominanceThreshold(self):
594            """
595            Returns the threshold for diagonal dominant rows which are eliminated during AMG coarsening.
596    
597            :rtype: ``float``
598            """
599            return self.__diagonal_dominance_threshold
600            
601      def setTruncation(self,truncation=20):      def setTruncation(self,truncation=20):
602          """          """
603          Sets the number of residuals in GMRES to be stored for orthogonalization.  The more residuals are stored          Sets the number of residuals in GMRES to be stored for orthogonalization.  The more residuals are stored

Legend:
Removed from v.3379  
changed lines
  Added in v.3402

  ViewVC Help
Powered by ViewVC 1.1.26