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

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

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

revision 1717 by gross, Thu Aug 21 05:24:35 2008 UTC revision 1719 by gross, Thu Aug 21 06:24:29 2008 UTC
# Line 5183  def getClosestValue(arg,origin=0): Line 5183  def getClosestValue(arg,origin=0):
5183      """      """
5184      return arg.getValueOfGlobalDataPoint(*(length(arg-origin).minGlobalDataPoint()))      return arg.getValueOfGlobalDataPoint(*(length(arg-origin).minGlobalDataPoint()))
5185    
5186    def normalize(arg,zerolength=0):
5187        """
5188        returns normalized version of arg (=arg/length(arg))
5189        
5190        @param arg: function
5191        @type arg: L{escript.Data} or L{Symbol}
5192        @param zerolength: realitive tolerance for arg == 0.
5193        @type zerolength: C{float}
5194        @return: normalized arg where arg is non zero and zero elsewhere
5195        @rtype: L{escript.Data} or L{Symbol}
5196        """
5197        l=length(arg)
5198        m=whereZero(l,zerolength*Lsup(l))
5199        mm=1-m
5200        return arg*(mm/(l*mm+m))
5201    
5202  #=============================  #=============================
5203  #  #
5204    

Legend:
Removed from v.1717  
changed lines
  Added in v.1719

  ViewVC Help
Powered by ViewVC 1.1.26