Don't generate out-of-bounds ACTNUM references when inspecting ZCORN monotonicity.

The C parsing rules (effectively) impose a "maximal munch" strategy.
When iterating over the cell-nodes (i.e., ZCORN), the coordinate map
integer division *must* apply to the iterators and not to a product of
the form N*it.  Enforce this interpretation by explicit parentheses.
This commit is contained in:
Bård Skaflestad
2012-03-02 17:42:26 +01:00
parent 833182329f
commit da19df122f
+2 -2
View File
@@ -457,8 +457,8 @@ void process_grdecl(const struct grdecl *in,
double z1 = sign*in->zcorn[i+2*nx*(j+2*ny*(k))];
double z2 = sign*in->zcorn[i+2*nx*(j+2*ny*(k+1))];
int c1 = i/2 + nx*(j/2 + ny*k/2);
int c2 = i/2 + nx*(j/2 + ny*(k+1)/2);
int c1 = i/2 + nx*(j/2 + ny*(k/2));
int c2 = i/2 + nx*(j/2 + ny*((k+1)/2));
if (in->actnum[c1] && in->actnum[c2] && (z2 < z1)){
fprintf(stderr, "\nZCORN should be strictly nondecreasing along pillars!\n");