This is provided by the special `__call__` method of a CellVariable, which you 
would invoke with `var([[xval], [yval]])`.

>>> help(fp.CellVariable.__call__)

Help on method __call__ in module fipy.variables.cellVariable:

__call__(self, points=None, order=0, nearestCellIDs=None) unbound 
fipy.variables.cellVariable.CellVariable method
    Interpolates the CellVariable to a set of points using a
    method that has a memory requirement on the order of Ncells by
    Npoints in general, but uses only Ncells when the
    CellVariable's mesh is a UniformGrid object.
    
    :Parameters:
    
       - `points`: A point or set of points in the format (X, Y, Z)
       - `order`: The order of interpolation, 0 or 1, default is 0
       - `nearestCellIDs` : Optional argument if user can calculate own
         nearest cell IDs array, shape should be same as points
    
    Tests
    
        >>> from fipy import *
        >>> m = Grid2D(nx=3, ny=2)
        >>> v = CellVariable(mesh=m, value=m.cellCenters[0])
        >>> print v(((0., 1.1, 1.2), (0., 1., 1.)))
        [ 0.5  1.5  1.5]
        >>> print v(((0., 1.1, 1.2), (0., 1., 1.)), order=1)
        [ 0.25  1.1   1.2 ]
        >>> m0 = Grid2D(nx=2, ny=2, dx=1., dy=1.)
        >>> m1 = Grid2D(nx=4, ny=4, dx=.5, dy=.5)
        >>> x, y = m0.cellCenters
        >>> v0 = CellVariable(mesh=m0, value=x * y)
        >>> print v0(m1.cellCenters.globalValue)
        [ 0.25  0.25  0.75  0.75  0.25  0.25  0.75  0.75  0.75  0.75  2.25  2.25
          0.75  0.75  2.25  2.25]
        >>> print v0(m1.cellCenters.globalValue, order=1)
        [ 0.125  0.25   0.5    0.625  0.25   0.375  0.875  1.     0.5    0.875
          1.875  2.25   0.625  1.     2.25   2.625]



> On Jun 30, 2016, at 11:08 PM, 正义的小偷 <[email protected]> wrote:
> 
> Sorry for my english.
> I am new to fipy, and I have some trouble with getting value fo cellvariable.
> I want to get the value of cellVariable at a certain cell via coordinate of 
> cellCenter. The only way I know to get the value is the value property. Is 
> there any other way to get the value via coordinate ?
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to