[cig-commits] r14630 - mc/1D/hc/trunk

becker at geodynamics.org becker at geodynamics.org
Wed Apr 8 13:26:50 PDT 2009


Author: becker
Date: 2009-04-08 13:26:49 -0700 (Wed, 08 Apr 2009)
New Revision: 14630

Modified:
   mc/1D/hc/trunk/Makefile.craig
   mc/1D/hc/trunk/README.TXT
   mc/1D/hc/trunk/ggrd_grdtrack_util.c
   mc/1D/hc/trunk/ggrd_grdtrack_util.h
   mc/1D/hc/trunk/ggrd_readgrds.c
   mc/1D/hc/trunk/ggrd_struc.h
   mc/1D/hc/trunk/make_tar
   mc/1D/hc/trunk/sh_ana.c
Log:
Made GMT 4 the default choice, now USE_GMT3 needs to be defined for older GMT versions.



Modified: mc/1D/hc/trunk/Makefile.craig
===================================================================
--- mc/1D/hc/trunk/Makefile.craig	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/Makefile.craig	2009-04-08 20:26:49 UTC (rev 14630)
@@ -52,7 +52,7 @@
 PREM_DEFINES = -DPREM_MODEL_FILE=\"$(PWD)/prem/prem.dat\"
 PREM_INCS = prem.h
 #
-# GMT grd handling, need to define USE_GMT4 for version 4.0
+# GMT grd handling
 #
 GGRD_SRCS = ggrd_velinterpol.c ggrd_readgrds.c ggrd_grdtrack_util.c
 GGRD_OBJS = $(ODIR)/ggrd_velinterpol.o $(ODIR)/ggrd_readgrds.o $(ODIR)/ggrd_grdtrack_util.o
@@ -64,7 +64,7 @@
 #GGRD_INC_FLAGS = -I$(GMTHOME)/include -I$(NETCDFHOME)/include 
 #GGRD_LIBS_LINKLINE = -lggrd -lgmt -lnetcdf 
 # for GMT 4.0
-GGRD_INC_FLAGS = -I$(GMTHOME)/include -I$(NETCDFHOME)/include -DUSE_GMT4
+GGRD_INC_FLAGS = -I$(GMTHOME)/include -I$(NETCDFHOME)/include 
 GGRD_LIBS_LINKLINE = -lggrd -lgmt -lpsl -lnetcdf 
 #
 #

Modified: mc/1D/hc/trunk/README.TXT
===================================================================
--- mc/1D/hc/trunk/README.TXT	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/README.TXT	2009-04-08 20:26:49 UTC (rev 14630)
@@ -1,8 +1,8 @@
 INSTALLATION
 
 The code should compile on any basic UNIX/Linux system with the GMT
-tools and libraries installed. See the Makefile for comments and what
-to modify. 
+tools (by default, version > 4.2.1) and libraries installed. See the
+Makefile for comments and what to modify.
 
 
 What is described below is the hc Hager & O'Connell (1981) forward
@@ -33,12 +33,10 @@
 Also, the Makefile uses the commonly defined compiler variables CC,
 F77, CFLAGS, LD, and LDFLAGS.
 
-One common problem is the interface of the ggrd_ subroutines with
-GMT. By default, the Makefile is set up for the old syntac of GMT
-version 3.4.5. The other alternative is to use 4.1.2 and upward (note
-that there were changes between 4.0 and 4.1.2). If you have GMT newer
-or equal to 4.1.2, uncomment the two corresponding lines in the
-Makefile.
+By default, the Makefile is set up for the new syntax of GMT version
+4.1.2 and higher. The alternative is to use GMT3, which can be done by
+defining -DUSE_GMT3 and modifying the two corresponding lines in the
+Makefile.include.
 
 With all things set up, you should be able to type 
 

