source: trunk/src/testing/app/volvis/vNet.h @ 4

Revision 4, 5.3 KB checked in by ajaworski, 13 years ago (diff)

Added modified SAGE sources

Line 
1/********************************************************************************
2 * Volatile - Volume Visualization Software for SAGE
3 * Copyright (C) 2004 Electronic Visualization Laboratory,
4 * University of Illinois at Chicago
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 *  * Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *  * Redistributions in binary form must reproduce the above
14 *    copyright notice, this list of conditions and the following disclaimer
15 *    in the documentation and/or other materials provided with the distribution.
16 *  * Neither the name of the University of Illinois at Chicago nor
17 *    the names of its contributors may be used to endorse or promote
18 *    products derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * Direct questions, comments etc about Volatile to www.evl.uic.edu/cavern/forum
33 *********************************************************************************/
34
35//Class to handle the network for tiled display
36//vNet.h
37#if defined(V_DISTRIBUTED)
38#ifndef _vNet_h_
39#define _vNet_h_
40
41#include <iostream.h>
42#include <sstream>
43#include <fstream>
44#include <string>
45#include <vector>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49#include <math.h>
50#include <time.h>
51#include "mpi.h"
52#include "private.h"
53
54//size of each command from the master
55#define COMMAND_SIZE 2048
56
57using namespace std;
58
59#define int32 cint32
60#define uint32 cuint32
61#undef int32
62#undef uint32
63
64char* getServerIP(int rank, const char* serverFile) ;
65//Class that handles the image control operations (including MPI broadcast)
66class vNet {
67public:
68        //default constructor - provide the rank, total # processors and if master processor should display the image
69        vNet();
70        void init(int &argc, char** &argv);
71        ~vNet();
72        //kills the tiles
73        void deactivateTiles();
74        //calls the dbclients process, used by network thread
75        void process();
76        //message parsing
77        void processCmd(char* data);
78        //read the config file
79        bool readTileConfig(const char* configFile);
80
81        //set the rotation matrix for all the volumes
82        void setRotn(float rotn[16]) ;
83        //set cutplane rotation
84        void setCutRotation(float angle, float axis[3]);
85        //set cutplane zoom
86        void setCutZoom(float dzoom);
87        //set the low res rendreing for all the volumes
88        void setLowRes(int lowRes) ;
89        //set zoom
90        void setZoom(float factor);
91        //set Translation
92        void setTranslation(float translation[3]);
93        //scale the sampling
94        void scaleSampleRate(float factor);
95        //set the transfer function
96        void setLUT (int, unsigned char *);
97        //toggle printing frame rate
98        void togglePrintFPS();
99        //toggle cut plane
100        void toggleCutPlane();
101        //toggle display of bound box
102        void toggleBoundBox();
103        //save gradient volume
104        void saveGradientVolume() ;
105        //roam the volume
106        void setRoam() ;
107        //roam the volume
108        void setProbe() ;
109        //roam the volume
110        void roamVolume(int x, int y, int z);
111        //probe the volume
112        void probeVolume(int x, int y, int z);
113        //get the isosurface for this isosurface
114        void getIsosurface(int isoValue, float tx, float ty, float scale) ;
115        //get isopoint
116        void getIsopoint (int, float, float, float);
117        //animate volume
118        void animateVolume();
119        //animate volume (rotate it on X)
120        void animateVolumeRotX();
121        //update the animation if any
122        void updateAnim();
123        //select index
124        void select(int curIndex);
125
126        //set the pointer position
127        void select(float pointerPos[3]) ;
128
129        //default dummy command - to synch the master and slave displays
130        void fillDummyCommand();
131        //indicate ready to exit
132        void fillExitCommand();
133        //returns true if Im the master, false otherwise
134        inline int isActiveTile() {
135                if (rank == master)
136                        return 1;
137                else
138                        return 0;
139        }
140
141        inline void sync() {
142                MPI_Barrier(MPI_COMM_WORLD);
143        }
144
145        inline int getRank() {
146                return rank;
147        }
148//protected:
149        char buffer[COMMAND_SIZE]; //Command buffer that is broadcast every frame
150        int readyToDie;
151        QUANTAnet_datapack_c dataPack;  //to be replaced by MPI datapack ?
152        //network params
153        int cmdFlushed; //if the current command has been flushed in order to handle the next one
154        int rank; //my rank id - to read the right configuration
155        int master;//the master id
156        int noProcs;
157        void packCommand(const char* cmdString, int flushed =0); //to pack any command
158};
159
160#endif
161#endif
Note: See TracBrowser for help on using the repository browser.