Ignore:
Timestamp:
Dec 22, 2014, 4:18:59 AM (10 years ago)
Author:
ldelgass
Message:

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nanovis/branches/1.1/VtkReader.cpp

    r4889 r4904  
    88#include <float.h>
    99
    10 #include <RpOutcome.h>
    1110#include <RpField1D.h>
    1211#include <RpFieldRect3D.h>
     
    1615#include "ReaderCommon.h"
    1716
     17#include "config.h"
    1818#include "nanovis.h"
    1919#include "VtkReader.h"
     
    183183
    184184Volume *
    185 nv::load_vtk_volume_stream(Rappture::Outcome& result, const char *tag, std::iostream& fin)
     185nv::load_vtk_volume_stream(const char *tag, std::iostream& fin)
    186186{
    187187    TRACE("Enter tag:%s", tag);
     
    207207        fin.getline(line, sizeof(line) - 1);
    208208        if (fin.fail()) {
    209             result.error("Error in data stream");
     209            ERROR("Error in data stream");
    210210            return NULL;
    211211        }
     
    222222                    isRect = 1;
    223223                } else {
    224                     result.addError("Unsupported DataSet type '%s'", str);
     224                    ERROR("Unsupported DataSet type '%s'", str);
    225225                    return NULL;
    226226                }
    227227            } else if (sscanf(start, "DIMENSIONS %d %d %d", &nx, &ny, &nz) == 3) {
    228228                if (nx <= 0 || ny <= 0 || nz <= 0) {
    229                     result.error("Found non-positive dimensions");
     229                    ERROR("Found non-positive dimensions");
    230230                    return NULL;
    231231                }
     
    235235            } else if (sscanf(start, "SPACING %lg %lg %lg", &dx, &dy, &dz) == 3) {
    236236                if ((nx > 1 && dx == 0.0) || (ny > 1 && dy == 0.0) || (nz > 1 && dz == 0.0)) {
    237                     result.error("Found zero spacing for dimension");
     237                    ERROR("Found zero spacing for dimension");
    238238                    return NULL;
    239239                }
     
    241241            } else if (sscanf(start, "POINT_DATA %d", &npts) == 1) {
    242242                if (npts < 1 || npts != nx * ny * nz) {
    243                     result.addError("Error in data stream: unexpected number of point data: %d", npts);
     243                    ERROR("Error in data stream: unexpected number of point data: %d", npts);
    244244                    return NULL;
    245245                }
    246246                if (isBinary < 0 || fin.eof()) {
    247247                    // Should know if ASCII or BINARY by now
    248                     result.error("Error in data stream");
     248                    ERROR("Error in data stream");
    249249                    return NULL;
    250250                }
    251251                fin.getline(line, sizeof(line) - 1);
    252252                if (fin.fail()) {
    253                     result.error("Error in data stream");
     253                    ERROR("Error in data stream");
    254254                    return NULL;
    255255                }
     
    257257                    ;  // skip leading blanks
    258258                if (sscanf(start, "SCALARS %s %s", str, type) != 2) {
    259                     result.error("Error in data stream");
     259                    ERROR("Error in data stream");
    260260                    return NULL;
    261261                }
     
    267267                    ftype = UCHAR;
    268268                    if (!isBinary) {
    269                         result.addError("unsigned char only supported in binary VTK files");
     269                        ERROR("unsigned char only supported in binary VTK files");
    270270                        return NULL;
    271271                    }
     
    279279                    ftype = UINT;
    280280                } else {
    281                     result.addError("Unsupported scalar type: '%s'", type);
     281                    ERROR("Unsupported scalar type: '%s'", type);
    282282                    return NULL;
    283283                }
    284284                if (fin.eof()) {
    285                     result.error("Error in data stream");
     285                    ERROR("Error in data stream");
    286286                    return NULL;
    287287                }
    288288                fin.getline(line, sizeof(line) - 1);
    289289                if (fin.fail()) {
    290                     result.error("Error in data stream");
     290                    ERROR("Error in data stream");
    291291                    return NULL;
    292292                }
     
    296296                    // skip lookup table, but don't read ahead
    297297                    if (fin.eof()) {
    298                         result.error("Error in data stream");
     298                        ERROR("Error in data stream");
    299299                        return NULL;
    300300                    }
    301301                } else {
    302302                    // Lookup table line is required
    303                     result.error("Missing LOOKUP_TABLE");
     303                    ERROR("Missing LOOKUP_TABLE");
    304304                    return NULL;
    305305                }
     
    310310                    if (fin.fail()) {
    311311                        deleteFieldData(fieldData, ftype);
    312                         result.error("Error in data stream");
     312                        ERROR("Error in data stream");
    313313                        return NULL;
    314314                    }
     
    320320                        if (fin.fail()) {
    321321                            deleteFieldData(fieldData, ftype);
    322                             result.error("Error in data stream");
     322                            ERROR("Error in data stream");
    323323                            return NULL;
    324324                        }
     
    333333    if (isRect < 0 || numRead != npts || npts < 1) {
    334334        deleteFieldData(fieldData, ftype);
    335         result.error("Error in data stream");
     335        ERROR("Error in data stream");
    336336        return NULL;
    337337    }
     
    468468    } else {
    469469        deleteFieldData(fieldData, ftype);
    470         result.error("Unsupported DataSet");
     470        ERROR("Unsupported DataSet");
    471471        return NULL;
    472472    }
     
    495495    float dz0 = -0.5*lz/lx;
    496496    if (volume) {
    497         volume->location(vrmath::Vector3f(dx0, dy0, dz0));
    498         TRACE("Set volume location to %g %g %g", dx0, dy0, dz0);
     497        volume->setPosition(vrmath::Vector3f(dx0, dy0, dz0));
     498        TRACE("Set volume position to %g %g %g", dx0, dy0, dz0);
    499499    }
    500500    return volume;
Note: See TracChangeset for help on using the changeset viewer.