[cig-commits] [commit] rajesh-petsc-schur: replaced all occurences of the caps_per_proc iteration variable by CPPR in Petsc_citcoms.c (4d7fa1b)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 19:05:51 PST 2014


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

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

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

commit 4d7fa1bafa8c5c8c7563f718a058e31bcc5b2fa7
Author: Rajesh Kommu <rajesh.kommu at gmail.com>
Date:   Tue Sep 16 09:06:10 2014 -0700

    replaced all occurences of the caps_per_proc iteration variable by CPPR in Petsc_citcoms.c


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

4d7fa1bafa8c5c8c7563f718a058e31bcc5b2fa7
 lib/Petsc_citcoms.c | 56 ++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/lib/Petsc_citcoms.c b/lib/Petsc_citcoms.c
index 318aadc..07c5e96 100644
--- a/lib/Petsc_citcoms.c
+++ b/lib/Petsc_citcoms.c
@@ -17,13 +17,13 @@ double global_v_norm2_PETSc( struct All_variables *E,  Vec v )
     ierr = VecGetArray( v, &V ); CHKERRQ( ierr );
     for (m=1; m<=E->sphere.caps_per_proc; m++)
         for (i=1; i<=E->lmesh.nno; i++) {
-            eqn1 = E->id[m][i].doff[1];
-            eqn2 = E->id[m][i].doff[2];
-            eqn3 = E->id[m][i].doff[3];
+            eqn1 = E->id[CPPR][i].doff[1];
+            eqn2 = E->id[CPPR][i].doff[2];
+            eqn3 = E->id[CPPR][i].doff[3];
             /* L2 norm  */
             temp += (V[eqn1] * V[eqn1] +
                      V[eqn2] * V[eqn2] +
-                     V[eqn3] * V[eqn3]) * E->NMass[m][i];
+                     V[eqn3] * V[eqn3]) * E->NMass[CPPR][i];
         }
     ierr = VecRestoreArray( v, &V ); CHKERRQ( ierr );
 
@@ -46,7 +46,7 @@ double global_p_norm2_PETSc( struct All_variables *E,  Vec p )
     for (m=1; m<=E->sphere.caps_per_proc; m++)
         for (i=0; i<E->lmesh.npno; i++) {
             /* L2 norm */
-            temp += P[i] * P[i] * E->eco[m][i+1].area;
+            temp += P[i] * P[i] * E->eco[CPPR][i+1].area;
         }
     ierr = VecRestoreArray( p, &P ); CHKERRQ( ierr );
 
