On Wed, Mar 28, 2012 at 6:41 PM, Igor <[email protected]> wrote:

> Dear all,
>
> Sorry for stupid question, but how to do the same as below, but if v
> is defined on mesh=Grid1D?
>
> I thought that v((2.5,)) or v(points=(2.5,)) would work, but I get
> IndexError: 0-d arrays can't be indexed.
>

Use a (mesh.dim, N) shaped array. That means for a 1D mesh, you need a (1,
N) shaped array where N is the number of points for which the value is
required. So In this case use,

   >>> import fipy
   >>> m = fipy.Grid1D(nx=3)
   >>> v = fipy.CellVariable(mesh=m, value=m.getCellCenters()[0])
   >>> a = fipy.numerix.array([[2.5]])
   >>> a.shape
   (1, 1)
   >>> v(a)
   array([ 2.5])

Cheers

-- 
Daniel Wheeler
_______________________________________________
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