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

revision 637 by gross, Thu Mar 23 10:55:31 2006 UTC revision 698 by gross, Fri Mar 31 04:52:55 2006 UTC
# Line 1214  def whereZero(arg,tol=0.): Line 1214  def whereZero(arg,tol=0.):
1214        if isinstance(out,float): out=numarray.array(out,type=numarray.Float64)        if isinstance(out,float): out=numarray.array(out,type=numarray.Float64)
1215        return out        return out
1216     elif isinstance(arg,escript.Data):     elif isinstance(arg,escript.Data):
1217        if tol>0.:        return arg._whereZero(tol)
return whereNegative(abs(arg)-tol)
else:
return arg._whereZero()
1218     elif isinstance(arg,float):     elif isinstance(arg,float):
1219        if abs(arg)<=tol:        if abs(arg)<=tol:
1220          return 1.          return 1.
# Line 1297  def whereNonZero(arg,tol=0.): Line 1294  def whereNonZero(arg,tol=0.):
1294        if isinstance(out,float): out=numarray.array(out,type=numarray.Float64)        if isinstance(out,float): out=numarray.array(out,type=numarray.Float64)
1295        return out        return out
1296     elif isinstance(arg,escript.Data):     elif isinstance(arg,escript.Data):
1297        if tol>0.:        return arg._whereNonZero(tol)
return 1.-whereZero(arg,tol)
else:
return arg._whereNonZero()
1298     elif isinstance(arg,float):     elif isinstance(arg,float):
1299        if abs(arg)>tol:        if abs(arg)>tol:
1300          return 1.          return 1.

Legend:
 Removed from v.637 changed lines Added in v.698