--- MITgcm_contrib/darwinview/src/darwin.c 2007/07/24 16:53:55 1.6 +++ MITgcm_contrib/darwinview/src/darwin.c 2007/08/01 18:04:15 1.7 @@ -9,58 +9,58 @@ #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[] ); -void TimerFunction( int ), bitmap( char[], int, int ); +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, logscale=0, xz=0, nonegs=1, endian=0; -int xmax, ymax, yoffset=0, xoffset=0, yz=0; +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 - glutPostRedisplay(); // recall display func with new values 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 - glutPostRedisplay(); // recall display func with new values 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 - glutPostRedisplay(); // recall display func with new values break; - case 4: logscale=(logscale+1)%2; // switch log scale on/off - glutPostRedisplay(); + case 4: logscale=( logscale+1 )%2; // switch log scale on/off break; - case 5: nonegs=(nonegs+1)%2; // switch allowance of negatives on/off - glutPostRedisplay(); + case 5: nonegs=( nonegs+1 )%2; // switch allowance of negatives on/off break; - case 6: endian=(endian+1)%2; // switch between big/little endian - glutPostRedisplay(); + case 6: endian=( endian+1 )%2; // switch between big/little endian break; } + glutPostRedisplay(); } + void display(){ // called on glutPostRedisplay - int i, j, ioff, q; + int i, j, h, ioff, q; float r, g, b, k, y; double num, logmx, logmn; char str[MAX]; + for( q=0; q=0; i-- ){ + fscanf( fp, "%d ", &depths[i] ); + totaldepth+=depths[i]; + } + + fclose( fp ); +} + void readjet(){ //reads in color scale values FILE* fp; int i, j; @@ -497,7 +536,7 @@ fclose( fp ); xmax=NX; ymax=NY; - + readjet(); // stores color values readnames( filename ); // gets list of filenames to read from global(); // calculates max and min for all data @@ -520,7 +559,7 @@ tmpy = (i/setsx)*(winy/setsy); // y coordinate of top left corner of subwindow win[i]=glutCreateSubWindow( parent, tmpx, tmpy, winx/setsx, winy/setsy ); // creates subwindow - gluOrtho2D( 0, NX+35, 0, NY+15 ); // sets how data is mapped to subwindow + gluOrtho2D( 0, NX+35, 0, NY+25 ); // sets how data is mapped to subwindow glutKeyboardFunc( key ); // called on key press glutSpecialFunc( specialkey ); // called on special key press (arrow keys) if( i >= sets ) //