@@ -69,7 +69,7 @@ double global_div_norm2_PETSc( struct All_variables *E,  Vec a )
     for (m=1; m<=E->sphere.caps_per_proc; m++)
         for (i=0; i<E->lmesh.npno; i++) {
             /* L2 norm of div(u) */
-            temp += A[i] * A[i] / E->eco[m][i+1].area;
+            temp += A[i] * A[i] / E->eco[CPPR][i+1].area;
 
             /* L1 norm */
             /*temp += fabs(A[i]);*/
@@ -106,14 +106,14 @@ PetscErrorCode assemble_c_u_PETSc( struct All_variables *E, Vec U, Vec result, i
     for(a=1;a<=ends;a++) {
       p = (a-1)*dims;
       for(e=0;e<nel;e++) {
-        b = E->IEN[level][m][e+1].node[a];
-        j1= E->ID[level][m][b].doff[1];
-        j2= E->ID[level][m][b].doff[2];
-        j3= E->ID[level][m][b].doff[3];
-
-        result_temp[e]  += E->elt_c[level][m][e+1].c[p  ][0] * U_temp[j1]
-                         + E->elt_c[level][m][e+1].c[p+1][0] * U_temp[j2]
-                         + E->elt_c[level][m][e+1].c[p+2][0] * U_temp[j3];
+        b = E->IEN[level][CPPR][e+1].node[a];
+        j1= E->ID[level][CPPR][b].doff[1];
+        j2= E->ID[level][CPPR][b].doff[2];
+        j3= E->ID[level][CPPR][b].doff[3];
+
+        result_temp[e]  += E->elt_c[level][CPPR][e+1].c[p  ][0] * U_temp[j1]
+                         + E->elt_c[level][CPPR][e+1].c[p+1][0] * U_temp[j2]
+                         + E->elt_c[level][CPPR][e+1].c[p+2][0] * U_temp[j3];
       }
     }
   }
@@ -130,9 +130,9 @@ void strip_bcs_from_residual_PETSc(
   PetscErrorCode ierr;
   PetscScalar *ResData;
   ierr = VecGetArray(Res, &ResData);
-    if( E->num_zero_resid[level][1] ) {
-      for( i = 1; i <= E->num_zero_resid[level][1]; i++ ) {
-        ResData[E->zero_resid[level][1][i]] = 0.0;
+    if( E->num_zero_resid[level][CPPR] ) {
+      for( i = 1; i <= E->num_zero_resid[level][CPPR]; i++ ) {
+        ResData[E->zero_resid[level][CPPR][i]] = 0.0;
       }
     }
   ierr = VecRestoreArray(Res, &ResData);
@@ -188,11 +188,11 @@ PetscErrorCode PC_Apply_MultiGrid( PC pc, Vec x, Vec y )
 
   ierr = VecGetArray(x, &xData); CHKERRQ(ierr);
   for(i = 0; i < ctx->nno; ++i)
-    ctx->RR[1][i] = xData[i];
+    ctx->RR[CPPR][i] = xData[i];
   ierr = VecRestoreArray(x, &xData); CHKERRQ(ierr);
   /* initialize the space for the solution */
   for( i = 0; i < ctx->nno; i++ )
-      ctx->V[1][i] = 0.0;
+      ctx->V[CPPR][i] = 0.0;
 
   count = 0;
 
@@ -205,7 +205,7 @@ PetscErrorCode PC_Apply_MultiGrid( PC pc, Vec x, Vec y )
   
   ierr = VecGetArray(y, &yData); CHKERRQ(ierr);
   for(i = 0; i < ctx->nno; i++)
-    yData[i] = ctx->V[1][i];
+    yData[i] = ctx->V[CPPR][i];
   ierr = VecRestoreArray(y, &yData); CHKERRQ(ierr);
 
   PetscFunctionReturn(0);
@@ -224,13 +224,13 @@ PetscErrorCode MatShellMult_del2_u( Mat K, Vec U, Vec KU )
   neq = ctx->iSize; // ctx->iSize SHOULD be the same as ctx->oSize
   ierr = VecGetArray(U, &UData); CHKERRQ(ierr);
   for(j = 0; j <neq; j++)
-    ctx->iData[1][j] = UData[j];
+    ctx->iData[CPPR][j] = UData[j];
   ierr = VecRestoreArray(U, &UData); CHKERRQ(ierr);
   // actual CitcomS operation
   assemble_del2_u( ctx->E, ctx->iData, ctx->oData, ctx->level, 1 );
   ierr = VecGetArray(KU, &KUData); CHKERRQ(ierr);
   for(j = 0; j < neq; j++)
-    KUData[j] = ctx->oData[1][j];
+    KUData[j] = ctx->oData[CPPR][j];
   ierr = VecRestoreArray(KU, &KUData); CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
@@ -249,13 +249,13 @@ PetscErrorCode MatShellMult_grad_p( Mat G, Vec P, Vec GP )
   neq = ctx->oSize;
   ierr = VecGetArray(P, &PData); CHKERRQ(ierr);
   for(j = 0; j < nel; j++)
-    ctx->iData[1][j] = PData[j];
+    ctx->iData[CPPR][j] = PData[j];
   ierr = VecRestoreArray(P, &PData); CHKERRQ(ierr);
   // actual CitcomS operation
   assemble_grad_p( ctx->E, ctx->iData, ctx->oData, ctx->level );
   ierr = VecGetArray(GP, &GPData); CHKERRQ(ierr);
   for(j = 0; j < neq; j++)
-    GPData[j] = ctx->oData[1][j];
+    GPData[j] = ctx->oData[CPPR][j];
   ierr = VecRestoreArray(GP, &GPData); CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
@@ -274,13 +274,13 @@ PetscErrorCode MatShellMult_div_u( Mat D, Vec U, Vec DU )
   nel = ctx->oSize;
   ierr = VecGetArray(U, &UData); CHKERRQ(ierr);
   for(j = 0; j < neq; j++)
-    ctx->iData[1][j] = UData[j];
+    ctx->iData[CPPR][j] = UData[j];
   ierr = VecRestoreArray(U, &UData); CHKERRQ(ierr);
   // actual CitcomS operation
   assemble_div_u( ctx->E, ctx->iData, ctx->oData, ctx->level );
   ierr = VecGetArray(DU, &DUData); CHKERRQ(ierr);
   for(j = 0; j < nel; j++)
-    DUData[j] = ctx->oData[1][j];
+    DUData[j] = ctx->oData[CPPR][j];
   ierr = VecRestoreArray(DU, &DUData); CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }
@@ -299,13 +299,13 @@ PetscErrorCode MatShellMult_div_rho_u( Mat DC, Vec U, Vec DU )
   nel = ctx->oSize;
   ierr = VecGetArray(U, &UData); CHKERRQ(ierr);
   for(j = 0; j < neq; j++)
-    ctx->iData[1][j] = UData[j];
+    ctx->iData[CPPR][j] = UData[j];
   ierr = VecRestoreArray(U, &UData); CHKERRQ(ierr);
   // actual CitcomS operation
   assemble_div_rho_u( ctx->E, ctx->iData, ctx->oData, ctx->level );
   ierr = VecGetArray(DU, &DUData); CHKERRQ(ierr);
   for(j = 0; j < nel; j++)
-    DUData[j] = ctx->oData[1][j];
+    DUData[j] = ctx->oData[CPPR][j];
   ierr = VecRestoreArray(DU, &DUData); CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }



More information about the CIG-COMMITS mailing list