Changeset 1458 for trunk/packages


Ignore:
Timestamp:
May 19, 2009, 2:44:49 PM (15 years ago)
Author:
gah
Message:
 
Location:
trunk/packages/vizservers/nanovis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r1457 r1458  
    7272Rappture::SwitchSpec FlowParticles::_switches[] = {
    7373    {Rappture::SWITCH_CUSTOM, "-axis", "string",
    74      offsetof(FlowParticlesValues, position.axis), 0, 0, &axisSwitch},
     74        offsetof(FlowParticlesValues, position.axis), 0, 0, &axisSwitch},
    7575    {Rappture::SWITCH_CUSTOM, "-color", "{r g b a}",
    76      offsetof(FlowParticlesValues, color), 0, 0,  &colorSwitch},
     76        offsetof(FlowParticlesValues, color), 0, 0,  &colorSwitch},
    7777    {Rappture::SWITCH_BOOLEAN, "-hide", "boolean",
    78      offsetof(FlowParticlesValues, isHidden), 0},
     78        offsetof(FlowParticlesValues, isHidden), 0},
    7979    {Rappture::SWITCH_CUSTOM, "-position", "number",
    80         offsetof(FlowValues, slicePos), 0, 0, &positionSwitch},
     80        offsetof(FlowParticlesValues, position), 0, 0, &positionSwitch},
    8181    {Rappture::SWITCH_END}
    8282};
     
    8484Rappture::SwitchSpec FlowBox::_switches[] = {
    8585    {Rappture::SWITCH_CUSTOM, "-color", "{r g b a}",
    86      offsetof(FlowBoxValues, color), 0, 0,  &colorSwitch},
     86        offsetof(FlowBoxValues, color), 0, 0,  &colorSwitch},
    8787    {Rappture::SWITCH_CUSTOM, "-corner1", "{x y z}",
    88      offsetof(FlowBoxValues, corner1), 0, 0, &pointSwitch},
     88        offsetof(FlowBoxValues, corner1), 0, 0, &pointSwitch},
    8989    {Rappture::SWITCH_CUSTOM, "-corner2", "{x y z}",
    90      offsetof(FlowBoxValues, corner2), 0, 0, &pointSwitch},
     90        offsetof(FlowBoxValues, corner2), 0, 0, &pointSwitch},
    9191    {Rappture::SWITCH_BOOLEAN, "-hide", "boolean",
    92      offsetof(FlowBoxValues, isHidden), 0},
     92        offsetof(FlowBoxValues, isHidden), 0},
    9393    {Rappture::SWITCH_FLOAT, "-linewidth", "number",
    94      offsetof(FlowBoxValues, lineWidth), 0},
     94        offsetof(FlowBoxValues, lineWidth), 0},
    9595    {Rappture::SWITCH_END}
    9696};
     
    118118FlowParticles::Render(void)
    119119{
    120     Trace("rendering particles %s\n", _name);
    121     Trace("rendering particles %s axis=%d\n", _name, _sv.position.axis);
    122     Trace("rendering particles %s position=%g\n", _name, _sv.position.value);
    123     Trace("rendering particles %s position=%g\n", _name,
    124           FlowCmd::GetRelativePosition(&_sv.position));
    125 
    126120    _rendererPtr->setPos(FlowCmd::GetRelativePosition(&_sv.position));
    127121    _rendererPtr->setAxis(_sv.position.axis);
     
    691685
    692686        dataPtr = new Rappture::Unirect3d(nComponents);
    693         if (!dataPtr->ImportDx(result, nComponents, buf.size(),
    694                 (char *)buf.bytes())) {
     687        if (!dataPtr->ImportDx(result, nComponents, length-4, bytes+4)) {
    695688            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    696689            delete dataPtr;
     
    710703        cmdInfo.objClientData = (ClientData)dataPtr;   
    711704        Tcl_SetCommandInfo(interp, "unirect3d", &cmdInfo);
    712         if (Tcl_Eval(interp, (const char *)buf.bytes()+11) != TCL_OK) {
     705        if (Tcl_Eval(interp, (const char *)bytes+11) != TCL_OK) {
    713706            delete dataPtr;
    714707            return TCL_ERROR;
     
    731724        cmdInfo.objClientData = (ClientData)dataPtr;   
    732725        Tcl_SetCommandInfo(interp, "unirect2d", &cmdInfo);
    733         if (Tcl_Eval(interp, (const char *)buf.bytes()+11) != TCL_OK) {
     726        if (Tcl_Eval(interp, (const char *)bytes+11) != TCL_OK) {
    734727            delete dataPtr;
    735728            return TCL_ERROR;
     
    746739        Rappture::Unirect3d *dataPtr;
    747740
    748         fprintf(stderr, "header is %.14s\n", buf.bytes());
     741        fprintf(stderr, "header is %.14s\n", bytes);
    749742        dataPtr = new Rappture::Unirect3d(nComponents);
    750         if (!dataPtr->ImportDx(result, nComponents, buf.size(),
    751                 (char *)buf.bytes())) {
     743        if (!dataPtr->ImportDx(result, nComponents, length,  bytes)) {
    752744            Tcl_AppendResult(interp, result.remark(), (char *)NULL);
    753745            delete dataPtr;
  • trunk/packages/vizservers/nanovis/FlowCmd.h

    r1434 r1458  
    1515
    1616struct FlowParticlesValues {
    17     int isHidden;                       /* Indicates if particle injection
    18                                          * plane is active or not. */
    1917    FlowPosition position;              /* Position on axis of particle
    2018                                         * plane */
    2119    FlowColor color;                    /* Color of particles */
     20    int isHidden;                       /* Indicates if particle injection
     21                                         * plane is active or not. */
    2222};
    2323
     
    9696
    9797struct FlowBoxValues {
    98     int isHidden;                       /* Indicates if particle injection
    99                                          * plance is active or not. */
    10098    float position;                     /* Position on axis of particle
    10199                                         * plane */
     
    104102    FlowColor color;                    /* Color of particles */
    105103    float lineWidth;
     104    int isHidden;                       /* Indicates if particle injection
     105                                         * plance is active or not. */
    106106};
    107107
  • trunk/packages/vizservers/nanovis/Unirect.cpp

    r1453 r1458  
    242242    }
    243243    _initialized = true;
     244#ifdef notdef
    244245    {
    245246        FILE *f;
     
    255256        fclose(f);
    256257    }
     258#endif
    257259    return TCL_OK;
    258260}
     
    407409                "wrong number of values: must be xnum*ynum*components",
    408410                         (char *)NULL);
    409         fprintf(stderr, "x=%d y=%d c=%d, nv=%d\n",
    410                 _xNum, _yNum, _nComponents, _nValues);
    411411        return TCL_ERROR;
    412412    }
     
    444444
    445445bool
    446 Rappture::Unirect3d::ImportDx(Rappture::Outcome &result, int nComponents,
    447         size_t length, char *string)
     446Rappture::Unirect3d::ImportDx(Rappture::Outcome &result, size_t nComponents,
     447                              size_t length, char *string)
    448448{
    449     size_t nx, ny, nz, npts;
     449    int nx, ny, nz, npts;
    450450    double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz;
    451451    char *p, *endPtr;
     
    483483        } else if (sscanf(line, "object %*d class array type %*s shape 3"
    484484                " rank 1 items %d data follows", &npts) == 1) {
     485            if (npts < 0) {
     486                result.addError("bad # points %d", npts);
     487                return false;
     488            }   
    485489            printf("#points=%d\n", npts);
    486490            if (npts != nx*ny*nz) {
     
    559563    }
    560564    // make sure that we read all of the expected points
    561     if (_nValues != npts) {
     565    if (_nValues != (size_t)npts) {
    562566        result.addError("inconsistent data: expected %d points"
    563567                        " but found %d points", npts, _nValues);
     
    588592
    589593bool
    590 Rappture::Unirect3d::Resample(Rappture::Outcome &result, int nSamples)
     594Rappture::Unirect3d::Resample(Rappture::Outcome &result, size_t nSamples)
    591595{
    592596    Rappture::Mesh1D xgrid(_xMin, _xMax, _xNum);
  • trunk/packages/vizservers/nanovis/Unirect.h

    r1446 r1458  
    171171    int LoadData(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv);
    172172
    173     bool ImportDx(Rappture::Outcome &result, int nComponents,
     173    bool ImportDx(Rappture::Outcome &result, size_t nComponents,
    174174                  size_t length, char *string);
    175175    bool Convert(Unirect2d *dataPtr);
    176     bool Resample(Rappture::Outcome &context, int nSamples = 30);
     176    bool Resample(Rappture::Outcome &context, size_t nSamples = 30);
    177177    bool isInitialized(void) {
    178178        return _initialized;
Note: See TracChangeset for help on using the changeset viewer.