[cig-commits] r18787 - mc/3D/CitcomS/branches/eheien_dev/lib

emheien at geodynamics.org emheien at geodynamics.org
Wed Jul 20 14:20:11 PDT 2011


Author: emheien
Date: 2011-07-20 14:20:11 -0700 (Wed, 20 Jul 2011)
New Revision: 18787

Modified:
   mc/3D/CitcomS/branches/eheien_dev/lib/Advection_diffusion.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Composition_related.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Full_parallel_related.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Full_sphere_related.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Full_tracer_advection.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Global_operations.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Initial_temperature.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Instructions.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Regional_sphere_related.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Regional_tracer_advection.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Size_does_matter.c
   mc/3D/CitcomS/branches/eheien_dev/lib/Viscosity_structures.c
   mc/3D/CitcomS/branches/eheien_dev/lib/global_defs.h
   mc/3D/CitcomS/branches/eheien_dev/lib/tracer_defs.h
Log:
Fixes for C++ compatibility with min/max functions


Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Advection_diffusion.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Advection_diffusion.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Advection_diffusion.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -177,12 +177,12 @@
 	uc = fabs(uc1)/E->eco[m][el].size[1] + fabs(uc2)/E->eco[m][el].size[2] + fabs(uc3)/E->eco[m][el].size[3];
 
 	step = (0.5/uc);
-	adv_timestep = min(adv_timestep,step);
+	adv_timestep = citmin(adv_timestep,step);
       }
 
     adv_timestep = E->advection.dt_reduced * adv_timestep;
 
-    adv_timestep = 1.0e-32 + min(E->advection.fine_tune_dt*adv_timestep,
+    adv_timestep = 1.0e-32 + citmin(E->advection.fine_tune_dt*adv_timestep,
 				 E->advection.diff_timestep);
 
     E->advection.timestep = global_fmin(E,adv_timestep);
@@ -324,7 +324,7 @@
     for(el=1;el<=E->lmesh.nel;el++)  {
       for(d=1;d<=E->mesh.nsd;d++)    {
 	ts = E->eco[m][el].size[d] * E->eco[m][el].size[d];
-	diff_timestep = min(diff_timestep,ts);
+	diff_timestep = citmin(diff_timestep,ts);
       }
     }
 

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Composition_related.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Composition_related.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Composition_related.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -391,7 +391,7 @@
                 /* truncate composition at 1.0 */
                 /* This violates mass conservation but prevents unphysical C */
                 /* XXX: make truncation a switch for the user to specify */
-                E->composition.comp_el[j][i][e] = min(comp,one);
+                E->composition.comp_el[j][i][e] = citmin(comp,one);
 
             }
         }

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Full_parallel_related.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Full_parallel_related.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Full_parallel_related.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -72,7 +72,7 @@
     parallel_process_termination();
     }
 
