gimic icon indicating copy to clipboard operation
gimic copied to clipboard

definition of 2D / 3D grid

Open lnw opened this issue 7 years ago • 3 comments

Another case where the input file is evaluated differently from what I would expect: For an std grid, the basis vectors i, j, and k are not on an equal footing.

Specifically, if I define: Grid(std) { type=even origin=[18.0, 0.0, 0.0] ivec=[1.0, 0.0, 0.0]
jvec=[0.0, 1.0, 0.0]
lengths=[26.0, 12.0, 0.0]
spacing=[0.5, 0.5, 0.5] }

I get a 2D grid in the xy plane as I would have expected. However, if I choose

Grid(std) { type=even origin=[18.0, 0.0, 0.0] ivec=[1.0, 0.0, 0.0]
jvec=[0.0, 1.0, 0.0] lengths=[26.0, 0.0, 12.0] spacing=[0.5, 0.5, 0.5] }

in order to get a 2D grid in the xz plane, then I get a 3D grid, defined by 8 points (which consists of four pairs of equal points).

This might not be a bug, but it's very unexpected and hard to understand to the uninitiated ...

lnw avatar Oct 09 '18 18:10 lnw

You define ivec as x and jvec as y but you want an xz plane. This is not working. Try to define jvec as z (0 0 1) and see if this solves your problem.

heikef avatar Oct 09 '18 19:10 heikef

Yes, that works, but it would be natural to assume that the above settings work as well. Is there an implicit rule, that a 2D grid must be spanned by i and j, while k is the third vector that spans the cuboid? I would suggest to either silently assume that when one length is zero, the other two vectors are spanning a plane, independently of which two they are, or return an error when one length of a cuboid is zero. While I'm at it: When you chose a non-zero number of points in a direction with zero-length, we need an error message :)

lnw avatar Oct 09 '18 19:10 lnw

You are welcome to add improvements. It is an open source project. :)

heikef avatar Oct 11 '18 14:10 heikef