/[MITgcm]/MITgcm_contrib/darwinview/src/darwin.bash
ViewVC logotype

Diff of /MITgcm_contrib/darwinview/src/darwin.bash

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4 by marissa, Wed Aug 1 18:04:31 2007 UTC revision 1.5 by marissa, Fri Aug 3 14:37:49 2007 UTC
# Line 1  Line 1 
1  #include <GL/glut.h>  #!/bin/bash
 #include <stdlib.h>  
 #include <stdio.h>  
 #include <string.h>  
 #include <math.h>  
 #define WINDOW "image"  
 #define UP 101  
 #define DOWN 103  
 #define RIGHT 102  
 #define LEFT 100  
 #define MAX 700  
 #define SCALE .06  
   
 int NX, NY, NZ;  
   
 void do_byteswap_f32( float arr[], int nel ), global(), local( int, int, int );  
 void readnames( char[] ), readarray( float[], char[], int ), readjet(), readxz( float[], char[] );  
 void readyz( float[], char[] ), readdepths( char[] );  
 void TimerFunction( int ), stroke( char[], int, int );  
   
 float data[MAX][MAX*MAX], mxval, mnval, jet[64][3];  
 float globalmx=0, globalmn=100;  
 int win[MAX], ilev=1, howmany, sets, count=0, glo=0, usr=0, anim=0, endian=0;  
 int xmax, ymax, yoffset=0, xoffset=0, yz=0, logscale=0, xz=0, nonegs=1;  
 int depths[MAX], scaledepth=0, totaldepth=0, scalecount=0;  
 char initfns[MAX][MAX], fns[MAX][MAX][MAX];  
   
 void menu( int value ){           // called when menu is opened on right click  
   
  switch( value ){  
   case 1: usr=glo=0;            // unset glo & usr, sets local max/min  
           break;  
   case 2: glo=1;                // enables global max/min    
           usr=0;                // unsets usr  
           mxval=globalmx;       // sets max to globalmx  
           mnval=globalmn;       // sets min to globalmn  
           break;  
   case 3: usr=1;                // switch to user-set max/min  
           glo=0;                // unset glo  
           printf( "Max=" );  scanf( "%f", &mxval );  // prompt user for new max  
           printf( "Min=" );  scanf( "%f", &mnval );  // prompt user for new min  
           break;  
   case 4: logscale=( logscale+1 )%2;  // switch log scale on/off  
           break;  
   case 5: nonegs=( nonegs+1 )%2;      // switch allowance of negatives on/off  
           break;  
   case 6: endian=( endian+1 )%2;      // switch between big/little endian  
           break;  
  }  
  glutPostRedisplay();  
 }  
   
 void display(){                 // called on glutPostRedisplay  
  int i, j, h, ioff, q;  
  float r, g, b, k, y;  
  double num, logmx, logmn;  
  char str[MAX];  
   
   
  for( q=0; q<sets; q++ ){           // runs display func for each subwindow  
   glutSetWindow( win[q] );          // sets which subwindow to display to  
   glClear( GL_COLOR_BUFFER_BIT );   // background to black  
   
   if( xz ) {  xmax=NX;  ymax=NZ;  }  
   else{  
    if( yz ){  xmax=NY;  ymax=NZ;  }  
    else    {  xmax=NX;  ymax=NY;  }  
   }  
   
   if( glo || usr ){                  // if global or user-set max/min  
    if( xz )  
     readxz( data[q], fns[q][count] );  
    else{  
     if( yz )  
      readyz( data[q], fns[q][count] );  
     else  
      readarray( data[q], fns[q][count], ilev );  // read new array w/o calculating local max/min  
    }  
   }  
   else                              // if local max/min is set  
    local( q, count, ilev );         // read new array and calculate local max/min  
   
   if( logscale ){  
    if( usr ){  
     logmx=(double)mxval;  
     logmn=(double)mnval;  
    }  
    else{  
     logmx=log10( mxval );  
     logmn=log10( mnval );  
    }  
   }  
   
   if( scaledepth && xz || scaledepth && yz )  ymax=totaldepth;  
   ioff=0; h=0;                        // ioff will count both i&j b/c data is 1D  
   for( j=0; j<ymax; j++ ){            // cycles through y values  
    for( i=0; i<xmax; i++ ){           // cycles through x values  
     r=g=b=0;                          // set color values to black  
     if( data[q][ioff]==0 );           // if data=0, values stay black  
     else{  
      if( logscale ){  
       num=(double)data[q][ioff];  
       num=log10( num );  
       if( num<logmn ) num=0;  
       else{  
        if( num>logmx ) num=63;  
        else  
         num=63*( num-logmn )/( logmx-logmn );  
       }  
      }  
      else{  
       if( data[q][ioff]<mnval )  num=0;   // if data is less than min, =min  
       else{  
        if( data[q][ioff]>mxval )  num=63; // if data is more than max, =max  
        else  
         num=63*( data[q][ioff]-mnval )/( mxval-mnval );  // scale num from 0-63 (not defined for 64)  
       }  
      }  
      r=jet[(int)num][0];            // set red val  
      g=jet[(int)num][1];            // set green val  
      b=jet[(int)num][2];            // set blue val    
     }  
   
     glColor3f( r, g, b );           // put r, g, b into effect  
     if( scaledepth && xz || scaledepth && yz )  
      glRectf( i, j, i+1, j+depths[h] );  
     else  
      glRectf( i, j, i+1, j+1 );      // draws a square for data value  
     ioff++;                      
    }  
    if( scaledepth && xz || scaledepth && yz ){  
     j+=depths[h]-1;  
     h++;  
    }  
   }  
   
   glColor3f( 1, 1, 1 );             // set color to white  
   glRectf( xmax, 0, xmax+1, ymax+1 );     // draws a border  
   glRectf( 0, ymax, xmax, ymax+1 );       // draws a border    
   for( i=0; i<64; i++ ){            // draws color bar      
    glColor3f( jet[i][0], jet[i][1], jet[i][2]);         // sets color  
    k=(float)i;                      // turns i into a float  
    y=(float)ymax/64;                  // sets height of rectangles  
    glRectf( xmax+10, y*k, xmax+20, (k+1)*y );               // draws rectangle  
   }  
   glColor3f( 1, 1, 1 );             // color to white  
   
   if( logscale )  
    sprintf( str, "%.2f", logmx );  
   else  
    sprintf( str, "%.1e", mxval );    // labels color bar with max val  
   stroke( str, xmax+2, ymax-1 );  
     
   if( logscale )  
    sprintf( str, "%.2f", logmn );  
   else  
    sprintf( str, "%.1e", mnval );    // labels color bar with min val  
   stroke( str, xmax+2, 1 );  
   
   if( xz )  
    sprintf( str, "N-S slice %d", yoffset+1);  
   else{  
    if( yz )  
     sprintf( str, "E-W slice %d", xoffset+1);  
    else  
     sprintf( str, "Level %d", ilev ); // labels current level  
   }  
   stroke( str, 1, ymax+5 );  
   
   sprintf( str, "Time %d", count+1 ); // labels current time  
   stroke( str, xmax/2, ymax+5 );  
   
   if( glo )                         // labels how max/min have been set  
    sprintf( str, "Global" );        // if glo is set, display Global  
   if( usr )  
    sprintf( str, "User-set" );      // if usr is set, display User-set  
   if( !usr && !glo )  
    sprintf( str, "Local" );         // else display Local  
   stroke( str, xmax+8, ymax+8 );  
     
   if( anim ){                       // tell user if autoplay is on  
    sprintf( str, "Autoplay" );  
    stroke( str, xmax-35, ymax+8 );  
   }  
   
   if( logscale ){  
    sprintf( str, "Log Scale" );     // tell user if log scale is on  
    stroke( str, xmax-25, ymax+15);  
   }  
2    
3    stroke( fns[q][count], 1, ymax+15 ); // labels current file  mkdir -p .darwinview
   
   glutSwapBuffers();                // double buffering set to animate smoothly  
   glFlush();  
  }  
 }  
