Changeset 5311


Ignore:
Timestamp:
Apr 24, 2015, 10:25:12 PM (4 years ago)
Author:
ldelgass
Message:

Check for valid deltas in DX

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nanovis/trunk/dxReader.cpp

    r4897 r5311  
    6262
    6363    Rappture::MeshTri2D xymesh;
    64     int dummy, nx, ny, nz, nxy, npts;
     64    int dummy, nx, ny, nz, nxy, npts, naxes;
    6565    // origin
    6666    double x0, y0, z0;
     
    7777    dx = dy = dz = 0.0;
    7878    x0 = y0 = z0 = 0.0; // May not have an origin line.
    79     nx = ny = nz = npts = nxy = 0;
     79    nx = ny = nz = npts = nxy = naxes = 0;
    8080    while (!fin.eof()) {
    8181        fin.getline(line, sizeof(line) - 1);
     
    185185                    return NULL;
    186186                }
     187                naxes++;
    187188            } else if (sscanf(start, "object %d class array type %s rank 0 items %d data follows",
    188189                              &dummy, type, &npts) == 3) {
     
    209210    }
    210211
    211     TRACE("found nx=%d ny=%d nxy=%d nz=%d\ndx=%g dy=%g dz=%g\nx0=%g y0=%g z0=%g",
    212           nx, ny, nxy, nz, dx, dy, dz, x0, y0, z0);
     212    TRACE("found nx=%d ny=%d nxy=%d nz=%d\nnaxes=%d dx=%g dy=%g dz=%g\nx0=%g y0=%g z0=%g",
     213          nx, ny, nxy, nz, naxes, dx, dy, dz, x0, y0, z0);
     214
     215    if (npts > 1 && naxes == 0) {
     216        ERROR("Invalid DX file: no deltas found");
     217        return NULL;
     218    }
     219    if (npts > 1 && ((dx == dy) && (dx == dz) && (dx == 0.0))) {
     220        ERROR("Invalid deltas in DX file: %g %g %g", dx, dy, dz);
     221        return NULL;
     222    }
    213223
    214224    lx = (nx - 1) * dx;
Note: See TracChangeset for help on using the changeset viewer.