Changeset 595 for trunk/gui/vizservers
- Timestamp:
- Feb 27, 2007, 8:07:51 AM (18 years ago)
- Location:
- trunk/gui/vizservers/nanovis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/nanovis/Makefile
r587 r595 23 23 R2INC = ./R2/include 24 24 25 LIB_NANOVIS = - ltcl8.4-L/opt/render/lib -lGL -lglut -lglui -lGLEW -lCg -lCgGL -pthread -lstdc++25 LIB_NANOVIS = -Wl,-rpath,/apps/rappture/lib -ltcl8.4 ../../../src2/core/libviz.a -L/apps/rappture/lib -lb64 -lz -L/opt/render/lib -lGL -lglut -lglui -lGLEW -lCg -lCgGL -pthread -lstdc++ 26 26 LIB_CLIENT = -L/opt/render/lib -lGL -lglut -pthread -lstdc++ 27 INCLUDES = -I../../../src2/core -I/ opt/render/include -I/usr/include/GL -I/usr/include/GL -I/usr/include/tcl8.4 -I/usr/include/GL -I$(R2INC)27 INCLUDES = -I../../../src2/core -I/apps/rappture/include -I/opt/render/include -I/usr/include/GL -I/usr/include/GL -I/usr/include/tcl8.4 -I/usr/include/GL -I$(R2INC) 28 28 CFLAG = -g -c $(INCLUDES) 29 29 … … 37 37 38 38 nanovis: $(OBJ_NANOVIS) 39 gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../../../src2/core/*.o 40 # (cd ../../../src2/core; make libviz.a) 41 # gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../../../src2/core/libviz.a 39 (cd ../../../src2/core; make libviz.a) 40 gcc -g -o nanovis $(OBJ_NANOVIS) $(LIB_NANOVIS) ../../../src2/core/libviz.a 42 41 43 42 ColorGradient.o: Color.o $(TFSRC)/ColorGradient.cpp -
trunk/gui/vizservers/nanovis/nanovis.cpp
r587 r595 32 32 #include "RpFieldRect3D.h" 33 33 #include "RpFieldPrism3D.h" 34 #include "RpBuffer.h" 34 35 35 36 //transfer function headers … … 108 109 //void init_particles(); 109 110 void get_slice_vectors(); 110 Rappture::Outcome load_volume_ file(int index, char *fname);111 Rappture::Outcome load_volume_stream(int index, std::iostream& fin); 111 112 void load_volume(int index, int width, int height, int depth, int n_component, float* data, double vmin, double vmax); 112 113 TransferFunction* get_transfunc(char *name); … … 830 831 } 831 832 832 char fname[64]; 833 sprintf(fname,"/tmp/nv%d.dat",getpid()); 834 std::ofstream dfile(fname); 833 Rappture::Outcome err; 834 Rappture::Buffer buf; 835 835 836 836 char buffer[8096]; … … 839 839 int status = fread(buffer, 1, chunk, stdin); 840 840 if (status > 0) { 841 dfile.write(buffer,status);841 buf.append(buffer,status); 842 842 nbytes -= status; 843 843 } else { 844 Tcl_AppendResult(interp, "data unpacking failed in file",845 fname,(char*)NULL);844 Tcl_AppendResult(interp, "data unpacking failed: unexpected EOF", 845 (char*)NULL); 846 846 return TCL_ERROR; 847 847 } 848 848 } 849 dfile.close(); 850 851 char cmdstr[512]; 852 sprintf(cmdstr, "mimedecode %s | gunzip -c > /tmp/nv%d.dx", fname, getpid()); 853 if (system(cmdstr) != 0) { 854 Tcl_AppendResult(interp, "data unpacking failed in file ", 855 fname, (char*)NULL); 849 850 err = buf.decode(); 851 if (err) { 852 Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL); 856 853 return TCL_ERROR; 857 854 } 858 859 sprintf(fname,"/tmp/nv%d.dx",getpid());855 std::stringstream fdata; 856 fdata.write(buf.bytes(),buf.size()); 860 857 861 858 int n = n_volumes; 862 Rappture::Outcome err = load_volume_file(n, fname); 863 864 sprintf(cmdstr, "rm -f /tmp/nv%d.dat /tmp/nv%d.dx", getpid(), getpid()); 865 system(cmdstr); 859 err = load_volume_stream(n, fdata); 866 860 867 861 if (err) { … … 1395 1389 */ 1396 1390 void 1397 load_vector_ file(int index, char *fname) {1391 load_vector_stream(int index, std::iostream& fin) { 1398 1392 int dummy, nx, ny, nz, nxy, npts; 1399 1393 double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz; 1400 1394 char line[128], type[128], *start; 1401 std::ifstream fin(fname);1402 1395 1403 1396 do { … … 1530 1523 delete [] data; 1531 1524 } else { 1532 std::cerr << "WARNING: data not found in file " << fname<< std::endl;1525 std::cerr << "WARNING: data not found in stream" << std::endl; 1533 1526 } 1534 1527 } … … 1538 1531 */ 1539 1532 Rappture::Outcome 1540 load_volume_ file(int index, char *fname) {1533 load_volume_stream(int index, std::iostream& fin) { 1541 1534 Rappture::Outcome result; 1542 1535 … … 1545 1538 double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz; 1546 1539 char line[128], type[128], *start; 1547 std::ifstream fin(fname);1548 1540 1549 1541 int isrect = 1; … … 1888 1880 } 1889 1881 } else { 1890 char mesg[256]; 1891 sprintf(mesg,"data not found in file %s", fname); 1892 return result.error(mesg); 1882 return result.error("data not found in stream"); 1893 1883 } 1894 1884 … … 2218 2208 perf = new PerfQuery(); 2219 2209 } 2220 2221 //load_volume_file(0, "./data/A-apbs-2-out-potential-PE0.dx");2222 //load_volume_file(0, "./data/nw-AB-Vg=0.000-Vd=1.000-potential.dx");2223 //load_volume_file(0, "./data/test2.dx");2224 //load_volume_file(0, "./data/mu-wire-3d.dx"); //I added this line to debug: Wei2225 //load_volume_file(0, "./data/input_nd_dx_4"); //take a VERY long time?2226 //load_vector_file(1, "./data/J-wire-vec.dx");2227 //load_volume_file(1, "./data/mu-wire-3d.dx"); //I added this line to debug: Wei2228 //load_volume_file(3, "./data/mu-wire-3d.dx");2229 //load_volume_file(4, "./data/mu-wire-3d.dx");2230 2210 2231 2211 init_offscreen_buffer(); //frame buffer object for offscreen rendering
Note: See TracChangeset
for help on using the changeset viewer.