[cig-commits] r8206 - mc/3D/CitcomS/trunk/lib

tan2 at geodynamics.org tan2 at geodynamics.org
Mon Nov 5 17:04:21 PST 2007


Author: tan2
Date: 2007-11-05 17:04:20 -0800 (Mon, 05 Nov 2007)
New Revision: 8206

Modified:
   mc/3D/CitcomS/trunk/lib/Full_obsolete.c
   mc/3D/CitcomS/trunk/lib/Global_operations.c
   mc/3D/CitcomS/trunk/lib/Obsolete.c
   mc/3D/CitcomS/trunk/lib/Sphere_harmonics.c
   mc/3D/CitcomS/trunk/lib/Topo_gravity.c
Log:
Shrank the size of sph. harm arrays

Modified: mc/3D/CitcomS/trunk/lib/Full_obsolete.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Full_obsolete.c	2007-11-06 01:03:55 UTC (rev 8205)
+++ mc/3D/CitcomS/trunk/lib/Full_obsolete.c	2007-11-06 01:04:20 UTC (rev 8206)
@@ -423,12 +423,12 @@
  if (E->parallel.nprocz==1)   return;
 
  jumpp = E->sphere.hindice;
- nsl = E->sphere.hindice*2+3;
+ nsl = E->sphere.hindice*2;
  me = E->parallel.me;
 
- TG = ( float *)malloc((nsl+1)*sizeof(float));
+ TG = ( float *)malloc(nsl*sizeof(float));
  if (E->parallel.me_loc[3]==dest_proc)
-      RG = ( float *)malloc((nsl+1)*sizeof(float));
+      RG = ( float *)malloc(nsl*sizeof(float));
 
  for (i=0;i<E->sphere.hindice;i++)   {
     TG[i] = sphc[i];
@@ -481,11 +481,11 @@
 
  if (E->parallel.nprocxy==1)   return;
 
- nsl = E->sphere.hindice*2+2;
+ nsl = E->sphere.hindice*2;
  me = E->parallel.me;
 
  for (i=1;i<E->parallel.nprocxy*E->parallel.surf_proc_per_cap;i++)
-    RG[i] = ( float *)malloc((nsl+1)*sizeof(float));
+    RG[i] = ( float *)malloc(nsl*sizeof(float));
 
 
  idb=0;
@@ -524,7 +524,6 @@
  return;
  }
 
-#endif
 
 
 

Modified: mc/3D/CitcomS/trunk/lib/Global_operations.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Global_operations.c	2007-11-06 01:03:55 UTC (rev 8205)
+++ mc/3D/CitcomS/trunk/lib/Global_operations.c	2007-11-06 01:04:20 UTC (rev 8206)
@@ -452,12 +452,12 @@
  int jumpp,total,j,d;
  float *sphcs,*temp;
 
- temp = (float *) malloc((E->sphere.hindice*2+3)*sizeof(float));
- sphcs = (float *) malloc((E->sphere.hindice*2+3)*sizeof(float));
+ temp = (float *) malloc((E->sphere.hindice*2)*sizeof(float));
+ sphcs = (float *) malloc((E->sphere.hindice*2)*sizeof(float));
 
  /* pack */
  jumpp = E->sphere.hindice;
