On Aug 15, 2008, at 3:17 PM, Tony S Yu wrote:

A quick fix is to change the origin you're adding to the mesh.

Thanks very much for offering the solution, Tony. Daniel and I were both out last week, so it's great when FiPy users can help each other out.


As the traceback shows, the code is trying to add centers (reshaped into a 2 x N matrix) with the new origin. So thinking in terms of numpy arrays, you should be adding a 2 x 1 vector to get the correct output. In other words:

>>> mesh2=mesh1+ array([[0.],[2.]])

The array() shouldn't be necessary. `[[0.],[2.]]` or `((0.,),(2.,))` should do it.

This change gives me the expected output. You could argue that FiPy should coerce `origin` to this format automatically, but then again such input handling can often lead to annoying and hard to find bugs. I'm sure the FiPy developers would know better than I do.

We'll take a look at it. We presently don't do any work to determine what the offset "means". In FiPy 1.2 and earlier, the coordinates were specified as `(0,2)` the way Zhiwen was doing. One consequence of the array re-ordering we did since then was that the "correct" shape of the offset is now `((0,),(2,))`. I agree, though, that it's clumsy and that supporting its transpose doesn't seem likely to be ambiguous.


Reply via email to