-  E->sphere.caps_per_proc = max(1,E->sphere.caps*E->parallel.nprocz/E->parallel.nproc);
+  E->sphere.caps_per_proc = citmax(1,E->sphere.caps*E->parallel.nprocz/E->parallel.nproc);
 
   if (E->sphere.caps_per_proc > 1) {
     if (E->parallel.me==0) fprintf(stderr,"!!!! # caps per proc > 1 is not supported.\n \n");
@@ -917,7 +917,7 @@
  sizeofk = 0;
  for (k=1;k<=E->parallel.TNUM_PASSz[lev];k++)  {
    kk = (1+E->parallel.NUM_NEQz[lev].pass[k])*sizeof(double);
-   sizeofk = max(sizeofk, kk);
+   sizeofk = citmax(sizeofk, kk);
  }
  RV=(double *)malloc( sizeofk );
  SV=(double *)malloc( sizeofk );
@@ -1032,7 +1032,7 @@
  idb= 0;
  for (k=1;k<=E->parallel.TNUM_PASSz[lev];k++)  {
    sizeofk = (1+E->parallel.NUM_NODEz[lev].pass[k])*sizeof(double);
-   idb = max(idb,sizeofk);
+   idb = citmax(idb,sizeofk);
  }
 
  RV=(double *)malloc( idb );
@@ -1154,7 +1154,7 @@
  idb= 0;
  for (k=1;k<=E->parallel.TNUM_PASSz[lev];k++)  {
    sizeofk = (1+E->parallel.NUM_NODEz[lev].pass[k])*sizeof(float);
-   idb = max(idb,sizeofk);
+   idb = citmax(idb,sizeofk);
  }
 
  RV=(float *)malloc( idb );

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Full_sphere_related.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Full_sphere_related.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Full_sphere_related.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -169,7 +169,7 @@
   double a, b;
   double offset;
 
-  temp = max(E->mesh.noy, E->mesh.nox);
+  temp = citmax(E->mesh.noy, E->mesh.nox);
 
   theta0 = (double *)malloc((temp+1)*sizeof(double));
   fi0    = (double *)malloc((temp+1)*sizeof(double));

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Full_tracer_advection.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Full_tracer_advection.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Full_tracer_advection.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -333,7 +333,7 @@
 
     /* Allocate Maximum Memory to Send Arrays */
 
-    itemp_size=max(isize[j],1);
+    itemp_size=citmax(isize[j],1);
 
     for (kk=0;kk<=num_ngb;kk++) {
         if ((send[j][kk]=(double *)malloc(itemp_size*sizeof(double)))==NULL) {
@@ -409,7 +409,7 @@
     for (ithatcap=0;ithatcap<=num_ngb;ithatcap++) {
         isize[j]=ireceive[j][ithatcap]*E->trace.number_of_tracer_quantities;
 
-        itemp_size=max(1,isize[j]);
+        itemp_size=citmax(1,isize[j]);
 
         if ((receive[j][ithatcap]=(double *)malloc(itemp_size*sizeof(double)))==NULL) {
             fprintf(E->trace.fpt,"Error(lost souls)-no memory (c721)\n");
@@ -476,7 +476,7 @@
     /* Allocate Memory for REC array */
 
     isize[j]=isum[j]*E->trace.number_of_tracer_quantities;
-    isize[j]=max(isize[j],1);
+    isize[j]=citmax(isize[j],1);
     if ((REC[j]=(double *)malloc(isize[j]*sizeof(double)))==NULL) {
         fprintf(E->trace.fpt,"Error(lost souls)-no memory (g323)\n");
         fflush(E->trace.fpt);
@@ -521,7 +521,7 @@
 
         for (kk=1;kk<=E->parallel.TNUM_PASSz[lev];kk++) {
             isize[j]=itracers_subject_to_vertical_transport[j]*E->trace.number_of_tracer_quantities;
-            isize[j]=max(isize[j],1);
+            isize[j]=citmax(isize[j],1);
 
             if ((send_z[j][kk]=(double *)malloc(isize[j]*sizeof(double)))==NULL) {
                 fprintf(E->trace.fpt,"Error(lost souls)-no memory (c721)\n");
@@ -627,7 +627,7 @@
 
         for (kk=1;kk<=E->parallel.TNUM_PASSz[lev];kk++) {
             isize[j]=ireceive_z[j][kk]*E->trace.number_of_tracer_quantities;
-            isize[j]=max(isize[j],1);
+            isize[j]=citmax(isize[j],1);
 
             if ((receive_z[j][kk]=(double *)malloc(isize[j]*sizeof(double)))==NULL) {
                 fprintf(E->trace.fpt,"Error(lost souls)-no memory (t590)\n");
@@ -1353,18 +1353,18 @@
                     theta=E->sx[j][1][kk];
                     phi=E->sx[j][2][kk];
 
-                    thetamax=max(thetamax,theta);
-                    thetamin=min(thetamin,theta);
+                    thetamax=citmax(thetamax,theta);
+                    thetamin=citmin(thetamin,theta);
 
                 }
 
             /* expand range slightly (should take care of poles)  */
 
             thetamax=thetamax+expansion;
-            thetamax=min(thetamax,M_PI);
+            thetamax=citmin(thetamax,M_PI);
 
             thetamin=thetamin-expansion;
-            thetamin=max(thetamin,0.0);
+            thetamin=citmax(thetamin,0.0);
 
             /* Convert input data from degrees to radians  */
 
@@ -1498,10 +1498,10 @@
                             theta=E->sx[j][1][node];
                             phi=E->sx[j][2][node];
 
-                            theta_min=min(theta_min,theta);
-                            theta_max=max(theta_max,theta);
-                            phi_min=min(phi_min,phi);
-                            phi_max=max(phi_max,phi);
+                            theta_min=citmin(theta_min,theta);
+                            theta_max=citmax(theta_max,theta);
+                            phi_min=citmin(phi_min,phi);
+                            phi_max=citmax(phi_max,phi);
                         }
 
                     /* add half difference to phi and expansion to theta to be safe */
@@ -1509,8 +1509,8 @@
                     theta_max=theta_max+expansion;
                     theta_min=theta_min-expansion;
 
-                    theta_max=min(M_PI,theta_max);
-                    theta_min=max(0.0,theta_min);
+                    theta_max=citmin(M_PI,theta_max);
+                    theta_min=citmax(0.0,theta_min);
 
                     half_diff=0.5*(phi_max-phi_min);
                     phi_max=phi_max+half_diff;

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Global_operations.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Global_operations.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Global_operations.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -696,7 +696,7 @@
   temp = -10.0;
   for (m=1;m<=E->sphere.caps_per_proc;m++)
     for(i=1;i<=E->lmesh.nno;i++)
-      temp = max(T[m][i],temp);
+      temp = citmax(T[m][i],temp);
 
   temp1 = global_dmax(E,temp);
   return (temp1);
@@ -711,7 +711,7 @@
   temp = -10.0;
   for (m=1;m<=E->sphere.caps_per_proc;m++)
     for(i=1;i<=E->lmesh.nno;i++)
-      temp = max(T[m][i],temp);
+      temp = citmax(T[m][i],temp);
 
   temp1 = global_fmax(E,temp);
   return (temp1);

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Initial_temperature.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Initial_temperature.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Initial_temperature.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -288,7 +288,7 @@
       }
       /* Truncate the temperature to be within (0,1). */
       /* This might not be desirable in some situations. */
-      E->T[m][i] = max(0.0,min(g,1.0));
+      E->T[m][i] = citmax(0.0,citmin(g,1.0));
     }
   }
   fclose (fp);

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Instructions.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Instructions.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Instructions.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -623,7 +623,7 @@
 								 heat flux files? */
   if(E->output.write_q_files){	/* make sure those get written at
 				   least as often as velocities */
-    E->output.write_q_files = min(E->output.write_q_files,E->control.record_every);
+    E->output.write_q_files = citmin(E->output.write_q_files,E->control.record_every);
   }
 
 
@@ -964,8 +964,8 @@
   /* nodal mass */
   E->NMass[j] = (double *) malloc((nno+1)*sizeof(double));
 
-  nxyz = max(nox*noz,nox*noy);
-  nxyz = 2*max(nxyz,noz*noy);
+  nxyz = citmax(nox*noz,nox*noy);
+  nxyz = 2*citmax(nxyz,noz*noy);
 
   E->sien[j]         = (struct SIEN *) malloc((nxyz+2)*sizeof(struct SIEN));
   E->surf_element[j] = (int *) malloc((nxyz+2)*sizeof(int));
@@ -1060,9 +1060,9 @@
     E->VI[i][j]  = (float *)        malloc((nno+1)*sizeof(float));
     E->NODE[i][j] = (unsigned int *)malloc((nno+1)*sizeof(unsigned int));
 
-    nxyz = max(nox*noz,nox*noy);
-    nxyz = 2*max(nxyz,noz*noy);
-    nozl = max(noy,nox*2);
+    nxyz = citmax(nox*noz,nox*noy);
+    nxyz = 2*citmax(nxyz,noz*noy);
+    nozl = citmax(noy,nox*2);
 
 
 

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Regional_sphere_related.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Regional_sphere_related.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Regional_sphere_related.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -67,7 +67,7 @@
   nprocyl=E->parallel.nprocy;
   nproczl=E->parallel.nprocz;
   nnproc=nprocyl*nprocxl*nproczl;
-  temp = max(E->mesh.NOY[E->mesh.levmax],E->mesh.NOX[E->mesh.levmax]);
+  temp = citmax(E->mesh.NOY[E->mesh.levmax],E->mesh.NOX[E->mesh.levmax]);
 
   /* define the cap corners */
   E->sphere.cap[1].theta[1] = E->control.theta_min;

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Regional_tracer_advection.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Regional_tracer_advection.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Regional_tracer_advection.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -689,7 +689,7 @@
 
 
     /* Allocate Maximum Memory to Send Arrays */
-    max_send_size = max(2*E->trace.ilater[j], E->trace.ntracers[j]/100);
+    max_send_size = citmax(2*E->trace.ilater[j], E->trace.ntracers[j]/100);
     itemp_size = max_send_size * E->trace.number_of_tracer_quantities;
 
     if ((send[0] = (double *)malloc(itemp_size*sizeof(double)))
@@ -828,7 +828,7 @@
         /* Allocate memory in receive arrays */
         for (i=0; i<2; i++) {
             isize = irecv[i] * E->trace.number_of_tracer_quantities;
-            itemp_size = max(1, isize);
+            itemp_size = citmax(1, isize);
 
             if ((recv[i] = (double *)malloc(itemp_size*sizeof(double)))
                 == NULL) {

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Size_does_matter.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Size_does_matter.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Size_does_matter.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -1011,7 +1011,7 @@
                 E->ECO[lev][m][e].centre[3] = dx3;
 
                 /* delta(theta) of this element */
-                dx1 = max( fabs(E->SX[lev][m][1][n[3]]-E->SX[lev][m][1][n[1]]),
+                dx1 = citmax( fabs(E->SX[lev][m][1][n[3]]-E->SX[lev][m][1][n[1]]),
                            fabs(E->SX[lev][m][1][n[2]]-E->SX[lev][m][1][n[4]]) );
 
                 /* length of this element in the theta-direction */
@@ -1020,15 +1020,15 @@
                 /* delta(phi) of this element */
                 dx1 = fabs(E->SX[lev][m][2][n[3]]-E->SX[lev][m][2][n[1]]);
                 if (dx1>M_PI)
-                    dx1 = min(E->SX[lev][m][2][n[3]],E->SX[lev][m][2][n[1]]) + 2.0*M_PI -
-                        max(E->SX[lev][m][2][n[3]],E->SX[lev][m][2][n[1]]) ;
+                    dx1 = citmin(E->SX[lev][m][2][n[3]],E->SX[lev][m][2][n[1]]) + 2.0*M_PI -
+                        citmax(E->SX[lev][m][2][n[3]],E->SX[lev][m][2][n[1]]) ;
 
                 dx2 = fabs(E->SX[lev][m][2][n[2]]-E->SX[lev][m][2][n[4]]);
                 if (dx2>M_PI)
-                    dx2 = min(E->SX[lev][m][2][n[2]],E->SX[lev][m][2][n[4]]) + 2.0*M_PI -
-                        max(E->SX[lev][m][2][n[2]],E->SX[lev][m][2][n[4]]) ;
+                    dx2 = citmin(E->SX[lev][m][2][n[2]],E->SX[lev][m][2][n[4]]) + 2.0*M_PI -
+                        citmax(E->SX[lev][m][2][n[2]],E->SX[lev][m][2][n[4]]) ;
 
-                dx2 = max(dx1,dx2);
+                dx2 = citmax(dx1,dx2);
 
                 /* length of this element in the phi-direction */
                 E->ECO[lev][m][e].size[2] = dx2*E->ECO[lev][m][e].centre[3]

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/Viscosity_structures.c
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/Viscosity_structures.c	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/Viscosity_structures.c	2011-07-20 21:20:11 UTC (rev 18787)
@@ -151,7 +151,7 @@
     if (E->viscosity.PDEPV) {
       E->viscosity.pdepv_visited = 0;
       for(i=0;i < E->viscosity.num_mat;i++) {
-          E->viscosity.pdepv_a[i] = 1.e20; /* \sigma_y = min(a + b * (1-r),y) */
+          E->viscosity.pdepv_a[i] = 1.e20; /* \sigma_y = citmin(a + b * (1-r),y) */
           E->viscosity.pdepv_b[i] = 0.0;
           E->viscosity.pdepv_y[i] = 1.e20;
       }
@@ -567,8 +567,8 @@
 						   computation of
 						   depth, not needed
 						   TWB */
-		      TT[kk]=max(TT[kk],zero);
-		      temp += min(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
+		      TT[kk]=citmax(TT[kk],zero);
+		      temp += citmin(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
                     }
 		    EEta[m][ (i-1)*vpts + jj ] = tempa*
 		      exp( E->viscosity.E[l]/(temp+E->viscosity.T[l])
@@ -596,8 +596,8 @@
                     temp=0.0;
                     zzz=0.0;
                     for(kk=1;kk<=ends;kk++)   {
-                        TT[kk]=max(TT[kk],zero);
-                        temp += min(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
+                        TT[kk]=citmax(TT[kk],zero);
+                        temp += citmin(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
                         zzz += zz[kk] * E->N.vpt[GNVINDEX(kk,jj)];
                     }
 
@@ -627,8 +627,8 @@
                 for(jj=1;jj<=vpts;jj++) {
                     temp=0.0;
                     for(kk=1;kk<=ends;kk++)   {
-                        TT[kk]=max(TT[kk],zero);
-                        temp += min(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
+                        TT[kk]=citmax(TT[kk],zero);
+                        temp += citmin(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
                     }
 
                     if(E->control.mat_control==0){
@@ -678,8 +678,8 @@
 	    for(jj=1;jj <= vpts;jj++) {
 	      temp=0.0;zzz=0.0;
 	      for(kk=1;kk <= ends;kk++)   {
-		TT[kk]=max(TT[kk],zero);
-		temp += min(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
+		TT[kk]=citmax(TT[kk],zero);
+		temp += citmin(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)];
 		zzz += zz[kk] * E->N.vpt[GNVINDEX(kk,jj)];
 	      }
 	      EEta[m][ (i-1)*vpts + jj ] = tempa*
@@ -789,8 +789,8 @@
                 for(jj=1;jj<=vpts;jj++) {
                     temp=zzz=0.0;
                     for(kk=1;kk<=ends;kk++)   {	
-		      TT[kk]=max(TT[kk],zero);
-		      temp += min(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)]; /* mean temp */
+		      TT[kk]=citmax(TT[kk],zero);
+		      temp += citmin(TT[kk],one) * E->N.vpt[GNVINDEX(kk,jj)]; /* mean temp */
 		      zzz += zz[kk] * E->N.vpt[GNVINDEX(kk,jj)];/* mean r */
                     }
 		    /* convert to z, as defined to be unity at surface
@@ -922,7 +922,7 @@
       }
         /* eedot cannot be too small, or the viscosity will go to inf */
 	for(e=1;e<=nel;e++){
-	  eedot[e] = max(eedot[e], 1.0e-16);
+	  eedot[e] = citmax(eedot[e], 1.0e-16);
 	}
 
         for(e=1;e<=nel;e++)   {
@@ -1034,7 +1034,7 @@
 	  tau = E->viscosity.pdepv_a[l] + zzz * E->viscosity.pdepv_b[l];
 	  
 	  /* min of depth dep. and constant yield stress */
-	  tau = min(tau,  E->viscosity.pdepv_y[l]);
+	  tau = citmin(tau,  E->viscosity.pdepv_y[l]);
 	  
 	  /* yield viscosity */
 	  eta_p = tau/(2.0 * eedot[e] + 1e-7) + E->viscosity.pdepv_offset;
@@ -1043,7 +1043,7 @@
 	    eta_new  = 1.0/(1.0/EEta[m][ (e-1)*vpts + jj ] + 1.0/eta_p);
 	  }else{
 	    /* min viscosities*/
-	    eta_new  = min(EEta[m][ (e-1)*vpts + jj ], eta_p);
+	    eta_new  = citmin(EEta[m][ (e-1)*vpts + jj ], eta_p);
 	  }
 	  //fprintf(stderr,"z: %11g mat: %i a: %11g b: %11g y: %11g ee: %11g tau: %11g eta_p: %11g eta_new: %11g eta_old: %11g\n",
 	  //	  zzz,l,E->viscosity.pdepv_a[l], E->viscosity.pdepv_b[l],E->viscosity.pdepv_y[l],
@@ -1064,7 +1064,7 @@
 	    zzz += zz[kk] * E->N.vpt[GNVINDEX(kk,jj)];
 	  /* compute sigma_y as above */
 	  tau = E->viscosity.pdepv_a[l] + zzz * E->viscosity.pdepv_b[l];
-	  tau = min(tau,  E->viscosity.pdepv_y[l]);
+	  tau = citmin(tau,  E->viscosity.pdepv_y[l]);
 	  tau2 = tau * tau;
 	  if(tau < 1e10){
 	    /*  */

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/global_defs.h
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/global_defs.h	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/global_defs.h	2011-07-20 21:20:11 UTC (rev 18787)
@@ -54,8 +54,8 @@
 
 
 /* Macros */
-#define max(A,B) (((A) > (B)) ? (A) : (B))
-#define min(A,B) (((A) < (B)) ? (A) : (B))
+#define citmax(A,B) (((A) > (B)) ? (A) : (B))
+#define citmin(A,B) (((A) < (B)) ? (A) : (B))
 #define SWAP(a,b) {temp=(a);(a)=(b);(b)=temp;}
 
 

Modified: mc/3D/CitcomS/branches/eheien_dev/lib/tracer_defs.h
===================================================================
--- mc/3D/CitcomS/branches/eheien_dev/lib/tracer_defs.h	2011-07-20 20:03:59 UTC (rev 18786)
+++ mc/3D/CitcomS/branches/eheien_dev/lib/tracer_defs.h	2011-07-20 21:20:11 UTC (rev 18787)
@@ -27,11 +27,112 @@
  */
 
 
+#include <vector>
+#include <list>
+#include <math.h>
 
 /* forward declaration */
 struct All_variables;
 
+#ifndef _TRACER_DEFS_H_
+#define _TRACER_DEFS_H_
 
+class CartesianCoord;
+
+// Position or vector in spherical coordinates
+class SphericalCoord {
+public:
+	double	_theta, _phi, _rad;
+	SphericalCoord(void) : _theta(0), _phi(0), _rad(0) {};
+	SphericalCoord(double theta, double phi, double rad) : _theta(theta), _phi(phi), _rad(rad) {};
+	
+	size_t size(void) const { return 3; };
+	void writeToMem(double *mem) const;
+	void readFromMem(const double *mem);
+	CartesianCoord toCartesian(void) const;
+	
+	void constrainThetaPhi(void);
+	double constrainAngle(const double angle) const;
+};
+
+// Position or vector in Cartesian coordinates
+class CartesianCoord {
+public:
+	double	_x, _y, _z;
+	CartesianCoord(void) : _x(0), _y(0), _z(0) {};
+	CartesianCoord(double x, double y, double z) : _x(x), _y(y), _z(z) {};
+	
+	size_t size(void) const { return 3; };
+	void writeToMem(double *mem) const;
+	void readFromMem(const double *mem);
+	SphericalCoord toSpherical(void) const;
+	double dist(const CartesianCoord &o) const {
+		double xd=_x-o._x, yd=_y-o._y, zd=_z-o._z;
+		return sqrt(xd*xd+yd*yd+zd*zd);
+	};
+	
+	const CartesianCoord operator+(const CartesianCoord &other) const;
+	const CartesianCoord operator*(const double &val) const;
+	void operator=(const CartesianCoord &other) { _x = other._x; _y = other._y; _z = other._z; };
+};
+
+class Tracer {
+private:
+	// Tracer position in spherical coordinates
+	SphericalCoord	_sc;
+	// Tracer position in Cartesian coordinates
+	CartesianCoord	_cc;
+	// Previous Cartesian position
+	CartesianCoord	_cc0;
+	// Previous Cartesian velocity
+	CartesianCoord	_Vc;
+	
+	// Tracer flavor (meaning should be application dependent)
+	double _flavor;
+	
+	int _ielement;
+	
+public:
+	Tracer(void) : _sc(), _cc(), _cc0(), _Vc() {};
+	Tracer(SphericalCoord new_sc, CartesianCoord new_cc) : _sc(new_sc), _cc(new_cc), _cc0(), _Vc() {};
+	
+	CartesianCoord getCartesianPos(void) const { return _cc; };
+	SphericalCoord getSphericalPos(void) const { return _sc; };
+	CartesianCoord getOrigCartesianPos(void) const { return _cc0; };
+	CartesianCoord getCartesianVel(void) const { return _Vc; };
+	
+	void setCoords(SphericalCoord new_sc, CartesianCoord new_cc) {
+		_sc = new_sc;
+		_cc = new_cc;
+	}
+	void setOrigVals(CartesianCoord new_cc0, CartesianCoord new_vc) {
+		_cc0 = new_cc0;
+		_Vc = new_vc;
+	}
+	
+	double theta(void) { return _sc._theta; };
+	double phi(void) { return _sc._phi; };
+	double rad(void) { return _sc._rad; };
+	
+	double x(void) { return _cc._x; };
+	double y(void) { return _cc._y; };
+	double z(void) { return _cc._z; };
+	
+	int ielement(void) { return _ielement; };
+	void set_ielement(int ielement) { _ielement = ielement; };
+	
+	double flavor(void) { return _flavor; };
+	void set_flavor(double flavor) { _flavor = flavor; };
+	
+	size_t size(void);
+	void writeToMem(double *mem) const;
+	void readFromMem(const double *mem);
+};
+
+typedef std::list<Tracer> TracerList;
+
+#endif
+
 struct TRACE{
 
     FILE *fpt;



More information about the CIG-COMMITS mailing list