Changeset 3063 for branches


Ignore:
Timestamp:
Jun 27, 2012 9:58:34 AM (12 years ago)
Author:
ldelgass
Message:

Use ifdef/ifndef for config flags consistently (rather than using 0/1 values for
some defines). Rename ISO_TEST to reflect what it really does (controls
downsampling behavior).

Location:
branches/nanovis2/packages/vizservers/nanovis
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/nanovis2/packages/vizservers/nanovis/Command.cpp

    r3023 r3063  
    5454#include "Trace.h"
    5555
    56 #if PLANE_CMD
     56#ifdef PLANE_CMD
    5757#include "PlaneRenderer.h"
    5858#endif
     
    101101static Tcl_ObjCmdProc GridCmd;
    102102static Tcl_ObjCmdProc LegendCmd;
    103 #if PLANE_CMD
     103#ifdef PLANE_CMD
    104104static Tcl_ObjCmdProc PlaneCmd;
    105105#endif
     
    21112111}
    21122112
    2113 #if PLANE_CMD
     2113#ifdef PLANE_CMD
    21142114static int
    21152115PlaneAddOp(ClientData clientData, Tcl_Interp *interp, int objc,
     
    22312231}
    22322232
    2233 #endif  /*PLANE_CMD*/
     2233#endif /*PLANE_CMD*/
    22342234
    22352235/*
     
    22982298    Tcl_CreateObjCommand(interp, "heightmap",   HeightMapCmd,   NULL, NULL);
    22992299    Tcl_CreateObjCommand(interp, "legend",      LegendCmd,      NULL, NULL);
    2300 #if PLANE_CMD
     2300#ifdef PLANE_CMD
    23012301    Tcl_CreateObjCommand(interp, "plane",       PlaneCmd,       NULL, NULL);
    23022302#endif
  • branches/nanovis2/packages/vizservers/nanovis/EventPlayer.cpp

    r2822 r3063  
    121121    }
    122122
    123 #if DO_RLE
     123#ifdef DO_RLE
    124124    int sizes[2];
    125125    status = read(socket_fd, &sizes, sizeof(sizes));
  • branches/nanovis2/packages/vizservers/nanovis/config.h

    r3007 r3063  
    3737#define USE_HALF_FLOAT
    3838
    39 #define XINETD                          /* Enable render server. */
    40 //#define EVENTLOG                      /* Enable event logging. */
    41 //#define DO_RLE                        /* Do run length compression. */
     39/*
     40 * Enable render server
     41 */
     42#define XINETD
    4243
    43 #define KEEPSTATS               1
     44/*
     45 * Enable event logging
     46 */
     47//#define EVENTLOG
     48
     49/*
     50 * Do run length compression
     51 */
     52//#define DO_RLE
     53
     54/*
     55 * Keep statistics
     56 */
     57#define KEEPSTATS
    4458
    4559/*
     
    4862#define WANT_TRACE
    4963
    50 /*
    51  * The following define controls whether the new or old load_volume_stream
    52  * implementation is used to load DX data. The difference is that the old
    53  * implementation doesn't do any interpolation of the points to a coarser
    54  * mesh.  Setting ISO_TEST to 1 will cause the old implementation to be
    55  * used, which makes isosurfaces work correctly (FIXME: is this still
    56  * true?)
    57  *
    58  * [In the future, we'll use the OpenDX library reader and determine at
    59  * runtime if mesh decimation is required]
     64/*
     65 * Controls whether DX data is downsampled.
    6066 */
    61 #define ISO_TEST                0
     67#define DOWNSAMPLE_DATA
    6268
    6369/*
     
    6571 * volume
    6672 */
    67 #define FILTER_GRADIENTS        0
     73#define FILTER_GRADIENTS
    6874
    6975/*
    70  * The following define controls whether the plane* commands are
    71  * registered in the interpreter.  Right now it's off.  [Are these
    72  * commands still required?]
     76 * Controls whether the plane* commands are registered in the
     77 * interpreter. [Are these commands still required?]
    7378 */
    74 #define PLANE_CMD               0
     79//#define PLANE_CMD
    7580
    7681#endif
  • branches/nanovis2/packages/vizservers/nanovis/dxReader.cpp

    r2953 r3063  
    231231    double vmax = -DBL_MAX;
    232232    if (isrect) {
    233 #if ISO_TEST
    234         data = new float[nx *  ny *  nz * 4];
    235         memset(data, 0, nx*ny*nz*4);
    236 #else // !ISO_TEST
     233#ifdef DOWNSAMPLE_DATA
    237234        Rappture::Mesh1D xgrid(x0, x0 + lx, nx);
    238235        Rappture::Mesh1D ygrid(y0, y0 + ly, ny);
    239236        Rappture::Mesh1D zgrid(z0, z0 + lz, nz);
    240237        Rappture::FieldRect3D field(xgrid, ygrid, zgrid);
    241 #endif // ISO_TEST
     238#else // !DOWNSAMPLE_DATA
     239        data = new float[nx *  ny *  nz * 4];
     240        memset(data, 0, nx*ny*nz*4);
     241#endif // DOWNSAMPLE_DATA
    242242        double dval[6];
    243243        int nread = 0;
     
    260260                }
    261261#endif
    262 #if ISO_TEST
     262#ifdef DOWNSAMPLE_DATA
     263                int nindex = iz*nx*ny + iy*nx + ix;
     264                field.define(nindex, dval[p]);
     265#else // !DOWNSAMPLE_DATA
    263266                int nindex = (iz*nx*ny + iy*nx + ix) * 4;
    264267                data[nindex] = dval[p];
     
    272275                    nzero_min = dval[p];
    273276                }
    274 #else // !ISO_TEST
    275                 int nindex = iz*nx*ny + iy*nx + ix;
    276                 field.define(nindex, dval[p]);
    277 #endif // ISO_TEST
     277#endif // DOWNSAMPLE_DATA
    278278                nread++;
    279279                if (++iz >= nz) {
     
    294294        }
    295295
    296 #if ISO_TEST
     296#ifndef DOWNSAMPLE_DATA
    297297        double dv = vmax - vmin;
    298298        if (dv == 0.0) {
     
    313313        computeSimpleGradient(data, nx, ny, nz,
    314314                              dx, dy, dz);
    315 #else // !ISO_TEST
     315#else // DOWNSAMPLE_DATA
    316316        // figure out a good mesh spacing
    317317        int nsample = 30;
    318318        double dmin = pow((lx*ly*lz)/((nsample-1)*(nsample-1)*(nsample-1)), 0.333);
    319319
    320         nx = (int)ceil(lx/dmin);
    321         ny = (int)ceil(ly/dmin);
    322         nz = (int)ceil(lz/dmin);
     320        nx = (int)ceil(lx/dmin) + 1;
     321        ny = (int)ceil(ly/dmin) + 1;
     322        nz = (int)ceil(lz/dmin) + 1;
    323323
    324324#ifndef HAVE_NPOT_TEXTURES
     
    342342
    343343        int ngen = 0;
    344 #if FILTER_GRADIENTS
     344#ifdef FILTER_GRADIENTS
    345345        // Sobel filter expects a single float at
    346346        // each node
     
    369369                        nzero_min = v;
    370370                    }
    371 #if FILTER_GRADIENTS
     371#ifdef FILTER_GRADIENTS
    372372                    // NOT normalized, -1 => out of bounds
    373373                    v = (isnan(v)) ? -1.0 : v;
     
    382382            }
    383383        }
    384 #if FILTER_GRADIENTS
     384#ifdef FILTER_GRADIENTS
    385385        // computeGradient returns a new array with gradients
    386386        // filled in, so data is now 4 floats per node
     
    394394#endif // FILTER_GRADIENTS
    395395
    396 #endif // ISO_TEST
     396#endif // DOWNSAMPLE_DATA
    397397    } else {
    398398        Rappture::Mesh1D zgrid(z0, z0 + (nz-1)*dz, nz);
     
    439439        double dmin = pow((lx*ly*lz)/((nsample-1)*(nsample-1)*(nsample-1)), 0.333);
    440440
    441         nx = (int)ceil(lx/dmin);
    442         ny = (int)ceil(ly/dmin);
    443         nz = (int)ceil(lz/dmin);
     441        nx = (int)ceil(lx/dmin) + 1;
     442        ny = (int)ceil(ly/dmin) + 1;
     443        nz = (int)ceil(lz/dmin) + 1;
    444444#ifndef HAVE_NPOT_TEXTURES
    445445        // must be an even power of 2 for older cards
  • branches/nanovis2/packages/vizservers/nanovis/nanovis.cpp

    r3011 r3063  
    121121
    122122PlaneRenderer *NanoVis::planeRenderer = NULL;
    123 #if PLANE_CMD
     123#ifdef PLANE_CMD
    124124// pointers to 2D planes, currently handle up 10
    125125int NanoVis::numPlanes = 10;
     
    225225        delete colorTableRenderer;
    226226    }
    227 #if PLANE_CMD
     227#ifdef PLANE_CMD
    228228    for (int i = 0; i < numPlanes; i++) {
    229229        TRACE("Deleting plane[%d]", i);
     
    288288}
    289289
    290 #if KEEPSTATS
     290#ifdef KEEPSTATS
    291291
    292292static int
     
    406406#endif
    407407
    408 #if KEEPSTATS
     408#ifdef KEEPSTATS
    409409    writeStats("nanovis", code);
    410410#endif
     
    871871}
    872872
    873 #if DO_RLE
     873#ifdef DO_RLE
    874874char rle[512*512*3];
    875875int rleSize;
     
    18771877        doExit(90);
    18781878    }
    1879 #if DO_RLE
     1879#ifdef DO_RLE
    18801880    do_rle();
    18811881    int sizes[2] = {  offsets_size*sizeof(offsets[0]), rle_size };
  • branches/nanovis2/packages/vizservers/nanovis/protocol-nanovis.txt

    r3007 r3063  
    163163
    164164
    165 --- Colormaped Plane (if PLANE_CMD=1 in config.h) ---
     165--- Colormaped Plane (if PLANE_CMD is defined in config.h) ---
    166166plane active <planeIdx>
    167167      Set the active plane [0,9], or -1 to disable
     
    173173      Enable a plane for rendering using the given transfer
    174174      function.  Plane must first be added.
    175 --- End Colormaped Plane (if PLANE_CMD=1 in config.h) ---
     175--- End Colormaped Plane (if PLANE_CMD is defined in config.h) ---
    176176
    177177================================================================================
Note: See TracChangeset for help on using the changeset viewer.