4    
5  void stroke( char str[], int x, int y ){  // called to display text onscreen  echo -n "What format is the data in? (netcdf/binary): "
6   int i;  read nb
7    
8   glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );  if [ $nb = 'binary' ]; then
  glEnable( GL_BLEND );  
  glEnable( GL_LINE_SMOOTH );  
  glMatrixMode( GL_MODELVIEW );  
9    
10   glPushMatrix();    echo -n "Would you like to use default settings? (y/n): "
11      read yn
12    
13   glScalef( SCALE, SCALE, SCALE );    if [ $yn = 'n' ]; then
  glTranslatef( (1/SCALE)*x, (1/SCALE)*y, 0 );  
   
  for( i=0; i<strlen( str ); i++)    // display each character of str  
   glutStrokeCharacter( GLUT_STROKE_ROMAN, str[i] );  
   
  glPopMatrix();  
 }  
   
 void key( unsigned char key, int x, int y ){   // called on key press  
  int i, tmp;  
   
  switch(key){  
   case 'q':   exit(0);              // quits on 'q'  
               break;  
   case 'r':   count=0;              // resets back to first time      
               ilev=1;               // and first level  
               break;  
   case 'a':   anim=(anim+1)%2;      // turns anim on/off  
               break;  
   case 'x':   xz=(xz+1)%2;  
               yz=0;  
               break;  
   case 'y':   yz=(yz+1)%2;  
               xz=0;  
               break;  
   case 'z':   if( xz || yz ){  
                scaledepth=( scaledepth+1 )%2;  
                scalecount++;  
                if( scalecount==1 )  
                 readdepths( ".darwinview/depths" );  
               }  
               break;  
  }  
  glutPostRedisplay();  
 }  
   
 void TimerFunction( int value ){    // called when anim is set and arrow key is pressed  
  int i;  
   
  switch(value){                     // increments in the correct direction  
   case DOWN : if( xz && yoffset>0 )  
                yoffset--;  
               else{  
                if( yz && xoffset<NX-1 )  
                 xoffset++;  
                else  
                 if( ilev<NZ && !xz && !yz )  
                  ilev++;              // if down arrow pressed, move down a level        
               }  
               break;  
   case UP   : if( xz && yoffset<NY-1 )  
                yoffset++;  
               else{  
                if( yz && xoffset>0 )  
                 xoffset--;  
                else  
                 if( ilev>1 && !xz && !yz )      
                  ilev--;              // if up arrow is pressed, move up a level  
               }  
               break;  
   case LEFT : if( count>0 )        
                count--;             // if left arrow is pressed, move back one time step  
               break;  
   case RIGHT: if( count<howmany-1 )  
                count++;             // if right arrow is pressed, moves forward one time step  
               break;  
  }  
   
  glutPostRedisplay();              
14    
15   if ( anim )      rm -f .darwinview/binfilenames
16    switch( value ){          rm -f .darwinview/*.datbin
    case DOWN : if( xz && yoffset==0 )  
                 yoffset=NY-1;  
                else{  
                 if( yz && xoffset==NX-1 )  
                  xoffset=0;  
                 else  
                  if( ilev==NZ && !xz && !yz )  
                   ilev=1;                   // if end reached, restart  
                }  
                glutTimerFunc( 100, TimerFunction, value ); // recalls itself  
                break;  
    case UP   : if( xz && yoffset==NY-1 )  
                 yoffset=0;  
                else{  
                 if( yz && xoffset==0 )  
                  xoffset=NX-1;  
                 else  
                  if( ilev==1 )  
                   ilev=NZ;                   // if end reached, restart  
                }  
                glutTimerFunc( 100, TimerFunction, value ); // recalls itself  
                break;  
    case LEFT : if( count==0 ) count=howmany-1;             // if end reached, restart  
                glutTimerFunc( 100, TimerFunction, value ); // recalls itself  
                break;  
    case RIGHT: if( count==howmany-1 ) count=0;             // if end reached, restart                  
                glutTimerFunc( 100, TimerFunction, value ); // recalls itself  
                break;  
   }  
 }  
   
 void specialkey( int key, int x, int y ){  
  int i;  
   
  if( anim )                       // if animation is set, call the timer function  
   glutTimerFunc( 100, TimerFunction, key);             // to scroll automatically  
   
  switch(key){  
   case DOWN   :  if( xz && yoffset>0 )  
                   yoffset--;  
                  else{  
                   if( yz && xoffset<NY-1 )  
                    xoffset++;  
                   else  
                    if( ilev<NZ && !xz && !yz )      // if you haven't reached the bottom  
                     ilev++;              // keep going down  
                  }  
                  break;  
   case UP     :  if( xz && yoffset<NY-1 )  
                   yoffset++;  
                  else{  
                   if( yz && xoffset>0 )  
                    xoffset--;  
                   else  
                    if( ilev>1 )          // if you haven't reached the top  
                     ilev--;              // keep going up  
                  }  
                  break;  
   case RIGHT  :  if( count<howmany-1 ) // if you haven't reached the last file  
                   count++;             // keep going right  
                  break;  
   case LEFT   :  if( count>0 )         // if you haven't reached the first file  
                   count--;             // keep going left  
                  break;  
  }  
  glutPostRedisplay();              
 }  
   
 void global(){                         // calculates the max/min for the total data set  
  FILE* fp;  
  int h, i, j;  
  for( h=0; h<sets; h++)                // cycles through each window  
   for( i=0; i<howmany; i++ )           // cycles through each time  
    for( j=0; j<NZ; j++ ){              // cycles through each level for each file  
     local( h, i, j );                  // calculates local max/min for specific data set  
     if( mxval > globalmx ) globalmx = mxval;   // sets highest value to globalmx  
     if( mnval < globalmn ) globalmn = mnval;   // sets lowest value to globalmn  
    }  
 }  
17    
18  void local( int i, int time, int lev ){        // calculates local max/min      xrandr | grep '*' | awk -F' ' '{print $1}' > .darwinview/binconfig
19   int j;      echo -n "Please enter dimensions of data: "
20        read dim
21   mxval=0;        echo $dim >> .darwinview/binconfig
22   mnval=100;      echo -n "Please enter dimensions of data sets: "
23   if( xz )      read dimset
24    readxz( data[i], fns[i][time]);      echo $dimset >> .darwinview/binconfig
25   else{      echo .darwinview/binfilenames >> .darwinview/binconfig
26    if( yz )      echo -n "Please enter directory containing data: "
27     readyz( data[i], fns[i][time]);      read dir
   else  
    readarray( data[i], fns[i][time], lev );      // read new array of data  
  }  
  for( j=0; j<xmax*ymax; j++ ){  
   if( data[i][j] > mxval )  
    mxval=data[i][j];                           // set largest val to mxval  
   if( data[i][j] < mnval && data[i][j]!=0 )  
    mnval=data[i][j];                           // set smallest positive val to mnval  
  }  
 }  
   
 void readnames( char filename[] ){             // reads in list of filenames  
  FILE* fp;  
  int i=0, j=0;  
   
  fp=fopen( filename, "r" );                    // opens list of filenames  
  while( !feof(fp) ){                           // reads until the end of the file  
   fscanf( fp, "%s", initfns[i] );              // places filename into an array of strings  
   i++;                                         // counts how many filenames there are    
  }  
  fclose( fp );                                 // close file  
  sets=i-1;                                  // saves number of initial filenames  
   
  for(i=0; i<sets; i++){                     // goes through each read-in filename  
   fp=fopen( initfns[i], "r" );                 // opens each filename    
   j=0;  
   while( !feof(fp) ){                          // reads in filenames from each filename  
    fscanf( fp, "%s", fns[i][j]);                
    j++;  
   }  
   fclose(fp);                                  // close file  
  }  
  howmany=j-1;                                  // saves number of data filenames    
 }  
   
 void readdepths( char filename[] ){  
  int i;  
  FILE* fp;  
   
  fp=fopen( filename, "r" );  
   
  for( i=NZ-1; i>=0; i-- ){  
   fscanf( fp, "%d ", &depths[i] );  
   totaldepth+=depths[i];  
  }  
   
  fclose( fp );  
 }  
   
 void readjet(){               //reads in color scale values  
  FILE* fp;  
  int i, j;  
28        
29   fp=fopen( ".darwinview/jet.h", "r" );  // opens file containing values      echo -n "Please enter name of file containing desired species: "
30   for( i=0; i<64; i++ )        // reads in 64 sets of r, g, b values      read fn
   for( j=0; j<3; j++ )  
    fscanf( fp, "%f", &jet[i][j] );  
  fclose( fp );                // closes file  
 }  
   
 void readxz( float arr[], char filename[] ){  
  int i, j;  
  float tmp[MAX][MAX], tmp2[MAX*MAX];  
  FILE* fp;  
   
  fp=fopen( filename, "rb" );    
  for( i=0; i<NZ; i++){  
   fseek( fp, (NX*yoffset*4)+(i*NX*NY*4), SEEK_SET );  
   fread( &arr[NX*i], sizeof( arr[0] ), NX, fp );  // reads in data to fill one level  
  }  
  fclose( fp );  
   
  for( i=0; i<NZ; i++ )  
   for( j=0; j<NX; j++)  
    tmp[i][j]=arr[i*NX+j];  
   
  for( i=0; i<NZ; i++ )  
   for( j=0; j<NX; j++)  
    tmp2[i*NX+j]=tmp[NZ-i-1][j];  
   
  for( i=0; i<NX*NZ; i++)  
   arr[i]=tmp2[i];  
 }  
   
 void readyz( float arr[], char filename[] ){  
  int i, j;  
  float tmp[MAX][MAX], tmp2[MAX*MAX];  
  FILE* fp;    
   
  fp=fopen( filename, "rb" );  
  for( i=0; i<NY*NZ; i++ ){  
   fseek( fp, (xoffset*4)+(i*NX*4), SEEK_SET );  
   fread( &arr[i], sizeof( arr[0] ), 1, fp );  
  }  
  fclose(fp);  
   
  for( i=0; i<NZ; i++ )  
   for( j=0; j<NY; j++)  
    tmp[i][j]=arr[i*NY+j];  
   
  for( i=0; i<NZ; i++ )  
   for( j=0; j<NY; j++)  
    tmp2[i*NY+j]=tmp[NZ-i-1][j];  
   
  for( i=0; i<NY*NZ; i++)  
   arr[i]=tmp2[i];  
 }  
   
 void readarray( float arr[], char filename[], int il ){   // reads new data  
  FILE* fp;  
  int i;  
31    
32   fp=fopen( filename, "rb" );                 // opens the file containing data      vn=( `cat $fn` )
  fseek( fp, (il-1)*NX*NY*4, SEEK_SET );      // seeks to the correct place using ilev  
  fread( arr, sizeof( arr[0] ), NX*NY, fp );  // reads in data to fill one level  
  fclose( fp );                               // close file  
   
  if( nonegs )  
   for( i=0; i<NX*NY; i++ )                      
    if( arr[i] < 0 )  
     arr[i] = pow(10, -20);   // sets negative values to 10^-20  
   
  if( endian )  
   do_byteswap_f32( arr, NX*NY );            // switches endian  
 }  
   
 void do_byteswap_f32( float arr[], int nel ){ // switches endian  
   
  int i;  
  char src[4], trg[4];  
   
  for( i=0; i<nel; i++ ){  
   memcpy( src, &(arr[i]), 4 );  
   trg[0]=src[3];  
   trg[1]=src[2];  
   trg[2]=src[1];  
   trg[3]=src[0];  
   memcpy( &(arr[i]), trg, 4 );  
  }  
 }  
   
 void black( ){  
  glClear( GL_COLOR_BUFFER_BIT );  
  glutSwapBuffers();  
  glFlush();  
 }  
   
   
 int main( int argc, char *argv[] ){  
  int i, setsx, setsy, tmpx, tmpy, winx, winy, parent;  
  char str[MAX], filename[MAX];  
  FILE* fp;  
   
  if( strcmp(argv[1], "binary") == 0 )  
   fp=fopen( ".darwinview/binconfig", "r" );  
  else  
   if( strcmp(argv[1],"netcdf") == 0 )  
    fp=fopen( ".darwinview/ncconfig", "r" );  
   
  fscanf( fp, "%dx%d ", &winx, &winy );  
  winy-=60;  winx-=20;                     // adjusts resolution so edges won't get cut off              
  fscanf( fp, "%d %d %d ", &NX, &NY, &NZ );  
  fscanf( fp, "%dx%d ", &setsx, &setsy );                // prompts user for dimensions of subwindows  
  fscanf( fp, "%s", filename );  
33    
34   fclose( fp );      for name in ${vn[@]}; do
35          touch .darwinview/$name.datbin
36   xmax=NX; ymax=NY;        echo .darwinview/$name.datbin >> .darwinview/binfilenames
37          for i in `ls $dir`; do
38   readjet();                               // stores color values          echo $dir/$i/`ls $dir/$i | grep $name` >> .darwinview/$name.datbin
39   readnames( filename );                   // gets list of filenames to read from        done
40   global();                                // calculates max and min for all data      done
41    
42   glutInit( &argc, argv );                    fi
43   glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );   // sets rgb mode and double buffering  
44   glutInitWindowSize( winx, winy );                // parent window will cover screen  elif [ $nb = 'netcdf' ]; then
45   glutInitWindowPosition( 10, 10 );                // location of parent window  
46   parent=glutCreateWindow( WINDOW );               // creates parent window    echo -n "Would you like to use default settings? (y/n): "
47      read yn
48   glClearColor( 0, 0, 0, 0 );                      // sets clear color to black  
49   gluOrtho2D( 0, winx , winy, 0 );                 // sets(0,0) as top left corner    if [ $yn = 'n' ]; then
50   glutDisplayFunc( display );  
51   glutKeyboardFunc( key );                         // called on key press      rm -f .darwinview/ncfilenames
52   glutSpecialFunc( specialkey );                   // called on special key press (arrow keys)      rm -f .darwinview/*.datnc
53    
54        xrandr | grep '*' | awk -F' ' '{print $1}' > .darwinview/ncconfig
55   for( i=0; i<setsx*setsy; i++ ){      echo -n "Please enter dimensions of data: "
56    tmpx = (i%setsx)*(winx/setsx);                  // x coordinate of top left corner of subwindow      read dim
57    tmpy = (i/setsx)*(winy/setsy);                  // y coordinate of top left corner of subwindow      echo $dim >> .darwinview/ncconfig
58        echo -n "Please enter dimensions of data sets: "
59    win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow      read dimset
60    gluOrtho2D( 0, NX+35, 0, NY+25 );               // sets how data is mapped to subwindow      echo $dimset >> .darwinview/ncconfig
61    glutKeyboardFunc( key );                        // called on key press      echo .darwinview/ncfilenames >> .darwinview/ncconfig
62    glutSpecialFunc( specialkey );                  // called on special key press (arrow keys)  
63    if( i >= sets )                                 //      echo -n "Please enter directory containing data: "
64     glutDisplayFunc( black );      read tmp
65    else      echo $tmp > .darwinview/netcdf
66     glutDisplayFunc( display );                     // sets display func for subwindow      echo -n "Please enter directory to write to: "
67          read tmp
68        echo $tmp >> .darwinview/netcdf
69    
70        echo -n "Please enter name of file containing desired species: "
71        read tmp
72        echo $tmp >> .darwinview/netcdf
73        echo -n "Please enter name of file containing desired tiles: "
74        read tmp
75        echo $tmp >> .darwinview/netcdf
76        echo -n "Please enter name of file containing desired time steps: "
77        read tmp
78        echo $tmp >> .darwinview/netcdf
79    
80      fi
81    
82      indir=( `cat .darwinview/netcdf | head -1` )
83      outdir=( `cat .darwinview/netcdf | head -2 | tail -1` )
84      fn=( `cat .darwinview/netcdf | head -3 | tail -1` )
85      vn=( `cat $fn` )
86      fn=( `cat .darwinview/netcdf | head -4 | tail -1` )
87      tlist=( `cat $fn` )
88      fn=( `cat .darwinview/netcdf | tail -1` )
89      itlist=( `cat $fn` )
90    
91      initdir=`pwd`
92      gcc netcdf.c -I/usr/include/netcdf-3 -L/usr/lib/netcdf-3 -lnetcdf
93      for tstep in ${itlist[@]}; do
94        cd $initdir
95        cd $outdir
96        mkdir -p $tstep
97        cd $tstep
98        for name in ${vn[@]}; do
99          for tile in ${tlist[@]}; do
100            $initdir/a.out ~/${indir}/ptr_tave.${tstep}.${tile}.nc $name
101          done
102        done
103      done
104    
105      cd $initdir
106    
107      for name in ${vn[@]}; do
108        echo $name
109        touch .darwinview/$name.datnc
110        echo .darwinview/$name.datnc >> .darwinview/ncfilenames
111        for i in `ls $outdir`; do
112          echo $outdir/$i/`ls $outdir/$i | grep $name` >> .darwinview/$name.datnc
113        done
114      done
115    
116    glutCreateMenu( menu );                                // adds a menu  fi
    glutAddMenuEntry( "Local Color Scale", 1 );           // adds a menu entry  
    glutAddMenuEntry( "Global Color Scale", 2 );          // adds a menu entry  
    glutAddMenuEntry( "User-Set Color Scale", 3 );        // adds a menu entry  
    glutAddMenuEntry( "Log Scale (on/off)", 4 );          // adds a menu entry  
    glutAddMenuEntry( "Allow Negatives (on/off)", 5 );    // adds a menu entry  
    glutAddMenuEntry( "Switch Endian (big/little) ", 6);  // adds a menu entry  
   glutAttachMenu( GLUT_RIGHT_BUTTON );                   // menu called on right click  
  }  
   
  glutMainLoop();                                  // begin processing events  
  return 0;  
 }  
117    
118    gcc darwin.c -lglut
119    ./a.out $nb

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22