Changeset 1458 for trunk/packages
- Timestamp:
- May 19, 2009, 2:44:49 PM (15 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/FlowCmd.cpp
r1457 r1458 72 72 Rappture::SwitchSpec FlowParticles::_switches[] = { 73 73 {Rappture::SWITCH_CUSTOM, "-axis", "string", 74 offsetof(FlowParticlesValues, position.axis), 0, 0, &axisSwitch},74 offsetof(FlowParticlesValues, position.axis), 0, 0, &axisSwitch}, 75 75 {Rappture::SWITCH_CUSTOM, "-color", "{r g b a}", 76 offsetof(FlowParticlesValues, color), 0, 0, &colorSwitch},76 offsetof(FlowParticlesValues, color), 0, 0, &colorSwitch}, 77 77 {Rappture::SWITCH_BOOLEAN, "-hide", "boolean", 78 offsetof(FlowParticlesValues, isHidden), 0},78 offsetof(FlowParticlesValues, isHidden), 0}, 79 79 {Rappture::SWITCH_CUSTOM, "-position", "number", 80 offsetof(Flow Values, slicePos), 0, 0, &positionSwitch},80 offsetof(FlowParticlesValues, position), 0, 0, &positionSwitch}, 81 81 {Rappture::SWITCH_END} 82 82 }; … … 84 84 Rappture::SwitchSpec FlowBox::_switches[] = { 85 85 {Rappture::SWITCH_CUSTOM, "-color", "{r g b a}", 86 offsetof(FlowBoxValues, color), 0, 0, &colorSwitch},86 offsetof(FlowBoxValues, color), 0, 0, &colorSwitch}, 87 87 {Rappture::SWITCH_CUSTOM, "-corner1", "{x y z}", 88 offsetof(FlowBoxValues, corner1), 0, 0, &pointSwitch},88 offsetof(FlowBoxValues, corner1), 0, 0, &pointSwitch}, 89 89 {Rappture::SWITCH_CUSTOM, "-corner2", "{x y z}", 90 offsetof(FlowBoxValues, corner2), 0, 0, &pointSwitch},90 offsetof(FlowBoxValues, corner2), 0, 0, &pointSwitch}, 91 91 {Rappture::SWITCH_BOOLEAN, "-hide", "boolean", 92 offsetof(FlowBoxValues, isHidden), 0},92 offsetof(FlowBoxValues, isHidden), 0}, 93 93 {Rappture::SWITCH_FLOAT, "-linewidth", "number", 94 offsetof(FlowBoxValues, lineWidth), 0},94 offsetof(FlowBoxValues, lineWidth), 0}, 95 95 {Rappture::SWITCH_END} 96 96 }; … … 118 118 FlowParticles::Render(void) 119 119 { 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 126 120 _rendererPtr->setPos(FlowCmd::GetRelativePosition(&_sv.position)); 127 121 _rendererPtr->setAxis(_sv.position.axis); … … 691 685 692 686 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)) { 695 688 Tcl_AppendResult(interp, result.remark(), (char *)NULL); 696 689 delete dataPtr; … … 710 703 cmdInfo.objClientData = (ClientData)dataPtr; 711 704 Tcl_SetCommandInfo(interp, "unirect3d", &cmdInfo); 712 if (Tcl_Eval(interp, (const char *)b uf.bytes()+11) != TCL_OK) {705 if (Tcl_Eval(interp, (const char *)bytes+11) != TCL_OK) { 713 706 delete dataPtr; 714 707 return TCL_ERROR; … … 731 724 cmdInfo.objClientData = (ClientData)dataPtr; 732 725 Tcl_SetCommandInfo(interp, "unirect2d", &cmdInfo); 733 if (Tcl_Eval(interp, (const char *)b uf.bytes()+11) != TCL_OK) {726 if (Tcl_Eval(interp, (const char *)bytes+11) != TCL_OK) { 734 727 delete dataPtr; 735 728 return TCL_ERROR; … … 746 739 Rappture::Unirect3d *dataPtr; 747 740 748 fprintf(stderr, "header is %.14s\n", b uf.bytes());741 fprintf(stderr, "header is %.14s\n", bytes); 749 742 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)) { 752 744 Tcl_AppendResult(interp, result.remark(), (char *)NULL); 753 745 delete dataPtr; -
trunk/packages/vizservers/nanovis/FlowCmd.h
r1434 r1458 15 15 16 16 struct FlowParticlesValues { 17 int isHidden; /* Indicates if particle injection18 * plane is active or not. */19 17 FlowPosition position; /* Position on axis of particle 20 18 * plane */ 21 19 FlowColor color; /* Color of particles */ 20 int isHidden; /* Indicates if particle injection 21 * plane is active or not. */ 22 22 }; 23 23 … … 96 96 97 97 struct FlowBoxValues { 98 int isHidden; /* Indicates if particle injection99 * plance is active or not. */100 98 float position; /* Position on axis of particle 101 99 * plane */ … … 104 102 FlowColor color; /* Color of particles */ 105 103 float lineWidth; 104 int isHidden; /* Indicates if particle injection 105 * plance is active or not. */ 106 106 }; 107 107 -
trunk/packages/vizservers/nanovis/Unirect.cpp
r1453 r1458 242 242 } 243 243 _initialized = true; 244 #ifdef notdef 244 245 { 245 246 FILE *f; … … 255 256 fclose(f); 256 257 } 258 #endif 257 259 return TCL_OK; 258 260 } … … 407 409 "wrong number of values: must be xnum*ynum*components", 408 410 (char *)NULL); 409 fprintf(stderr, "x=%d y=%d c=%d, nv=%d\n",410 _xNum, _yNum, _nComponents, _nValues);411 411 return TCL_ERROR; 412 412 } … … 444 444 445 445 bool 446 Rappture::Unirect3d::ImportDx(Rappture::Outcome &result, int nComponents,447 size_t length, char *string)446 Rappture::Unirect3d::ImportDx(Rappture::Outcome &result, size_t nComponents, 447 size_t length, char *string) 448 448 { 449 size_t nx, ny, nz, npts;449 int nx, ny, nz, npts; 450 450 double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz; 451 451 char *p, *endPtr; … … 483 483 } else if (sscanf(line, "object %*d class array type %*s shape 3" 484 484 " rank 1 items %d data follows", &npts) == 1) { 485 if (npts < 0) { 486 result.addError("bad # points %d", npts); 487 return false; 488 } 485 489 printf("#points=%d\n", npts); 486 490 if (npts != nx*ny*nz) { … … 559 563 } 560 564 // make sure that we read all of the expected points 561 if (_nValues != npts) {565 if (_nValues != (size_t)npts) { 562 566 result.addError("inconsistent data: expected %d points" 563 567 " but found %d points", npts, _nValues); … … 588 592 589 593 bool 590 Rappture::Unirect3d::Resample(Rappture::Outcome &result, int nSamples)594 Rappture::Unirect3d::Resample(Rappture::Outcome &result, size_t nSamples) 591 595 { 592 596 Rappture::Mesh1D xgrid(_xMin, _xMax, _xNum); -
trunk/packages/vizservers/nanovis/Unirect.h
r1446 r1458 171 171 int LoadData(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); 172 172 173 bool ImportDx(Rappture::Outcome &result, int nComponents,173 bool ImportDx(Rappture::Outcome &result, size_t nComponents, 174 174 size_t length, char *string); 175 175 bool Convert(Unirect2d *dataPtr); 176 bool Resample(Rappture::Outcome &context, int nSamples = 30);176 bool Resample(Rappture::Outcome &context, size_t nSamples = 30); 177 177 bool isInitialized(void) { 178 178 return _initialized;
Note: See TracChangeset
for help on using the changeset viewer.