xcompact3d / x3d2

https://xcompact3d.github.io/x3d2
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

The DIR_* and the DATA_LOC_* identifiers overlap #123

Closed pbartholomew08 closed 3 months ago

pbartholomew08 commented 3 months ago

The constants used to identify directions and data locations are both integers. The VERT=1 and CELL=2 constants overlap with the directions 1 <= DIR_* <= 4 (X,Y,Z,Cartesian) and therefore interfaces cannot discriminate incorrect uses.

Proposal: The values of the directions have a semantic meaning (maps to coordinate vector indices), the values for VERT and CELL is somewhat arbitrary, suggest choosing values that are not in the direction range to prevent accidental uses.

semi-h commented 3 months ago

Starting from

VERT=000
CELL=111

where it kind of maps to binary coding for each direction being staggered or not, the rest can be

X_FACE = 011
Y_FACE = 101
Z_FACE = 110
X_EDGE = 100
Y_EDGE = 010
Z_EDGE = 001

and then to avoid Z_EDGE==1 we can add one zero at the end of each. Pushed a commit in #124 implementing this.