diff options
Diffstat (limited to 'src/petsc_confmetric.c')
-rw-r--r-- | src/petsc_confmetric.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/petsc_confmetric.c b/src/petsc_confmetric.c index 96f1dbb..d85307a 100644 --- a/src/petsc_confmetric.c +++ b/src/petsc_confmetric.c @@ -15,8 +15,8 @@ #include "assert.h" #include "mpi.h" -#include "sles.h" - +#include "petscsles.h" +#include "ellpetsc.h" #include "CactusPUGH/PUGH/src/include/pugh.h" static const char *rcsid = "$Header$"; @@ -354,16 +354,16 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, 19,PETSC_NULL, /* Diagonal */ 19,PETSC_NULL, /* Off diagonal */ &A[0]); /* The output */ - CHKERRA(ierr); + CHKERRQ(ierr); ierr = VecCreateMPI(pughGH->PUGH_COMM_WORLD,(endpoint-startpoint),rank,&soln); - CHKERRA(ierr); + CHKERRQ(ierr); ierr = VecCreateMPI(pughGH->PUGH_COMM_WORLD,(endpoint-startpoint),rank,&b); - CHKERRA(ierr); + CHKERRQ(ierr); /*$}$*/ /*$else {$*/ /* ierr = MatRestoreValuesMemory(A); */ /*$CCTK_WARN(0,"no reuse"); - CHKERRA(ierr); + CHKERRQ(ierr); }$*/ @@ -702,7 +702,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, else { J = wsp[DATINDEX(pughGH,i+l,j+m,k+n)]; ierr = MatSetValues(A[0],1,&I,1,&J,&(a(l,m,n)),INSERT_VALUES); - CHKERRA(ierr); + CHKERRQ(ierr); } } } @@ -711,7 +711,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, /* printf("RHS(%d %d %d)+N: %f",i,j,k,rhsval);*/ ierr = VecSetValues(b,1,&I,&rhsval,INSERT_VALUES); - CHKERRA(ierr); + CHKERRQ(ierr); } } @@ -719,18 +719,18 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, } if (verbose) CCTK_INFO ("Assembling the vectors"); - ierr = MatAssemblyBegin(A[0],MAT_FINAL_ASSEMBLY); CHKERRA(ierr); - ierr = VecAssemblyBegin(soln); CHKERRA(ierr); - ierr = VecAssemblyBegin(b); CHKERRA(ierr) - ierr = MatAssemblyEnd(A[0],MAT_FINAL_ASSEMBLY); CHKERRA(ierr); - ierr = VecAssemblyEnd(soln); CHKERRA(ierr); - ierr = VecAssemblyEnd(b); CHKERRA(ierr); - ierr = MatSetOption(A[0],MAT_NO_NEW_NONZERO_LOCATIONS); CHKERRA(ierr); + ierr = MatAssemblyBegin(A[0],MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); + ierr = VecAssemblyBegin(soln); CHKERRQ(ierr); + ierr = VecAssemblyBegin(b); CHKERRQ(ierr) + ierr = MatAssemblyEnd(A[0],MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); + ierr = VecAssemblyEnd(soln); CHKERRQ(ierr); + ierr = VecAssemblyEnd(b); CHKERRQ(ierr); + ierr = MatSetOption(A[0],MAT_NO_NEW_NONZERO_LOCATIONS); CHKERRQ(ierr); OptionsSetValue("-ksp_monitor",""); CCTK_INFO("CREATING SLES"); - ierr = SLESCreate(pughGH->PUGH_COMM_WORLD,&sles); CHKERRA(ierr); + ierr = SLESCreate(pughGH->PUGH_COMM_WORLD,&sles); CHKERRQ(ierr); /* @@ -743,15 +743,15 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, means, we'll leave it for now. */ CCTK_INFO("CREATING SLES OPERATOR"); - ierr = SLESSetOperators(sles,A[0],A[0],DIFFERENT_NONZERO_PATTERN); CHKERRA(ierr); + ierr = SLESSetOperators(sles,A[0],A[0],DIFFERENT_NONZERO_PATTERN); CHKERRQ(ierr); /* Set linear solver defaults for this problem. Later this should be replaced/modified with appropriate parsing from the parameter parser. For now it is not. These defaults are reasonable, I hope. */ CCTK_INFO("SLESGet KSP/PC"); - ierr = SLESGetKSP(sles,&ksp); CHKERRA(ierr); - ierr = SLESGetPC(sles,&pc); CHKERRA(ierr); + ierr = SLESGetKSP(sles,&ksp); CHKERRQ(ierr); + ierr = SLESGetPC(sles,&pc); CHKERRQ(ierr); /* Get the PC Type */ if (CCTK_Equals(petsc_PC_type,"PCJACOBI")) @@ -772,7 +772,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, CCTK_WARN(1,"Don't understand petsc_PC_type. Using PCNONE\n"); ierr = PCSetType(pc,PCNONE); } - CHKERRA(ierr); + CHKERRQ(ierr); /* Now the same thing for the KSP Type */ @@ -800,7 +800,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, CCTK_WARN (1,"I don't understand petsc_KSP_type. Using BiCGSTAB\n"); ierr = KSPSetType(ksp,KSPBCGS); } - CHKERRA(ierr); + CHKERRQ(ierr); @@ -822,7 +822,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, ierr = KSPSetTolerances(ksp,rtol,atol,PETSC_DEFAULT, PETSC_DEFAULT); - CHKERRA(ierr); + CHKERRQ(ierr); /* We are warned in the manual that @@ -849,7 +849,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, */ /*$ierr = KSPGMRESSetOrthogonalization(ksp, KSPGMRESUnmodifiedGramSchmidtOrthogonalization); - CHKERRA(ierr);$*/ + CHKERRQ(ierr);$*/ /* We also learn that ... @@ -861,7 +861,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, */ CCTK_INFO("KSPSetInitialGuess\n"); - ierr = KSPSetInitialGuessNonzero(ksp); CHKERRA(ierr); + ierr = KSPSetInitialGuessNonzero(ksp); CHKERRQ(ierr); /* Set runtime options. Since we don't use PETSC runtime options @@ -869,7 +869,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, we parse things out. But that may not be such a good idea. So lets put it here. */ - ierr = SLESSetFromOptions(sles); CHKERRA(ierr); + ierr = SLESSetFromOptions(sles); CHKERRQ(ierr); /* OK so finally we are able to ... */ @@ -878,7 +878,7 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, Solve the linear system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ CCTK_INFO("SLES solve..."); - ierr = SLESSolve(sles,b,soln,&its); CHKERRA(ierr); + ierr = SLESSolve(sles,b,soln,&its); CHKERRQ(ierr); /* Here we can form a "res = Ax - b" and find its norm to get an idea of how well we've converged. Put this in later @@ -925,14 +925,14 @@ void petsc_confmetric_solver(cGH *GH, int *MetricPsiI, int MetricPsiISize, PUGH_SyncGroup(GH,"ellpetsc::petscworkspace"); /* And finally free up the matrix memory FIXME - ierr = MatReleaseValuesMemory(A); CHKERRA(ierr); */ + ierr = MatReleaseValuesMemory(A); CHKERRQ(ierr); */ /* This code is not used anymore */ if (verbose) CCTK_INFO("Destroying Matrices"); - ierr = SLESDestroy(sles); CHKERRA(ierr); - ierr = VecDestroy(soln); CHKERRA(ierr); - ierr = VecDestroy(b); CHKERRA(ierr); - ierr = MatDestroy(A[0]); CHKERRA(ierr); + ierr = SLESDestroy(sles); CHKERRQ(ierr); + ierr = VecDestroy(soln); CHKERRQ(ierr); + ierr = VecDestroy(b); CHKERRQ(ierr); + ierr = MatDestroy(A[0]); CHKERRQ(ierr); free(A); /*$PetscFinalize();$*/ |