/* main.c */ /* Vis5D version 5.0 */ /* Vis5D system for visualizing five dimensional gridded data sets Copyright (C) 1990 - 1997 Bill Hibbard, Johan Kellum, Brian Paul, Dave Santek, and Andre Battaiola. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Yo u should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #ifdef sgi # include #endif #include "api.h" #include "gui.h" #include "vis5d.h" #include "script.h" #include "pipe.h" #include "graphics.h" #ifndef MBS # define MBS 0 #endif #ifndef TOPOFILE # define TOPOFILE "EARTH.TOPO" #endif #ifndef WORLDFILE # define WORLDFILE "OUTLSUPW" #endif #ifndef USAFILE # define USAFILE "OUTLUSAM" #endif #define MAX(A,B) ( (A) > (B) ? (A) : (B) ) #define CP_WIDTH 384 /* * Print list of options. */ static void usage( void ) { #define P printf P("Vis5D version 5.0 (MBS=%d)\n", MBS); P("Usage:\n"); P(" vis5d file.v5d [options]\n"); P("Options:\n"); #if defined(SGI_GL) || defined(DENALI) || defined(OPENGL) P(" -alpha\n"); P(" Use alpha blending instead of screen door transparency.\n"); #endif #ifdef MCIDAS P(" -area N\n"); P(" Specifies the first McIDAS AREA file in a sequence to\n"); P(" display in the 3-D box.\n"); #endif P(" -barbs\n"); P(" Display wind barbs rather than vectors.\n"); P(" -box alon alat ahgt\n"); P(" Set aspect ratio of the 3-D box (longitude:latitude:height).\n"); P(" Example: vis5d LAMPS.v5d -box 4 2 1\n"); P(" -date\n"); P(" Display date as dd month yy rather than yyddd on clock.\n"); #if defined(SGI_GL) || defined(DENALI) P(" -font fontname size\n"); P(" Set the IRIS GL font and its height used in the viewing window.\n"); P(" Use the 'listfonts' program to list your system's font names.\n"); P(" Size of 72 equals one inch (2.54 cm).\n"); P(" Example: vis5d LAMPS.v5d -font Helvetica 30\n"); #endif #if defined(VOGL) || defined(OPENGL) P(" -font fontname\n"); P(" Set the X font used in the viewing window. Use xlsfonts(1)\n"); P(" to list your system's fonts.\n"); P(" Example: vis5d LAMPS.v5d -font fg-30\n"); P(" -soundfont fontname\n"); P(" Set the X font used in the sounding window. Use xlsfonts(1)\n"); P(" to list your system's fonts.\n"); P(" Example: vis5d LAMPS.v5d -soundfont fg-30\n"); #endif P(" -full\n"); P(" Full-screen window; make the 3-D window as large as possible.\n"); P(" -funcpath pathname\n"); P(" Specify directory to search for user Fortran functions.\n"); P(" Example: vis5d LAMPS.v5d -funcpath /usr/local/vis5d/userfuncs\n"); P(" -geometry WIDTHxHEIGHT+X+Y (or WIDTHxHEIGHT or +X+Y)\n"); P(" Specify the geometry of the 3-D window\n"); P(" -hirestopo\n"); P(" Display high resolution topography. Recommended only for\n"); P(" fast graphics systems.\n"); P(" -legend position size x y\n"); P(" Set color legend position (1=BOT,2=TOP,3=LFT,4=RT), size, and \n"); P(" relative x and y position from default, usually 0 and 0.\n"); P(" -log [log_scale] [log_exponent]\n"); P(" Specify a logrithmic vertical scale.\n"); P(" Default log_scale = %f\n", DEFAULT_LOG_SCALE ); P(" Default log_exponent = %f\n", DEFAULT_LOG_EXP ); P(" -map mapfile\n"); P(" Use a different map outline file instead of OUTLSUPW\n"); P(" Example: vis5d LAMPS.v5d -map OUTLUSAL\n"); P(" -nofile\n"); P(" Run vis5d with out loading a vis5d data set\n"); P(" -top_margin size\n"); P(" Specify the size in points for the top margin of the 3d windows\n"); P(" -bottom_margin size\n"); P(" Specify the size in points for the bottom margin of the 3d windows\n"); P(" -left_margin size\n"); P(" Specify the size in points for the left margin of the 3d windows\n"); P(" -right_margin size\n"); P(" Specify the size in points for the right margin of the 3d windows\n"); P(" -mbs n\n"); P(" Limit the memory used by vis5d to 'n' megabytes. When\n"); P(" the limit is exceeded, the least-recently-viewed graphics\n"); P(" are deallocated.\n"); #ifdef OPENGL P(" -offscreen\n"); P(" Do off screen rendering, used in conjunction with -script command\n"); #endif P(" -path pathname\n"); P(" Specify directory to search for map and topograpy files.\n"); P(" Example: vis5d LAMPS.v5d -path /usr3/data\n"); P(" -projection p\n"); P(" Set the map projection. Default is obtained from the datafile.\n"); P(" p may be one of:\n"); P(" generic - rectilinear grid in generic units\n"); P(" linear - rectilinear lat/lon grid (cylindrical equidistant)\n"); P(" lambert - Lambert Conformal or Polar Stereographic\n"); P(" stereo - Azimuthal Stereographic\n"); P(" rotated - rotated rectilinear lat/lon grid\n"); P(" cylindrical - rectilinear lat/lon grid drawn as a cylinder\n"); P(" spherical - rectilinear lat/lon grid drawn as a sphere\n"); P(" Only the first 3 characters of p are needed.\n"); P(" You will be prompted for additional parameters.\n"); P(" Example: vis5d LAMPS.v5d -projection spherical\n"); P(" -quickstart\n"); P(" Don't load any data when starting up vis5d, even if the whole\n"); P(" file will fit into memory. Useful when reading files by\n"); P(" NFS.\n"); P(" -rate ms\n"); P(" Set the animation rate. ms is the miniumum time delay in\n"); P(" milli-seconds between frames. Default is 100.\n"); P(" -reverse_poles\n"); P(" When using a cylindrical projection this option will cause the\n"); P(" south pole to be at the center of the disk\n"); P(" -samescale\n"); P(" Set the scale for the vertical plot variables to be the same\n"); P(" for all three variables\n"); P(" -script filename\n"); P(" Execute a Tcl script for controlling Vis5D.\n"); #if defined(SGI_GL) || defined(DENALI) || defined(OPENGL) P(" -sequence filename\n"); P(" Specify a sequence of images to texture map over the topography.\n"); P(" -texture image.rgb\n"); P(" Specify an image to texture map over the topography.\n"); #endif P(" -title x y font \"string\"\n"); P(" This is used in conjunction with the -_margin option. This will\n"); P(" print the string at location (x,y) in the BigWindow. Any number\n"); P(" of titles can be created. The strings will not show up if they are not in\n"); P(" a margin.\n"); P(" -topo topfile\n"); P(" Use a different topography file instead of EARTH.TOPO.\n"); P(" Example: vis5d LAMPS.v5d -topo MARS.TOPO\n"); P(" -trajvars uvar vvar [wvar]\n"); P(" Specify which variables to use for tracing trajectories\n"); P(" Example: vis5d dataset -trajvars U-REL V-REL WREL\n"); P(" -vertical v\n"); P(" Define the vertical coordinate system. Default is from datafile.\n"); P(" v may be one of:\n"); P(" generic - equally spaced levels in generic units\n"); P(" equal - equally spaced levels in km\n"); P(" unequal - unequally spaced levels in km\n"); P(" Only the first 3 characters of v are needed.\n"); P(" You will be prompted for additional parameters.\n"); P(" Example: vis5d LAMPS.v5d -vertical equal\n"); P(" -verylarge flag (0 or 1)\n"); P(" Force VeryLarge flag to be set or cleared. This controls\n"); P(" whether graphics generation is sync'd with rendering.\n"); P(" Default is calculated from ratio of file and memory sizes.\n"); P(" -wdpy xdisplay\n"); P(" Make widgets appear on a different display. Useful in\n"); P(" combination with -full for making slides and videos.\n"); P(" Example: vis5d LAMPS.v5d -full -wdpy pluto:0\n"); P(" -wide w\n"); P(" Set width of line segments in pixels (default is 1.0).\n"); P(" -wind2 uvar vvar [wvar]\n"); P(" Specify which variables to use when computing the HWIND-2\n"); P(" and VWIND-2 wind vector graphics.\n"); P(" -widescreen\n"); P(" Bring up a 1x3 display matrix\n"); P("Keyboard functions (when pointing in 3-D window):\n"); P(" F1 - Raise/lower control panel window.\n"); P(" F2 - Toggle display of system info.\n"); P(" P - Print window image to PostScript printer.\n"); P(" F - Faster animation.\n"); P(" S - Slower animation.\n"); P(" l - reduce the size of Vis5D logo\n"); P(" L - increse the size of Vis%D logo\n"); #undef P } /* * Reset the timer or return milliseconds elapsed since last reset. * Input: index = display_ctx index flag - 0 = reset timer * 1 = return elapsed time in ms. * Return: elapsed time in ms. */ static int timer( int index, int flag ) { struct timeval tp; static long start_usec, start_sec, lapsed_usec; /* Get the current time */ gettimeofday(&tp, (struct timezone *) 0); if (flag) { /* Return elapsed time */ vis5d_get_display_timer( index, &start_sec, &start_usec); lapsed_usec = ((tp.tv_sec - start_sec) * 1000000) + tp.tv_usec - start_usec; return lapsed_usec / 1000; } else { /* Reset timer */ vis5d_reset_display_timer( index ); return 0; } } /* * This is called by main. It reads user input and updates the 3-D * display until the program terminates. */ /* static int main_loop( int index ) */ /* WLH 29 Sept 98 static int main_loop( void ) */ static int main_loop(char *pipe_name) { int block; int numtimes, verylarge; int yo, howmany, whichones[VIS5D_MAX_CONTEXTS], spandex; int ghowmany, gwhichones[VIS5D_MAX_CONTEXTS]; int dindex, main_redraw; int redraw, work; int DR, DC; int cursor = 0; get_display_matrix( &DR, &DC); for (dindex = 0; dindex < DR * DC; dindex++) { timer(dindex, 0); /* reset timer */ } while (1){ /* WLH 29 Sept 98 */ if (pipe_name != NULL) { check_pipe(pipe_name); } get_display_matrix( &DR, &DC); /* once around this while loop for each animation step or redraw */ vis5d_check_work( &work ); /* MJK 11.17.98 */ if (work && !cursor){ make_watch_cursor(); cursor = 1; } else if (!work && cursor){ unmake_watch_cursor(); cursor = 0; } /* WLH 29 Sept 98 block = (work == 0); */ block = (work == 0 && pipe_name == NULL); for (dindex = 0; dindex < DR * DC; dindex++) { GuiContext gtx = get_gui_gtx2(dindex ); /* Determine if we should block/wait or poll for user input */ if(gtx){ vis5d_check_redraw( dindex, &redraw ); block = block && redraw == 0 && (gtx->GoTime == 0); } } main_redraw = 0; while (1) { int input_status; for (dindex = 0; dindex < DR * DC; dindex++) { GuiContext gtx = get_gui_gtx2(dindex ); if(gtx){ /* Determine if we should block/wait or poll for user input */ vis5d_check_redraw( dindex, &redraw ); if( gtx ){ block = block && redraw == 0 && (gtx->GoTime == 0); } else{ block = block && redraw; } } } input_status = get_user_input(block); /* if (input_status != 0) main_redraw = 1; */ if (input_status != 2) { /* ???? WLH 29 Aug 97 */ break; } } for (dindex = 0; dindex < DR * DC; dindex++) { GuiContext gtx = get_gui_gtx2(dindex ); if (gtx){ if (gtx->group_index > 0){ vis5d_get_grp_numtimes( gtx->group_index, &numtimes); } else { vis5d_get_dtx_numtimes( dindex, &numtimes ); } if (main_redraw != 0) vis5d_signal_redraw(dindex, 1); /* Do this when not animating: */ if (gtx->GoTime == 0) { vis5d_check_redraw( dindex, &redraw ); if (redraw) { vis5d_draw_frame( dindex, gtx->GoTime ); gtx->needswap = 1; /* vis5d_swap_frame( dindex ); */ /* BIG ATTENTION */ /* WLH 29 Aug 97: move vis5d_swap_frame calls into another loop?? */ } } /* Do this while animating: */ else { /* gtx->GoTime != 0) */ if ((timer(dindex, 1)) >= gtx->AnimRate) { int time; vis5d_get_dtx_timestep( dindex, &time ); if (gtx->group_index >0){ vis5d_get_grp_timestep(gtx->group_index, &time); } if (gtx->GoTime==1) { /* Step forward */ time++; if (time >= numtimes) { time = 0; } } else { /* Step backward */ time--; if (time<0) { time = numtimes-1; } } if (gtx->group_index >0){ vis5d_get_num_of_dtxs_in_group( gtx->group_index, &ghowmany,gwhichones); /* only do the group_redraw once, other wise it will */ /* advance the timestep for each group everytime it */ /* gets to a different gtx/dtx */ if (gtx->context_index == gwhichones[0]){ vis5d_set_grp_timestep(gtx->group_index, time); vis5d_signal_group_redraw( gtx->group_index, 1); } } else{ vis5d_set_dtx_timestep( dindex, time ); vis5d_signal_redraw(dindex, 1); } timer(dindex, 0); /* reset timer */ vis5d_get_num_of_ctxs_in_display( dindex, &howmany, whichones); for (yo = 0; yo < howmany; yo++){ spandex = whichones[yo]; verylarge = vis5d_verylarge_mode(spandex, VIS5D_GET); if (verylarge) { /* make graphics */ vis5d_make_timestep_graphics(spandex, time); vis5d_finish_work(); } } } /* end if (timer(dindex, 1) >= gtx->AnimRate) */ vis5d_check_redraw( dindex, &redraw ); if (redraw) { vis5d_draw_frame( dindex, gtx->GoTime ); gtx->needswap = 1; /* vis5d_swap_frame( dindex ); */ /* BIG ATTENTION */ /* WLH 29 Aug 97: move vis5d_swap_frame calls into another loop?? */ } } /* end if (gtx->GoTime != 0) */ }/*end if(gtx)*/ vis5d_do_work(); } /* end for (dindex = 0; dindex < DR * DC; dindex++) */ for (dindex = 0; dindex < DR * DC; dindex++) { GuiContext gtx = get_gui_gtx2(dindex ); if (gtx){ if (gtx->needswap){ vis5d_swap_frame( dindex ); gtx->needswap = 0; } } } vis5d_do_work(); /*if not in parallel mode, do a queued job */ } } /* * Create the 2-D Sounding window */ static int make_snd_window(int index, char *title, Window scw, char *wdpy_name ) { GuiContext gtx = get_gui_gtx(index); int xpos, ypos, height, width, scrwidth, scrheight; Display *dpy; int scr; dpy = XOpenDisplay( NULL ); if (!dpy) { printf("Unable to open default display\n"); exit(1); } scr = DefaultScreen( dpy ); scrwidth = DisplayWidth( dpy, scr ); scrheight = DisplayHeight( dpy, scr ); height = 10; width = 10; xpos = 15; ypos = 15; return vis5d_init_sndwindow( index, "Skew-T and Vertical Plot Displsy", xpos, ypos, width, height, scw, wdpy_name); } /* * Create the 3-D rendering window. */ static int make_gfx_window( char *title, int geometry, int xpos, int ypos, int width, int height ) { int scrwidth, scrheight; Display *dpy; int scr; dpy = XOpenDisplay( NULL ); if (!dpy) { printf("Unable to open default display\n"); exit(1); } scr = DefaultScreen( dpy ); scrwidth = DisplayWidth( dpy, scr ); scrheight = DisplayHeight( dpy, scr ); if (geometry==0) { /* compute best pos and size */ #if defined(VOGL) || defined(MESA) /* use smaller screen w/ VOGL and Mesa for faster rendering */ height = width = (scrwidth - 420) * 2 / 3; #else height = width = scrwidth - 420; #endif xpos = 410; ypos = 10; } else if (geometry==1) { /* just use arguments as is */ if (xpos==-1 && ypos==-1) { xpos = 410; ypos = 10; } if (width==-1 && height==-1) { width = height = scrwidth - 420; } if (xpos<0) xpos = scrwidth - width + xpos; if (ypos<0) ypos = scrheight - height + ypos; } else if (geometry==2) { /* maximum window size */ width = scrwidth; height = scrheight; xpos = ypos = 0; } else { printf("bad value (%d) for geometry in make_gfx_window()\n", geometry ); exit(1); } return vis5d_init_window( title, xpos, ypos, width, height ); } /* * Get a floating point value from stdin, don't change the value if * a blank line is read. */ static void input_float( float *fptr ) { char str[1000]; gets( str ); if (str[0]!=0 && str[0]!='\n') { *fptr = atof( str ); } } /* * Prompt the user to enter projection parameters for the specifed projection * type. * Input: index - the context index * proj - the projection type, one of PROJ_* symbols * Output: the current and then modified projection parameters */ static void prompt_for_projection_args( int index, int proj, float projargs[] ) { int current_proj; /* get default values */ vis5d_get_ctx_projection( index, ¤t_proj, projargs ); /* Prompt user for projection parameters now */ printf("Enter projection parameters, press Return for (default)\n"); switch (proj) { case PROJ_GENERIC: printf("Generic projection (no units):\n"); printf(" North Bound (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" West Bound (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" Row Increment (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" Column Increment (%g): ", projargs[3] ); input_float( &projargs[3] ); break; case PROJ_LINEAR: printf("Cylindrical Equidistant projection:\n"); printf(" North Bound Latitude (degrees) (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" West Bound Longitude (degrees) (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" Row Increment (degrees) (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" Column Increment (degrees) (%g): ", projargs[3] ); input_float( &projargs[3] ); break; case PROJ_LAMBERT: if (current_proj!=PROJ_LAMBERT) { int nr, nc; vis5d_get_size( index, &nr, &nc, NULL,NULL,NULL,NULL,NULL,NULL ); projargs[0] = 70.0; projargs[1] = 20.0; projargs[2] = -nr; projargs[3] = nc/2; projargs[4] = 90.0; projargs[5] = 100.0; } printf("Lambert Conformal projection:\n"); printf(" Standard Latitude 1 (degrees) (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" Standard Latitude 2 (degrees) (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" North/South Pole row (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" North/South Pole column (%g): ", projargs[3] ); input_float( &projargs[3] ); printf(" Central longitude (degrees) (%g): ", projargs[4] ); input_float( &projargs[4] ); printf(" Column increment (km) (%g): ", projargs[5] ); input_float( &projargs[5] ); break; case PROJ_STEREO: if (current_proj!=PROJ_STEREO) { /* default is north pole polar stereographic */ int nr, nc; vis5d_get_size( index, &nr, &nc, NULL,NULL,NULL,NULL,NULL,NULL ); projargs[0] = 90.0; projargs[1] = 0.0; projargs[2] = nr/2.0; projargs[3] = nc/2.0; projargs[4] = 500.0; } printf("Stereographic:\n"); printf(" Center Latitude (degrees) (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" Center Longitude (degrees) (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" Center Row (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" Center Column (%g): ", projargs[3] ); input_float( &projargs[3] ); printf(" Column spacing (km) (%g): ", projargs[4] ); input_float( &projargs[4] ); break; case PROJ_ROTATED: printf("Rotated Equidistant projection:\n"); printf(" Latitude on rotated globe of grid row 0 (degrees) (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" Longitude on rotated globe of grid column 0 (degrees)"); printf(" (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" Row Increment on rotated globe (degrees) (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" Column Increment on rotated globe (degrees) (%g): ", projargs[3] ); input_float( &projargs[3] ); printf(" Earth Latitude of (0, 0) on rotated globe (degrees) (%g): ", projargs[4] ); input_float( &projargs[4] ); printf(" Earth Longitude of (0, 0) on rotated globe (degrees) (%g): ", projargs[5] ); input_float( &projargs[5] ); printf(" Clockwise rotation of rotated globe (degrees) (%g): ", projargs[6] ); input_float( &projargs[6] ); break; case PROJ_CYLINDRICAL: case PROJ_SPHERICAL: if (proj==PROJ_CYLINDRICAL) { printf("Cylindrical projection of rectangular grid:\n"); } else { printf("Spherical projection of rectangular grid:\n"); } printf(" North Bound Latitude (degrees) (%g): ", projargs[0] ); input_float( &projargs[0] ); printf(" West Bound Longitude (degrees) (%g): ", projargs[1] ); input_float( &projargs[1] ); printf(" Row Increment (degrees) (%g): ", projargs[2] ); input_float( &projargs[2] ); printf(" Column Increment (degrees) (%g): ", projargs[3] ); input_float( &projargs[3] ); break; default: /* should never allow a bad projection number to get this far! */ abort(); } } /* * Prompt the user to enter parameters for the given vertical coordinate * sytem type. * Input: index - the context index number * vcs - the vertical coordinate system number, one of VERT_* * Output: vertargs - the vcs arguments */ static void prompt_for_vertical_args( int index, int vcs, float vertargs[] ) { int current_vcs; int maxnl, i; float pressure; vis5d_get_size( index, NULL, NULL, NULL, NULL, &maxnl, NULL, NULL, NULL ); /* get default values */ vis5d_get_ctx_vertical( index, ¤t_vcs, vertargs ); switch (vcs) { case VERT_GENERIC: printf("Generic linear vertical coordinate system:\n"); printf(" Bottom Bound (%g): ", vertargs[0] ); input_float( &vertargs[0] ); printf(" Level Increment (%g): ", vertargs[1] ); input_float( &vertargs[1] ); break; case VERT_EQUAL_KM: printf("Linear, equally spaced levels in km:\n"); printf(" Bottom Bound (km) (%g): ", vertargs[0] ); input_float( &vertargs[0] ); printf(" Level Increment (km) (%g): ", vertargs[1] ); input_float( &vertargs[1] ); break; case VERT_NONEQUAL_KM: printf("Linear, non-equally spaced levels in km:\n"); for (i=0;i no parallelism */ workers = 0; #endif #endif for (yo=0; yo < VIS5D_MAX_DPY_CONTEXTS; yo++){ v5dfile[yo] = NULL; first_area[yo] = 0; sequence[yo] = NULL; alpha[yo] = 0; barbs[yo] = 0; boxx[yo] = 0.0; boxy[yo] = 0.0; boxz[yo] = 0.0; fontname[yo] = NULL; soundfontname[yo] = NULL; fontsize[yo] = 0; funcpath[yo] = NULL; hirestopo[yo] = 0; julian[yo] = 1; mapname[yo] = NULL; mbs[yo] = MBS; path[yo] = NULL; user_projection[yo] = -1; preload[yo] = 1; animrate[yo] = ANIMRATE; texture[yo] = NULL; toponame[yo] = TOPOFILE; user_vertsys[yo] = -1; log_vcs[yo] = 0; scale[yo] = DEFAULT_LOG_SCALE; exponent[yo] = DEFAULT_LOG_EXP; verylarge[yo] = -1; linewidth[yo] = 1.0; samescale[yo] = 0; legend_position[yo] = VIS5D_BOTTOM; legend_size[yo] = 128; legendx[yo] = 0; legendy[yo] = 0; /* default wind var names */ strcpy( traju[yo], "U" ); strcpy( trajv[yo], "V" ); strcpy( trajw[yo], "W" ); strcpy( u2[yo], "U" ); strcpy( v2[yo], "V" ); strcpy( w2[yo], "W" ); } /* WLH 29 Sept 98 */ pipe_name = NULL; nofile = 0; widescreen = 0; reverse_poles = 1; /* Parse command line options */ for (i=1;i 0){ filepointer = gopointer - 1; } if (strcmp(argv[i],"-area")==0 && i+11){ sprintf( windowname, "Vis5D 3-D Display"); } else{ sprintf( windowname, "Vis5D 3-D Display (%s)", v5dfile[0] ); } make_gfx_window( windowname, geometry, xpos, ypos, width, height ); } vis5d_init_begin( index , dindex); if (fontname[dindex]) { vis5d_font( dindex, fontname[dindex], 0); } if (soundfontname[dindex]) { vis5d_soundfont( dindex, soundfontname[dindex]); } else{ vis5d_soundfont( dindex, DEFAULT_SOUNDFONTNAME); } if (do_once){ set_current_display(dindex); do_once = 0; } vis5d_init_memory( index, mbs[dindex] ); if (samescale[dindex]) { vis5d_init_samescale( dindex ); } if (vis5d_open_gridfile( index, v5dfile[dindex], preload[dindex] )<0) { vis5d_terminate(1); exit(0); } if (first_area[dindex]){ vis5d_init_firstarea(dindex, first_area[dindex]); } vis5d_alpha_mode( dindex, alpha[dindex] ); if (boxx[dindex] && boxy[dindex] && boxz[dindex]) { vis5d_init_box( dindex, boxx[dindex], boxy[dindex], boxz[dindex] ); } vis5d_init_map( dindex, mapname[dindex] ); if (path[dindex]) { vis5d_init_path( dindex, path[dindex] ); } if (sequence[dindex]){ vis5d_init_sequence( dindex, sequence[dindex] ); } if (texture[dindex]) { vis5d_init_texture( dindex, texture[dindex] ); } vis5d_init_topo_and_map_ctx( dindex, toponame[dindex], hirestopo[dindex]); vis5d_init_display_values ( index, dindex ); in_the_init_stage = 1; if (user_projection[dindex]>-1) { float projargs[100]; prompt_for_projection_args( dindex, user_projection[dindex], projargs ); vis5d_init_projection( dindex, user_projection[dindex], projargs ); vis5d_init_display_values ( index, dindex ); } else if (user_vertsys[dindex]>-1) { float vertargs[MAXLEVELS]; prompt_for_vertical_args( dindex, user_vertsys[dindex], vertargs ); vis5d_init_vertical( dindex, user_vertsys[dindex], vertargs ); vis5d_init_display_values ( index, dindex ); } /*****************/ /* display stuff */ /*****************/ vis5d_linewidth( dindex, linewidth[dindex] ); if (log_vcs[dindex]) { vis5d_init_log( dindex, 1, scale[dindex], exponent[dindex] ); } else{ vis5d_init_log( dindex, 0, scale[dindex], exponent[dindex] ); } if (vis5d_init_end( index )<0) { printf("Error in vis5d_init_end\n"); vis5d_terminate(1); exit(0); } /* setup trajectory and wind variables */ vis5d_set_wind_vars( dindex, index, vis5d_find_var(index,"U"), index, vis5d_find_var(index,"V"), index, vis5d_find_var(index,"W"), index, vis5d_find_var(index,u2[dindex]), index, vis5d_find_var(index,v2[dindex]), index, vis5d_find_var(index,w2[dindex]), index, vis5d_find_var(index,traju[dindex]), index, vis5d_find_var(index,trajv[dindex]), index, vis5d_find_var(index,trajw[dindex]) ); vis5d_set_sound_vars( index, index, vis5d_find_var(index,"T"), index, vis5d_find_var(index,"TD"), index, vis5d_find_var(index,"U"), index, vis5d_find_var(index,"V"), index, -1, 0, -1, 0, -1 ); if (verylarge[dindex] == 1) { vis5d_verylarge_mode(index, VIS5D_ON); } else if (verylarge[dindex] == 0) { vis5d_verylarge_mode(index, VIS5D_OFF); } if (barbs[dindex] == 1) vis5d_graphics_mode(dindex, VIS5D_BARBS, VIS5D_ON); else vis5d_graphics_mode(dindex, VIS5D_BARBS, VIS5D_OFF); if (julian[dindex] == 1) vis5d_graphics_mode(dindex, VIS5D_JULIAN, VIS5D_ON); else vis5d_graphics_mode(dindex, VIS5D_JULIAN, VIS5D_OFF); vis5d_check_dtx_volume( dindex, &volflag ); vis5d_set_legends(dindex, legend_position[dindex], legend_size[dindex], legendx[dindex], legendy[dindex]); /* MJK 4.5.99 */ /* if (funcpath[dindex]) { strcpy(gtx->funcpath, funcpath[dindex]); } */ in_the_init_stage = 0; } } switch(gopointer){ case 0: set_display_matrix( 1, 1); break; case 1: set_display_matrix( 1, 1); break; case 2: set_display_matrix( 1, 2); break; case 3: set_display_matrix( 2, 2); break; case 4: set_display_matrix( 2, 2); break; case 5: set_display_matrix( 2, 3); break; case 6: set_display_matrix( 2, 3); break; case 7: set_display_matrix( 3, 3); break; case 8: set_display_matrix( 3, 3); break; case 9: set_display_matrix( 3, 3); break; case 10: set_display_matrix( 3, 4); break; case 11: set_display_matrix( 3, 4); break; case 12: set_display_matrix( 3, 4); break; case 13: set_display_matrix( 4, 4); break; case 14: set_display_matrix( 4, 4); break; case 15: set_display_matrix( 4, 4); break; case 16: set_display_matrix( 4, 4); break; default: printf("somethings wrong in main.c with the filepointer\n"); } if (widescreen){ set_display_matrix(1,3); } get_display_matrix( &rows, &cols); gtx = create_gui_context(0); /* MJK 11.19.98 */ if (off_screen_rendering){ run_script( 0, script ); exit(0); } if (wdpy_name != NULL){ make_gui_BigWin( wdpy_name); strcpy( the_gui_dpy_name, wdpy_name); } else{ the_gui_dpy_name[0] = 0; GuiBigWin = 0; } gtx->AnimRate = animrate[0]; gtx->SoundCtrlWindow = 0; if (wdpy_name != NULL ){ gtx->othersnddpy = 1; } else { gtx->othersnddpy = 0; } if (nofile){ make_nodata_gui( 0, wdpy_name); } else{ make_gui( 0, v5dfile[0], wdpy_name, volflag ); } XMapWindow(GuiDpy, gtx->CpWindow); LUI_MoveResizeWindow( gtx->CpWindow, gtx->cpx, gtx->cpy, CP_WIDTH, gtx->CpHeight ); if (!nofile){ sprintf( swindowname," Skew-T and Vertical Plot Display (%s)", v5dfile[0] ); make_snd_window( 0, swindowname, gtx->SoundCtrlWindow, wdpy_name ); if (gtx->othersnddpy ){ vis5d_resize_sounding_window( gtx->context_index, 630, 600, gtx->cpx, 15); } } /* MJK 4.5.99 */ if (funcpath[0]){ strcpy(gtx->funcpath, funcpath[0]); } for (yo = 1; yo < rows*cols; yo++){ vis5d_create_display_context(yo); if(gopointer <= yo){ if (the_gui_dpy_name[0]==0){ make_nodata_gui( yo, NULL); } else{ make_nodata_gui( yo, the_gui_dpy_name); } /* MJK 4.5.99 */ if (funcpath[yo]){ gtx = get_gui_gtx(yo); strcpy(gtx->funcpath, funcpath[yo]); } } else{ make_another_gui(yo, 1); set_anim_rate(yo, animrate[yo]); } } map_all_windows(0); map_fake_windows(0); /* execute script specified by -script command line option */ if (script) { run_script( 0, script ); } main_loop(pipe_name); vis5d_terminate(1); return 0; } .