Modified: mc/1D/hc/trunk/ggrd_grdtrack_util.c
===================================================================
--- mc/1D/hc/trunk/ggrd_grdtrack_util.c	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/ggrd_grdtrack_util.c	2009-04-08 20:26:49 UTC (rev 14630)
@@ -399,7 +399,7 @@
 initialize
 
 */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
 int ggrd_grdtrack_init(double *west, double *east,double *south, double *north, 
 			/* geographic bounds,
 			   set all to zero to 
@@ -450,7 +450,7 @@
   ogrd.x_min = ogrd.y_min =ogrd.x_max = ogrd.y_max = -100;
   ogrd.x_inc = ogrd.y_inc = -1;
   ogrd.node_offset = 0;ogrd.nx = ogrd.ny = -1;
-#ifdef USE_GMT4
+#ifndef USE_GMT3
 
   if(!gmt_init){
     /* this should be OK as is. init only once globally */
@@ -564,14 +564,14 @@
     GMT_memory (*edgeinfo, (size_t)(*nz), sizeof(struct GMT_EDGEINFO), "ggrd_grdtrack_init");
   if(verbose >= 2)
     fprintf(stderr,"ggrd_grdtrack_init: mem alloc ok\n");
-#ifdef USE_GMT4  
+#ifndef USE_GMT3  
   /* init the header */
   GMT_grd_init (*grd,0,&cdummy,FALSE);
 #endif
   if(*nz == 1){
     if(verbose >= 2)
       
-#ifndef USE_GMT4		/* old */
+#ifdef USE_GMT3		/* old */
       fprintf(stderr,"ggrd_grdtrack_init: opening single file %s, GMT3 mode\n",grdfile);
     if (GMT_cdf_read_grd_info (grdfile,(*grd))) {
       fprintf (stderr, "%s: error opening file %s\n", 
@@ -592,7 +592,7 @@
     /* loop through headers for testing purposess */
     for(i=0;i<(*nz);i++){
       sprintf(filename,"%s.%i.grd",grdfile,i+1);
-#ifndef USE_GMT4
+#ifdef USE_GMT3
       if (GMT_cdf_read_grd_info (filename, (*grd+i))) {
 	fprintf (stderr, "%s: error opening file %s (-D option was used)\n", 
 		 "ggrd_grdtrack_init", filename);
@@ -697,7 +697,7 @@
     /* 
        read the grd files
     */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
     /* GMT 4 */
     if (GMT_read_grd (filename,(*grd+i), (*f+i* (*mm)), 
 		      *west, *east, *south, *north, 
@@ -726,7 +726,7 @@
 	 all grids as long as they have the same dimensions
 
       */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
       GMT_bcr_init ((*grd+i), pad, bilinear,1.0,loc_bcr);
 #else
       my_GMT_bcr_init ((*grd+i), pad, bilinear,loc_bcr);
@@ -775,7 +775,7 @@
 interpolate value 
 
  */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
 ggrd_boolean ggrd_grdtrack_interpolate(double *in, /* lon/lat/z [2/3] in degrees/km */
 					ggrd_boolean three_d, /* use 3-D inetrpolation or 2-D? */
 					struct GRD_HEADER *grd, /* grd information */
@@ -847,7 +847,7 @@
        
        
     */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
     val1 = GMT_get_bcr_z((grd+i1), in[0], in[1], (f+i1*mm), (edgeinfo+i1),loc_bcr);
     val2 = GMT_get_bcr_z((grd+i2), in[0], in[1], (f+i2*mm), (edgeinfo+i2),loc_bcr);
 #else
@@ -863,7 +863,7 @@
     *value += fac2 * val2;
   }else{
     /* single layer */
-#ifdef USE_GMT4
+#ifndef USE_GMT3
     *value = GMT_get_bcr_z(grd, in[0], in[1], f, edgeinfo,loc_bcr);
 #else
     ggrd_global_bcr_assign(loc_bcr);
@@ -1456,7 +1456,7 @@
     mean += x[i];
   return mean/(float)n;
 }
-#ifndef USE_GMT4
+#ifdef USE_GMT3
 /* 
 
 this is aweful, but works?

Modified: mc/1D/hc/trunk/ggrd_grdtrack_util.h
===================================================================
--- mc/1D/hc/trunk/ggrd_grdtrack_util.h	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/ggrd_grdtrack_util.h	2009-04-08 20:26:49 UTC (rev 14630)
@@ -19,7 +19,7 @@
 #include <string.h>
 #include <math.h>
 
-#ifdef USE_GMT4
+#ifndef USE_GMT3
 #define GGRD_GMT_GLOBAL_STRING "-fg"
 #define GGRD_GMT_XPERIODIC_STRING "-fx"
 #else
@@ -67,8 +67,8 @@
 int ggrd_init_thist_from_file(struct ggrd_t *,char *,ggrd_boolean ,ggrd_boolean);
 int ggrd_read_vel_grids(struct ggrd_master *, double, unsigned short, unsigned short, char *);
 
-#ifdef USE_GMT4
-/* GMT4.1.2 */
+#ifndef USE_GMT3
+/* GMT >4.1.2 */
 ggrd_boolean ggrd_grdtrack_interpolate(double *, ggrd_boolean , struct GRD_HEADER *, float *,
 					struct GMT_EDGEINFO *, int, float *, int ,	double *,ggrd_boolean,
 					struct GMT_BCR *);

Modified: mc/1D/hc/trunk/ggrd_readgrds.c
===================================================================
--- mc/1D/hc/trunk/ggrd_readgrds.c	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/ggrd_readgrds.c	2009-04-08 20:26:49 UTC (rev 14630)
@@ -107,7 +107,7 @@
     mean[4],ddummy,*weights,theta,tmp=0.0;
   /* gmt  */
   struct GRD_HEADER header[1];
-#ifdef USE_GMT4
+#ifndef USE_GMT3
   GMT_io_init ();/* Init the table i/o structure */
   GMT_grdio_init();
   GMT_program = "g";
@@ -241,7 +241,7 @@
 	    sprintf(sname,"%s%svp.%i.%s",
 		    prefix,loc_prefix,level,suffix);
 	  if(ggrd->v.read_gmt){
-#ifndef USE_GMT4	    	/* old */
+#ifdef USE_GMT3	    	/* old */
 	    if(GMT_cdf_read_grd_info (sname,header) == -1){
 	      fprintf(stderr,"ggrd_read_vel_grids: error opening GMT grd file %s\n",sname);
 	      return(-2);
@@ -368,7 +368,7 @@
 	    }
 	  }
 	  if(ggrd->v.read_gmt){
-#ifdef USE_GMT4
+#ifndef USE_GMT3
 	    GMT_read_grd (sname,header,fgrd, 0.0, 0.0, 0.0, 0.0, 
 			  dummy,0);
 #else

Modified: mc/1D/hc/trunk/ggrd_struc.h
===================================================================
--- mc/1D/hc/trunk/ggrd_struc.h	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/ggrd_struc.h	2009-04-08 20:26:49 UTC (rev 14630)
@@ -77,7 +77,7 @@
 
   double west,east,south,north;
 
-#ifdef USE_GMT4
+#ifndef USE_GMT3
   struct GMT_BCR loc_bcr[1];
 #else
   struct BCR loc_bcr[1];

Modified: mc/1D/hc/trunk/make_tar
===================================================================
--- mc/1D/hc/trunk/make_tar	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/make_tar	2009-04-08 20:26:49 UTC (rev 14630)
@@ -2,7 +2,7 @@
 #
 # create a tar file 
 #
-ver=${1-0.1.6}
+ver=${1-1.0}
 date=`date '+%m%d%y'`
 
 tf=$HOME/tmp/hc-$ver.$date.tgz 

Modified: mc/1D/hc/trunk/sh_ana.c
===================================================================
--- mc/1D/hc/trunk/sh_ana.c	2009-04-08 20:24:59 UTC (rev 14629)
+++ mc/1D/hc/trunk/sh_ana.c	2009-04-08 20:26:49 UTC (rev 14630)
@@ -80,7 +80,7 @@
       sscanf(argv[2],"%i",&ivec);
     else{
       /* GMT grd file input */
-#ifdef USE_GMT4      
+#ifndef USE_GMT3      
       failed = ggrd_grdtrack_init_general(FALSE,argv[2],&cdummy,"-fg",ggrd,TRUE,FALSE);
 #else
       failed = ggrd_grdtrack_init_general(FALSE,argv[2],&cdummy,"-Lg",ggrd,TRUE,FALSE);
@@ -90,7 +90,7 @@
 	exit(-1);
       }
       if(strcmp(argv[2],"vec_t.grd")==0){ /* vectors */
-#ifdef USE_GMT4      
+#ifndef USE_GMT3      
 	failed = ggrd_grdtrack_init_general(FALSE,"vec_p.grd",&cdummy,"-fg",(ggrd+1),TRUE,FALSE);
 #else
 	failed = ggrd_grdtrack_init_general(FALSE,"vec_p.grd",&cdummy,"-Lg",(ggrd+1),TRUE,FALSE);



More information about the CIG-COMMITS mailing list