Changeset 1325 for trunk/packages/vizservers/nanovis/Command.cpp
- Timestamp:
- Mar 14, 2009, 4:20:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1312 r1325 97 97 extern Texture2D* plane[10]; 98 98 99 extern Rappture::Outcome load_volume_stream(int index, std::iostream& fin); 100 extern Rappture::Outcome load_volume_stream_odx(int index, const char *buf, 101 int nBytes); 102 extern Rappture::Outcome load_volume_stream2(int index, std::iostream& fin); 99 bool load_volume_stream(Rappture::Outcome &status, int index, 100 std::iostream& fin); 101 bool load_volume_stream_odx(Rappture::Outcome &status, int index, 102 const char *buf, int nBytes); 103 extern bool load_volume_stream2(Rappture::Outcome &status, int index, 104 std::iostream& fin); 103 105 extern void load_volume(int index, int width, int height, int depth, 104 106 int n_component, float* data, double vmin, double vmax, 105 107 double nzero_min); 106 extern void load_vector_stream(int index, std::istream& fin); 107 extern void load_vector_stream2(int index, std::istream& fin); 108 extern bool load_vector_stream(Rappture::Outcome &result, int index, 109 std::istream& fin); 110 extern bool load_vector_stream2(Rappture::Outcome &result, int index, 111 std::istream& fin); 108 112 109 113 // Tcl interpreter for incoming messages … … 679 683 } 680 684 if (NanoVis::recfile != NULL) { 681 fwrite(buf.bytes(), sizeof(char), buf.size(), NanoVis::recfile); 685 ssize_t nWritten; 686 687 nWritten = fwrite(buf.bytes(), sizeof(char), buf.size(), 688 NanoVis::recfile); 689 assert(nWritten == (ssize_t)buf.size()); 682 690 fflush(NanoVis::recfile); 683 691 } … … 689 697 printf("ERROR -- DECODING\n"); 690 698 fflush(stdout); 691 Tcl_AppendResult(interp, err.remark() .c_str(), (char*)NULL);699 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 692 700 return TCL_ERROR; 693 701 } … … 1296 1304 std::stringstream fdata; 1297 1305 fdata.write(buf.bytes(),buf.size()); 1298 err = load_volume_stream3(n, fdata); 1299 if (err) { 1300 Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL); 1306 if (!load_volume_stream3(err, n, fdata)) { 1307 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 1301 1308 return TCL_ERROR; 1302 1309 } … … 1307 1314 printf("Loading DX using OpenDX library...\n"); 1308 1315 fflush(stdout); 1309 err = load_volume_stream_odx(n, buf.bytes()+5, buf.size()-5); 1310 if (err) { 1311 Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL); 1316 if (!load_volume_stream_odx(err, n, buf.bytes()+5, buf.size()-5)) { 1317 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 1312 1318 return TCL_ERROR; 1313 1319 } … … 1320 1326 fdata.write(buf.bytes(),buf.size()); 1321 1327 1328 bool result; 1322 1329 #if ISO_TEST 1323 err = load_volume_stream2(n, fdata);1330 result = load_volume_stream2(err, n, fdata); 1324 1331 #else 1325 err = load_volume_stream(n, fdata);1332 result = load_volume_stream(err, n, fdata); 1326 1333 #endif 1327 if ( err) {1328 Tcl_AppendResult(interp, err.remark() .c_str(), (char*)NULL);1334 if (!result) { 1335 Tcl_AppendResult(interp, err.remark(), (char*)NULL); 1329 1336 return TCL_ERROR; 1330 1337 } … … 1351 1358 Volume *volPtr; 1352 1359 char info[1024]; 1360 ssize_t nWritten; 1353 1361 1354 1362 if (Volume::update_pending) { … … 1360 1368 n, volPtr->wAxis.min(), volPtr->wAxis.max(), 1361 1369 Volume::valueMin, Volume::valueMax); 1362 write(0, info, strlen(info)); 1370 nWritten = write(0, info, strlen(info)); 1371 assert(nWritten == (ssize_t)strlen(info)); 1363 1372 } 1364 1373 return TCL_OK; … … 1723 1732 Tcl_Obj *const *objv) 1724 1733 { 1734 Rappture::Outcome result; 1735 1725 1736 Trace("Flow Data Loading\n"); 1726 1737 … … 1737 1748 std::stringstream fdata; 1738 1749 fdata.write(buf.bytes(),buf.size()); 1739 // load_vector_stream(n, fdata); 1740 load_vector_stream2(n, fdata); 1750 // load_vector_stream(result, n, fdata); 1751 1752 if (!load_vector_stream2(result, n, fdata)) { 1753 Tcl_AppendResult(interp, result.remark(), (char *)NULL); 1754 return TCL_ERROR; 1755 } 1741 1756 Volume *volPtr = NanoVis::volume[n]; 1742 1757 … … 1793 1808 Tcl_Obj *const *objv) 1794 1809 { 1810 Rappture::Outcome result; 1795 1811 int total_frame_count; 1796 1812 … … 1806 1822 1807 1823 char fileName[128]; 1808 sprintf(fileName,"/tmp/flow%d.mpeg", getpid());1824 sprintf(fileName,"/tmp/flow%d.mpeg", getpid()); 1809 1825 1810 1826 1811 1827 Trace("FLOW started\n"); 1812 1828 1813 Rappture::AVTranslate movie(NanoVis::win_width, NanoVis::win_height);1829 Rappture::AVTranslate movie(NanoVis::win_width, NanoVis::win_height); 1814 1830 1815 1831 int pad = 0; … … 1818 1834 } 1819 1835 1820 movie.init( fileName);1836 movie.init(result, fileName); 1821 1837 1822 1838 for (int frame_count = 0; frame_count < total_frame_count; frame_count++) { … … 1839 1855 // this is done before bmp_write_to_file because bmp_write_to_file 1840 1856 // turns rgb data to bgr 1841 movie.append( NanoVis::screen_buffer,pad);1857 movie.append(result, NanoVis::screen_buffer,pad); 1842 1858 // NanoVis::bmp_write_to_file(frame_count, fileName); 1843 1859 } 1844 1860 1845 movie. close();1861 movie.done(result); 1846 1862 Trace("FLOW end\n"); 1847 1863 … … 1858 1874 data.load(fileName); 1859 1875 char command[512]; 1860 sprintf(command,"nv>file -bytes %lu\n", data.size());1861 NanoVis::sendDataToClient(command,data.bytes(), data.size());1876 sprintf(command,"nv>file -bytes %lu\n", (unsigned long)data.size()); 1877 NanoVis::sendDataToClient(command,data.bytes(), data.size()); 1862 1878 if (remove(fileName) != 0) { 1863 1879 fprintf(stderr, "Error deleting flow movie file: %s\n", fileName); … … 2818 2834 if (Tcl_Eval(interp, def_transfunc) != TCL_OK) { 2819 2835 fprintf(NanoVis::logfile, "WARNING: bad default transfer function\n"); 2820 fprintf(NanoVis::logfile, Tcl_GetStringResult(interp));2836 fprintf(NanoVis::logfile, "%s\n", Tcl_GetStringResult(interp)); 2821 2837 } 2822 2838 return interp;
Note: See TracChangeset
for help on using the changeset viewer.