On Jun 20, 2013, at 1:22 PM, Ryan Smith <[email protected]> wrote:

> I don't understand the result of 18 being the index if the length of each 
> component of mesh.cellCenters.value is 16. So, it seems the biggest problem 
> here is that I don't fully understand the use of numerix.nearest(). But, if 
> numerix.nearest did work, then I would have used numerix.take() to get the 
> value of the velocity vector given the indices from numerix.nearest().

The purpose of numerix.nearest() is to "find the indices of `data` that are 
closest to `points`". Both `data` and `points` are expected to be fields of 
rank-1 vectors, such as returned by mesh.cellCenters.

Where is the scalar .3 closest to a field of 2D coordinates? I have no idea. 
Apparently, it's at 18. FiPy is doing its best to answer a question it doesn't 
understand.

Where is the coordinate [[.3], [.5]] closest to that same field of coordinates? 
That I can answer. It's at mesh.cellCenters.value[..., 5], or [[.25], 
[0.58333333]].

Your first case doesn't work because x = array([11,12,13]) is not an array of 
rank-1 vectors; it's an array of rank-0 scalars.


_______________________________________________
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