[cig-commits] [commit] rajesh-petsc-schur: Changed the shape of E->trace.ntracers as part of caps_per_proc_removal (2480481)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 19:13:14 PST 2014


Repository : https://github.com/geodynamics/citcoms

On branch  : rajesh-petsc-schur
Link       : https://github.com/geodynamics/citcoms/compare/464e1b32299b15819f93efd98d969cddb84dfe51...f97ae655a50bdbd6dac1923a3471ee4dae178fbd

>---------------------------------------------------------------

commit 24804810675ab6dd63c24b4bf7fecba3bea99ef0
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date:   Wed Sep 24 12:17:53 2014 -0700

    Changed the shape of E->trace.ntracers as part of caps_per_proc_removal


>---------------------------------------------------------------

24804810675ab6dd63c24b4bf7fecba3bea99ef0
 lib/Checkpoints.c               | 16 ++++++-------
 lib/Full_tracer_advection.c     | 22 ++++++++---------
 lib/Output.c                    |  4 ++--
 lib/Output_gzdir.c              |  4 ++--
 lib/Regional_tracer_advection.c |  8 +++----
 lib/Tracer_setup.c              | 52 ++++++++++++++++++++---------------------
 lib/tracer_defs.h               |  2 +-
 7 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/lib/Checkpoints.c b/lib/Checkpoints.c
index c3a1a3c..a400b34 100644
--- a/lib/Checkpoints.c
+++ b/lib/Checkpoints.c
@@ -256,20 +256,20 @@ static void tracer_checkpoint(struct All_variables *E, FILE *fp)
     fwrite(&(E->trace.nflavors), sizeof(int), 1, fp);
     fwrite(&(E->trace.ilast_tracer_count), sizeof(int), 1, fp);
 
-    fwrite(&(E->trace.ntracers[CPPR]), sizeof(int), 1, fp);
+    fwrite(&(E->trace.ntracers), sizeof(int), 1, fp);
 
     /* the 0-th element of basicq/extraq/ielement is not init'd
      * and won't be used when read it. */
         for(i=0; i<6; i++) {
             fwrite(E->trace.basicq[i], sizeof(double),
-                   E->trace.ntracers[CPPR]+1, fp);
+                   E->trace.ntracers+1, fp);
         }
         for(i=0; i<E->trace.number_of_extra_quantities; i++) {
             fwrite(E->trace.extraq[i], sizeof(double),
-                   E->trace.ntracers[CPPR]+1, fp);
+                   E->trace.ntracers+1, fp);
         }
         fwrite(E->trace.ielement[CPPR], sizeof(int),
-               E->trace.ntracers[CPPR]+1, fp);
+               E->trace.ntracers+1, fp);
 
 }
 
@@ -316,19 +316,19 @@ static void read_tracer_checkpoint(struct All_variables *E, FILE *fp)
     /* # of tracers, allocate memory */
         fread(&itmp, sizeof(int), 1, fp);
         allocate_tracer_arrays(E, itmp);
-        E->trace.ntracers[CPPR] = itmp;
+        E->trace.ntracers = itmp;
 
     /* read tracer data */
         for(i=0; i<6; i++) {
             fread(E->trace.basicq[i], sizeof(double),
-                  E->trace.ntracers[CPPR]+1, fp);
+                  E->trace.ntracers+1, fp);
         }
         for(i=0; i<E->trace.number_of_extra_quantities; i++) {
             fread(E->trace.extraq[i], sizeof(double),
-                  E->trace.ntracers[CPPR]+1, fp);
+                  E->trace.ntracers+1, fp);
         }
         fread(E->trace.ielement[CPPR], sizeof(int),
-              E->trace.ntracers[CPPR]+1, fp);
+              E->trace.ntracers+1, fp);
 
     /* init E->trace.ntracer_flavor */
     count_tracers_of_flavors(E);
