Changeset 595


Ignore:
Timestamp:
Feb 27, 2007, 8:07:51 AM (17 years ago)
Author:
mmc
Message:

Added Derrick's libraries for base64 decoding and unzipping in place,
without having to shell out.

Location:
trunk/gui/vizservers/nanovis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/Makefile

    r587 r595  
    2323R2INC = ./R2/include
    2424
    25 LIB_NANOVIS = -ltcl8.4 -L/opt/render/lib -lGL -lglut -lglui -lGLEW -lCg -lCgGL -pthread -lstdc++
     25LIB_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++
    2626LIB_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)
     27INCLUDES = -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)
    2828CFLAG = -g -c $(INCLUDES)
    2929
     
    3737
    3838nanovis: $(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
    4241
    4342ColorGradient.o: Color.o $(TFSRC)/ColorGradient.cpp
  • trunk/gui/vizservers/nanovis/nanovis.cpp

    r587 r595  
    3232#include "RpFieldRect3D.h"
    3333#include "RpFieldPrism3D.h"
     34#include "RpBuffer.h"
    3435
    3536//transfer function headers
     
    108109//void init_particles();
    109110void get_slice_vectors();
    110 Rappture::Outcome load_volume_file(int index, char *fname);
     111Rappture::Outcome load_volume_stream(int index, std::iostream& fin);
    111112void load_volume(int index, int width, int height, int depth, int n_component, float* data, double vmin, double vmax);
    112113TransferFunction* get_transfunc(char *name);
     
    830831            }
    831832
    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;
    835835
    836836            char buffer[8096];
     
    839839                int status = fread(buffer, 1, chunk, stdin);
    840840                if (status > 0) {
    841                     dfile.write(buffer,status);
     841                    buf.append(buffer,status);
    842842                    nbytes -= status;
    843843                } 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);
    846846                    return TCL_ERROR;
    847847                }
    848848            }
    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);
    856853                return TCL_ERROR;
    857854            }
    858 
    859             sprintf(fname,"/tmp/nv%d.dx",getpid());
     855            std::stringstream fdata;
     856            fdata.write(buf.bytes(),buf.size());
    860857
    861858            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);
    866860
    867861            if (err) {
     
    13951389 */
    13961390void
    1397 load_vector_file(int index, char *fname) {
     1391load_vector_stream(int index, std::iostream& fin) {
    13981392    int dummy, nx, ny, nz, nxy, npts;
    13991393    double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz;
    14001394    char line[128], type[128], *start;
    1401     std::ifstream fin(fname);
    14021395
    14031396    do {
     
    15301523        delete [] data;
    15311524    } else {
    1532         std::cerr << "WARNING: data not found in file " << fname << std::endl;
     1525        std::cerr << "WARNING: data not found in stream" << std::endl;
    15331526    }
    15341527}
     
    15381531 */
    15391532Rappture::Outcome
    1540 load_volume_file(int index, char *fname) {
     1533load_volume_stream(int index, std::iostream& fin) {
    15411534    Rappture::Outcome result;
    15421535
     
    15451538    double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz;
    15461539    char line[128], type[128], *start;
    1547     std::ifstream fin(fname);
    15481540
    15491541    int isrect = 1;
     
    18881880        }
    18891881    } 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");
    18931883    }
    18941884
     
    22182208     perf = new PerfQuery();
    22192209   }
    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: Wei
    2225    //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: Wei
    2228    //load_volume_file(3, "./data/mu-wire-3d.dx");
    2229    //load_volume_file(4, "./data/mu-wire-3d.dx");
    22302210
    22312211   init_offscreen_buffer();    //frame buffer object for offscreen rendering
Note: See TracChangeset for help on using the changeset viewer.