- total = E->sphere.hindice*2+3;
+ total = E->sphere.hindice*2;
  for (j=0;j<E->sphere.hindice;j++)   {
    sphcs[j] = sphc[j];
    sphcs[j+jumpp] = sphs[j];
@@ -758,7 +758,7 @@
     float *sphcs,*temp;
 
     if (E->parallel.nprocz > 1)  {
-	total = E->sphere.hindice*2+3;
+	total = E->sphere.hindice*2;
 	temp = (float *) malloc(total*sizeof(float));
 	sphcs = (float *) malloc(total*sizeof(float));
 

Modified: mc/3D/CitcomS/trunk/lib/Obsolete.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Obsolete.c	2007-11-06 01:03:55 UTC (rev 8205)
+++ mc/3D/CitcomS/trunk/lib/Obsolete.c	2007-11-06 01:04:20 UTC (rev 8206)
@@ -333,7 +333,7 @@
     double t,f;
     double dth,dfi,sqrt_multis();
 
-    E->sphere.con = (double *)malloc((E->sphere.hindice+3)*sizeof(double));
+    E->sphere.con = (double *)malloc(E->sphere.hindice*sizeof(double));
     for (ll=0;ll<=E->output.llmax;ll++)
 	for (mm=0;mm<=ll;mm++)   {
 	    E->sphere.con[E->sphere.hindex[ll][mm]] =
@@ -344,7 +344,7 @@
     E->sphere.tablenplm   = (double **) malloc((E->sphere.nox+1)
 					       *sizeof(double*));
     for (i=1;i<=E->sphere.nox;i++)
-	E->sphere.tablenplm[i]= (double *)malloc((E->sphere.hindice+3)
+	E->sphere.tablenplm[i]= (double *)malloc(E->sphere.hindice
 						 *sizeof(double));
 
     E->sphere.tablencosf  = (double **) malloc((E->sphere.noy+1)

Modified: mc/3D/CitcomS/trunk/lib/Sphere_harmonics.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Sphere_harmonics.c	2007-11-06 01:03:55 UTC (rev 8205)
+++ mc/3D/CitcomS/trunk/lib/Sphere_harmonics.c	2007-11-06 01:04:20 UTC (rev 8206)
@@ -30,10 +30,10 @@
     /* spherical harmonic coeff (0=cos, 1=sin)
        for surface topo, cmb topo and geoid */
     for (i=0;i<=1;i++)   {
-        E->sphere.harm_geoid[i]=(float*)malloc((E->sphere.hindice+2)*sizeof(float));
-        E->sphere.harm_geoid_from_bncy[i]=(float*)malloc((E->sphere.hindice+2)*sizeof(float));
-        E->sphere.harm_geoid_from_tpgt[i]=(float*)malloc((E->sphere.hindice+2)*sizeof(float));
-        E->sphere.harm_geoid_from_tpgb[i]=(float*)malloc((E->sphere.hindice+2)*sizeof(float));
+        E->sphere.harm_geoid[i]=(float*)malloc(E->sphere.hindice*sizeof(float));
+        E->sphere.harm_geoid_from_bncy[i]=(float*)malloc(E->sphere.hindice*sizeof(float));
+        E->sphere.harm_geoid_from_tpgt[i]=(float*)malloc(E->sphere.hindice*sizeof(float));
+        E->sphere.harm_geoid_from_tpgb[i]=(float*)malloc(E->sphere.hindice*sizeof(float));
     }
 
     compute_sphereh_table(E);
@@ -114,9 +114,9 @@
         E->sphere.tablessinf[m] = (double **) malloc((E->lmesh.nsf+1)*sizeof(double*));
 
         for (i=1;i<=E->lmesh.nsf;i++)   {
-            E->sphere.tablesplm[m][i]= (double *)malloc((E->sphere.hindice+3)*sizeof(double));
-            E->sphere.tablescosf[m][i]= (double *)malloc((E->output.llmax+3)*sizeof(double));
-            E->sphere.tablessinf[m][i]= (double *)malloc((E->output.llmax+3)*sizeof(double));
+            E->sphere.tablesplm[m][i]= (double *)malloc((E->sphere.hindice)*sizeof(double));
+            E->sphere.tablescosf[m][i]= (double *)malloc((E->output.llmax+1)*sizeof(double));
+            E->sphere.tablessinf[m][i]= (double *)malloc((E->output.llmax+1)*sizeof(double));
         }
     }
 

Modified: mc/3D/CitcomS/trunk/lib/Topo_gravity.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Topo_gravity.c	2007-11-06 01:03:55 UTC (rev 8205)
+++ mc/3D/CitcomS/trunk/lib/Topo_gravity.c	2007-11-06 01:04:20 UTC (rev 8206)
@@ -443,12 +443,12 @@
         TT[m] = (float *) malloc ((E->lmesh.nsf+1)*sizeof(float));
 
     /* sin coeff */
-    geoid[0] = (float*)malloc((E->sphere.hindice+2)*sizeof(float));
+    geoid[0] = (float*)malloc(E->sphere.hindice*sizeof(float));
     /* cos coeff */
-    geoid[1] = (float*)malloc((E->sphere.hindice+2)*sizeof(float));
+    geoid[1] = (float*)malloc(E->sphere.hindice*sizeof(float));
 
     /* reset arrays */
-    for (p = 0; p <= E->sphere.hindice; p++) {
+    for (p = 0; p < E->sphere.hindice; p++) {
         harm_geoid[0][p] = 0;
         harm_geoid[1][p] = 0;
     }
@@ -525,8 +525,8 @@
     void sphere_expansion();
 
     for (i=0; i<2; i++) {
-        tpgt[i] = (float *)malloc((E->sphere.hindice+2)*sizeof(float));
-        tpgb[i] = (float *)malloc((E->sphere.hindice+2)*sizeof(float));
+        tpgt[i] = (float *)malloc(E->sphere.hindice*sizeof(float));
+        tpgb[i] = (float *)malloc(E->sphere.hindice*sizeof(float));
     }
 
     stress_scaling = E->data.ref_viscosity*E->data.therm_diff/
@@ -645,7 +645,7 @@
 
     if (E->parallel.me == (E->parallel.nprocz-1))  {
         for (i = 0; i < 2; i++)
-            for (p = 0; p <= E->sphere.hindice; p++) {
+            for (p = 0; p < E->sphere.hindice; p++) {
                 harm_geoid[i][p] = harm_geoid_from_bncy[i][p]
                                  + harm_geoid_from_tpgt[i][p]
                                  + harm_geoid_from_tpgb[i][p];



More information about the cig-commits mailing list