diff --git a/lib/Full_tracer_advection.c b/lib/Full_tracer_advection.c
index d8d88f5..4fec9d6 100644
--- a/lib/Full_tracer_advection.c
+++ b/lib/Full_tracer_advection.c
@@ -710,9 +710,9 @@ void full_lost_souls(struct All_variables *E)
 
 
     for (kk=0;kk<irec[CPPR];kk++) {
-        E->trace.ntracers[CPPR]++;
+        E->trace.ntracers++;
 
-        if (E->trace.ntracers[CPPR]>(E->trace.max_ntracers[CPPR]-5)) 
+        if (E->trace.ntracers>(E->trace.max_ntracers[CPPR]-5)) 
           expand_tracer_arrays(E);
 
         ireceive_position=kk*E->trace.number_of_tracer_quantities;
@@ -720,20 +720,20 @@ void full_lost_souls(struct All_variables *E)
         for (mm=0;mm<E->trace.number_of_basic_quantities;mm++) {
             ipos=ireceive_position+mm;
 
-            E->trace.basicq[mm][E->trace.ntracers[CPPR]]=REC[CPPR][ipos];
+            E->trace.basicq[mm][E->trace.ntracers]=REC[CPPR][ipos];
         }
         for (mm=0;mm<E->trace.number_of_extra_quantities;mm++) {
             ipos=ireceive_position+E->trace.number_of_basic_quantities+mm;
 
-            E->trace.extraq[mm][E->trace.ntracers[CPPR]]=REC[CPPR][ipos];
+            E->trace.extraq[mm][E->trace.ntracers]=REC[CPPR][ipos];
         }
 
-        theta=E->trace.basicq[0][E->trace.ntracers[CPPR]];
-        phi=E->trace.basicq[1][E->trace.ntracers[CPPR]];
-        rad=E->trace.basicq[2][E->trace.ntracers[CPPR]];
-        x=E->trace.basicq[3][E->trace.ntracers[CPPR]];
-        y=E->trace.basicq[4][E->trace.ntracers[CPPR]];
-        z=E->trace.basicq[5][E->trace.ntracers[CPPR]];
+        theta=E->trace.basicq[0][E->trace.ntracers];
+        phi=E->trace.basicq[1][E->trace.ntracers];
+        rad=E->trace.basicq[2][E->trace.ntracers];
+        x=E->trace.basicq[3][E->trace.ntracers];
+        y=E->trace.basicq[4][E->trace.ntracers];
+        z=E->trace.basicq[5][E->trace.ntracers];
 
 
         iel=(E->trace.iget_element)(E,-99,x,y,z,theta,phi,rad);
@@ -745,7 +745,7 @@ void full_lost_souls(struct All_variables *E)
             exit(10);
         }
 
