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

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

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

revision 1736 by gross, Fri Jul 18 02:28:13 2008 UTC revision 1737 by gross, Fri Aug 29 03:01:29 2008 UTC
# Line 1795  class SaddlePointProblem(object): Line 1795  class SaddlePointProblem(object):
1795  #  #
1796  #      return u,p  #      return u,p
1797                        
1798  def MaskFromBoundaryTag(function_space,*tags):  def MaskFromBoundaryTag(domain,*tags):
1799     """     """
1800     create a mask on the given function space which one for samples     create a mask on the Solution(domain) function space which one for samples
1801     that touch the boundary tagged by tags.     that touch the boundary tagged by tags.
1802    
1803     usage: m=MaskFromBoundaryTag(Solution(domain),"left", "right")     usage: m=MaskFromBoundaryTag(domain,"left", "right")
1804    
1805     @param function_space: a given function space     @param domain: a given domain
1806     @type function_space: L{escript.FunctionSpace}     @type domain: L{escript.Domain}
1807     @param tags: boundray tags     @param tags: boundray tags
1808     @type tags: C{str}     @type tags: C{str}
1809     @return: a mask which marks samples used by C{function_space} that are touching the     @return: a mask which marks samples that are touching the boundary tagged by any of the given tags.
             boundary tagged by any of the given tags.  
1810     @rtype: L{escript.Data} of rank 0     @rtype: L{escript.Data} of rank 0
1811     """     """
1812     pde=linearPDEs.LinearPDE(function_space.getDomain(),numEquations=1, numSolutions=1)     pde=linearPDEs.LinearPDE(domain,numEquations=1, numSolutions=1)
1813     d=escript.Scalar(0.,escript.FunctionOnBoundary(function_space.getDomain()))     d=escript.Scalar(0.,escript.FunctionOnBoundary(function_space.getDomain()))
1814     for t in tags: d.setTaggedValue(t,1.)     for t in tags: d.setTaggedValue(t,1.)
1815     pde.setValue(y=d)     pde.setValue(y=d)
1816     out=util.whereNonZero(pde.getRightHandSide())     return util.whereNonZero(pde.getRightHandSide())
    if out.getFunctionSpace() == function_space:  
       return out  
    else:  
       return util.whereNonZero(util.interpolate(out,function_space))  
   
   
   

Legend:
Removed from v.1736  
changed lines
  Added in v.1737

  ViewVC Help
Powered by ViewVC 1.1.26