Changeset 5305


Ignore:
Timestamp:
Apr 24, 2015, 7:56:15 PM (5 years ago)
Author:
ldelgass
Message:

Check for missing/zero deltas in DX

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/src/RpDxToVtk.c

    r4502 r5305  
    386386    points = NULL;
    387387    nAxes = nPoints = nXYPoints = nCells = 0;
    388     dx = dy = dz = 0.0; /* Suppress compiler warning. */
     388    dx = dy = dz = 0.0;
    389389    origin[0] = origin[1] = origin[2] = 0.0; /* May not have an origin line. */
    390390    dv0[0] = dv0[1] = dv0[2] = 0.0;
    391391    dv1[0] = dv1[1] = dv1[2] = 0.0;
    392392    dv2[0] = dv2[1] = dv2[2] = 0.0;
    393     count[0] = count[1] = count[2] = 0; /* Suppress compiler warning. */
     393    count[0] = count[1] = count[2] = 0;
    394394    isUniform = 0;
    395395    isStructuredGrid = 0;
     
    596596
    597597    if (isUniform) {
     598        if (nPoints > 1 && nAxes == 0) {
     599            fprintf(stderr, "Invalid DX file: uniform grid with no deltas found\n");
     600            return TCL_ERROR;
     601        }
     602        if (nPoints > 1 && (dx == dy == dz == 0.0)) {
     603            fprintf(stderr, "Invalid deltas in DX file: %g %g %g\n", dx, dy, dz);
     604            return TCL_ERROR;
     605        }
    598606        objPtr = Tcl_NewStringObj("# vtk DataFile Version 2.0\n", -1);
    599607        Tcl_AppendToObj(objPtr, "Converted from DX file\n", -1);
Note: See TracChangeset for help on using the changeset viewer.