-        E->trace.ielement[CPPR][E->trace.ntracers[CPPR]]=iel;
+        E->trace.ielement[CPPR][E->trace.ntracers]=iel;
 
     }
     if(E->control.verbose){
diff --git a/lib/Output.c b/lib/Output.c
index b774863..8a6c347 100644
--- a/lib/Output.c
+++ b/lib/Output.c
@@ -635,10 +635,10 @@ void output_tracer(struct All_variables *E, int cycles)
 
   ncolumns = 3 + E->trace.number_of_extra_quantities;
 
-      fprintf(fp1,"%d %d %d %.5e\n", cycles, E->trace.ntracers[CPPR],
+      fprintf(fp1,"%d %d %d %.5e\n", cycles, E->trace.ntracers,
               ncolumns, E->monitor.elapsed_time);
 
-      for(n=1;n<=E->trace.ntracers[CPPR];n++) {
+      for(n=1;n<=E->trace.ntracers;n++) {
           /* write basic quantities (coordinate) */
           fprintf(fp1,"%.12e %.12e %.12e",
                   E->trace.basicq[0][n],
diff --git a/lib/Output_gzdir.c b/lib/Output_gzdir.c
index 2d26c60..8a1e7d7 100644
--- a/lib/Output_gzdir.c
+++ b/lib/Output_gzdir.c
@@ -1042,9 +1042,9 @@ void gzdir_output_tracer(struct All_variables *E, int cycles)
 
   ncolumns = 3 + E->trace.number_of_extra_quantities;
 
-  gzprintf(fp1,"%d %d %d %.5e\n", cycles, E->trace.ntracers[CPPR], ncolumns, E->monitor.elapsed_time);
+  gzprintf(fp1,"%d %d %d %.5e\n", cycles, E->trace.ntracers, ncolumns, E->monitor.elapsed_time);
 
-      for(n=1;n<=E->trace.ntracers[CPPR];n++) {
+      for(n=1;n<=E->trace.ntracers;n++) {
           /* write basic quantities (coordinate) */
           gzprintf(fp1,"%9.5e %9.5e %9.5e",
                   E->trace.basicq[0][n],
diff --git a/lib/Regional_tracer_advection.c b/lib/Regional_tracer_advection.c
index d9b19f4..b1130b0 100644
--- a/lib/Regional_tracer_advection.c
+++ b/lib/Regional_tracer_advection.c
@@ -572,7 +572,7 @@ void regional_lost_souls(struct All_variables *E)
     }
 
     /* Allocate Maximum Memory to Send Arrays */
-    max_send_size = max(2*E->trace.ilater[CPPR], E->trace.ntracers[CPPR]/100);
+    max_send_size = max(2*E->trace.ilater[CPPR], E->trace.ntracers/100);
     itemp_size = max_send_size * E->trace.number_of_tracer_quantities;
 
     if ((send[0] = (double *)malloc(itemp_size*sizeof(double)))
@@ -805,10 +805,10 @@ static void put_found_tracers(struct All_variables *E, int recv_size, double *re
 
         if (inside) {
 
-            E->trace.ntracers[CPPR]++;
-            ilast = E->trace.ntracers[CPPR];
+            E->trace.ntracers++;
+            ilast = E->trace.ntracers;
 
-            if (E->trace.ntracers[CPPR] > (E->trace.max_ntracers[CPPR]-5))
+            if (E->trace.ntracers > (E->trace.max_ntracers[CPPR]-5))
                 expand_tracer_arrays(E);
 
             for (pp=0; pp<E->trace.number_of_basic_quantities; pp++)
diff --git a/lib/Tracer_setup.c b/lib/Tracer_setup.c
index 129fc23..42d6496 100644
--- a/lib/Tracer_setup.c
+++ b/lib/Tracer_setup.c
@@ -382,7 +382,7 @@ static void predict_tracers(struct All_variables *E)
 
 
 
-        numtracers=E->trace.ntracers[CPPR];
+        numtracers=E->trace.ntracers;
 
         for (kk=1;kk<=numtracers;kk++) {
 
@@ -476,7 +476,7 @@ static void correct_tracers(struct All_variables *E)
     dt=E->advection.timestep;
 
 
-        for (kk=1;kk<=E->trace.ntracers[CPPR];kk++) {
+        for (kk=1;kk<=E->trace.ntracers;kk++) {
 
             theta_pred=E->trace.basicq[0][kk];
             phi_pred=E->trace.basicq[1][kk];
@@ -574,7 +574,7 @@ static void find_tracers(struct All_variables *E)
         /* important to index by it, not kk */
 
         it=0;
-        num_tracers=E->trace.ntracers[CPPR];
+        num_tracers=E->trace.ntracers;
 
         for (kk=1;kk<=num_tracers;kk++) {
 
@@ -662,7 +662,7 @@ void count_tracers_of_flavors(struct All_variables *E)
             for (e=1; e<=E->lmesh.nel; e++)
                 E->trace.ntracer_flavor[CPPR][flavor][e] = 0;
 
-        numtracers=E->trace.ntracers[CPPR];
+        numtracers=E->trace.ntracers;
 
         /* Fill arrays */
         for (kk=1; kk<=numtracers; kk++) {
@@ -783,7 +783,7 @@ static void generate_random_tracers(struct All_variables *E, int tracers_cap)
 
     /* Tracers are placed randomly in cap */
     /* (intentionally using rand() instead of srand() )*/
-    while (E->trace.ntracers[CPPR]<tracers_cap) {
+    while (E->trace.ntracers<tracers_cap) {
 
         number_of_tries++;
         max_tries=100*tracers_cap;
@@ -829,8 +829,8 @@ static void generate_random_tracers(struct All_variables *E, int tracers_cap)
 
         (E->trace.keep_within_bounds)(E,&x,&y,&z,&theta,&phi,&rad);
 
-        E->trace.ntracers[CPPR]++;
-        kk=E->trace.ntracers[CPPR];
+        E->trace.ntracers++;
+        kk=E->trace.ntracers;
 
         E->trace.basicq[0][kk]=theta;
         E->trace.basicq[1][kk]=phi;
@@ -940,25 +940,25 @@ static void read_tracer_file(struct All_variables *E)
             /* if still here, tracer is in processor domain */
 
 
-            E->trace.ntracers[CPPR]++;
+            E->trace.ntracers++;
 
-            if (E->trace.ntracers[CPPR]>=(E->trace.max_ntracers[CPPR]-5)) 
+            if (E->trace.ntracers>=(E->trace.max_ntracers[CPPR]-5)) 
               expand_tracer_arrays(E);
 
-            E->trace.basicq[0][E->trace.ntracers[CPPR]]=theta;
-            E->trace.basicq[1][E->trace.ntracers[CPPR]]=phi;
-            E->trace.basicq[2][E->trace.ntracers[CPPR]]=rad;
-            E->trace.basicq[3][E->trace.ntracers[CPPR]]=x;
-            E->trace.basicq[4][E->trace.ntracers[CPPR]]=y;
-            E->trace.basicq[5][E->trace.ntracers[CPPR]]=z;
+            E->trace.basicq[0][E->trace.ntracers]=theta;
+            E->trace.basicq[1][E->trace.ntracers]=phi;
+            E->trace.basicq[2][E->trace.ntracers]=rad;
+            E->trace.basicq[3][E->trace.ntracers]=x;
+            E->trace.basicq[4][E->trace.ntracers]=y;
+            E->trace.basicq[5][E->trace.ntracers]=z;
 
             for (i=0; i<E->trace.number_of_extra_quantities; i++)
-                E->trace.extraq[i][E->trace.ntracers[CPPR]]=buffer[i+3];
+                E->trace.extraq[i][E->trace.ntracers]=buffer[i+3];
 
         } /* end kk, number of tracers */
 
         fprintf(E->trace.fpt,"Number of tracers in this cap is: %d\n",
-                E->trace.ntracers[CPPR]);
+                E->trace.ntracers);
 
     fclose(fptracer);
 
@@ -1052,7 +1052,7 @@ static void read_old_tracer_file(struct All_variables *E)
         /* allocate memory for tracer arrays */
 
         allocate_tracer_arrays(E,numtracers);
-        E->trace.ntracers[CPPR]=numtracers;
+        E->trace.ntracers=numtracers;
 
         for (kk=1;kk<=numtracers;kk++) {
             int len, ncol;
@@ -1144,7 +1144,7 @@ static int isum_tracers(struct All_variables *E)
     iallcount = 0;
 
     imycount = 0;
-    imycount = imycount + E->trace.ntracers[CPPR];
+    imycount = imycount + E->trace.ntracers;
 
     MPI_Allreduce(&imycount,&iallcount,1,MPI_INT,MPI_SUM,E->parallel.world);
 
@@ -1207,7 +1207,7 @@ static void init_tracer_flavors(struct All_variables *E)
       /* any tracer above z_interface[i] is of flavor i */
       /* any tracer below z_interface is of flavor (nflavors-1) */
 
-	number_of_tracers = E->trace.ntracers[CPPR];
+	number_of_tracers = E->trace.ntracers;
 	for (kk=1;kk<=number_of_tracers;kk++) {
 	  rad = E->trace.basicq[2][kk];
 
@@ -1352,7 +1352,7 @@ void allocate_tracer_arrays(struct All_variables *E, int number_of_tracers)
     /* (initially make it 25% larger than required */
 
     E->trace.max_ntracers[CPPR]=number_of_tracers+number_of_tracers/4;
-    E->trace.ntracers[CPPR]=0;
+    E->trace.ntracers=0;
 
     /* make tracer arrays */
 
@@ -1461,12 +1461,12 @@ static void reduce_tracer_arrays(struct All_variables *E)
 
         /* if physical size is double tracer size, reduce it */
 
-        iempty_space=(E->trace.max_ntracers[CPPR]-E->trace.ntracers[CPPR]);
+        iempty_space=(E->trace.max_ntracers[CPPR]-E->trace.ntracers);
 
-        if (iempty_space>(E->trace.ntracers[CPPR]+icushion)) {
+        if (iempty_space>(E->trace.ntracers+icushion)) {
 
 
-            inewsize=E->trace.ntracers[CPPR]+E->trace.ntracers[CPPR]/4+icushion;
+            inewsize=E->trace.ntracers+E->trace.ntracers/4+icushion;
 
             if (inewsize<1) {
                 fprintf(E->trace.fpt,"Error(reduce tracer arrays)-something up (hdf3)\n");
@@ -1591,7 +1591,7 @@ static void eject_tracer(struct All_variables *E, int it)
     int ilast_tracer;
     int kk;
 
-    ilast_tracer=E->trace.ntracers[CPPR];
+    ilast_tracer=E->trace.ntracers;
 
     /* put last tracer in ejected tracer position */
 
@@ -1603,7 +1603,7 @@ static void eject_tracer(struct All_variables *E, int it)
     for (kk=0;kk<=((E->trace.number_of_extra_quantities)-1);kk++)
         E->trace.extraq[kk][it]=E->trace.extraq[kk][ilast_tracer];
 
-    E->trace.ntracers[CPPR]--;
+    E->trace.ntracers--;
 }
 
 
diff --git a/lib/tracer_defs.h b/lib/tracer_defs.h
index 821d513..aadc7a0 100644
--- a/lib/tracer_defs.h
+++ b/lib/tracer_defs.h
@@ -54,7 +54,7 @@ struct TRACE{
     double *basicq[100];
     double *extraq[100];
 
-    int ntracers[13];
+    int ntracers;
     int max_ntracers[13];
     int *ielement[13];
 



More information about the CIG-COMMITS mailing list