Commits

Hong Zhang committed a56e5ad

sync agg.c and gamg.c with branch master by removing local edits

Comments (0)

Files changed (2)

src/ksp/pc/impls/gamg/agg.c

   nloc = n/bs;
 
   if (pc_gamg_agg->square_graph) {
-    PetscBool       rart=PETSC_FALSE;
-    
     if (verbose > 1) PetscPrintf(comm,"[%d]%s square graph\n",rank,__FUNCT__);
-    ierr = PetscOptionsGetBool(NULL,"-Guse_rart",&rart,NULL);CHKERRQ(ierr);
-    if (rart) { /* Gmat2 = Gmat1*Gmat1^T - via inner products */
-      ierr = MatMatTransposeMult(Gmat1, Gmat1, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &Gmat2);CHKERRQ(ierr);
-    } else {    /* Gmat2 = Gmat1^T*Gmat1 - via outer products */
-      ierr = MatTransposeMatMult(Gmat1, Gmat1, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &Gmat2);CHKERRQ(ierr); 
-    }
+    /* ierr = MatMatTransposeMult(Gmat1, Gmat1, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &Gmat2); */
+    ierr = MatTransposeMatMult(Gmat1, Gmat1, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &Gmat2);CHKERRQ(ierr);
     if (verbose > 2) {
       ierr = PetscPrintf(comm,"[%d]%s square graph done\n",rank,__FUNCT__);CHKERRQ(ierr);
       /* check for symetry */

src/ksp/pc/impls/gamg/gamg.c

   PetscMPIInt     rank,size,new_size,nactive=*a_nactive_proc;
   PetscInt        ncrs_eq,ncrs_prim,f_bs;
 
-  PetscBool       rart=PETSC_FALSE;
-
   PetscFunctionBegin;
   ierr = PetscObjectGetComm((PetscObject)Amat_fine,&comm);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr);
   ierr = MatGetBlockSize(Amat_fine, &f_bs);CHKERRQ(ierr);
   /* RAP */
-  ierr = PetscOptionsGetBool(NULL,"-use_rart",&rart,NULL);CHKERRQ(ierr);
-  if (!rart) {
-    ierr = MatPtAP(Amat_fine, Pold, MAT_INITIAL_MATRIX, 2.0, &Cmat);CHKERRQ(ierr);
-  } else { /* Use RARt */
-    Mat R;
-    ierr = MatTranspose(Pold,MAT_INITIAL_MATRIX,&R);CHKERRQ(ierr);
-    ierr = MatRARt(Amat_fine, R, MAT_INITIAL_MATRIX, 2.0, &Cmat);CHKERRQ(ierr);
-    ierr = MatDestroy(&R);CHKERRQ(ierr);
-  }
+  ierr = MatPtAP(Amat_fine, Pold, MAT_INITIAL_MATRIX, 2.0, &Cmat);CHKERRQ(ierr);
 
   /* set 'ncrs_prim' (nodes), 'ncrs_eq' (equations)*/
   ncrs_prim = pc_gamg->data_sz/pc_gamg->data_cell_cols/pc_gamg->data_cell_rows;
   PetscLogDouble nnz0=0.,nnztot=0.;
   MatInfo        info;
   PetscBool      stokes = PETSC_FALSE, redo_mesh_setup = (PetscBool)(!pc_gamg->reuse_prol);
-  PetscBool      rart=PETSC_FALSE;
 
   PetscFunctionBegin;
   ierr = PetscObjectGetComm((PetscObject)pc,&comm);CHKERRQ(ierr);
   ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
   ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
-  ierr = PetscOptionsGetBool(NULL,"-use_rart",&rart,NULL);CHKERRQ(ierr);
 
   if (pc_gamg->verbose>2) PetscPrintf(comm,"[%d]%s pc_gamg->setup_count=%d pc->setupcalled=%d\n",rank,__FUNCT__,pc_gamg->setup_count,pc->setupcalled);
 
         for (level=pc_gamg->Nlevels-2; level>=0; level--) {
           /* the first time through the matrix structure has changed from repartitioning */
           if (pc_gamg->setup_count==2 && (pc_gamg->repart || level==0)) {
-            if (!rart) {
-              ierr = MatPtAP(dB,mglevels[level+1]->interpolate,MAT_INITIAL_MATRIX,1.0,&B);CHKERRQ(ierr);
-            } else { /* Use RARt */
-              Mat R;
-              ierr = MatTranspose(mglevels[level+1]->interpolate,MAT_INITIAL_MATRIX,&R);CHKERRQ(ierr);
-              ierr = MatRARt(dB, R, MAT_INITIAL_MATRIX, 2.0, &B);CHKERRQ(ierr);
-              ierr = MatDestroy(&R);CHKERRQ(ierr);
-            }
+            ierr = MatPtAP(dB,mglevels[level+1]->interpolate,MAT_INITIAL_MATRIX,1.0,&B);CHKERRQ(ierr);
             ierr = MatDestroy(&mglevels[level]->A);CHKERRQ(ierr);
 
             mglevels[level]->A = B;
           } else {
             ierr = KSPGetOperators(mglevels[level]->smoothd,NULL,&B,NULL);CHKERRQ(ierr);
-            if (!rart) {
-              ierr = MatPtAP(dB,mglevels[level+1]->interpolate,MAT_REUSE_MATRIX,1.0,&B);CHKERRQ(ierr);
-             } else { /* Use RARt */
-              Mat R;
-              ierr = MatTranspose(mglevels[level+1]->interpolate,MAT_INITIAL_MATRIX,&R);CHKERRQ(ierr);
-              ierr = MatRARt(dB, R, MAT_REUSE_MATRIX, 1.0, &B);CHKERRQ(ierr);
-              ierr = MatDestroy(&R);CHKERRQ(ierr);
-            } 
+            ierr = MatPtAP(dB,mglevels[level+1]->interpolate,MAT_REUSE_MATRIX,1.0,&B);CHKERRQ(ierr);
           }
           ierr = KSPSetOperators(mglevels[level]->smoothd,B,B,SAME_NONZERO_PATTERN);CHKERRQ(ierr);
           dB   = B;