Commits

Peter Brune committed 6a63999

SNES: Removed now-extraneous fnorm variable from SNESApplyPC()

Since c1c75074e128c85b53ed5ce1f9b329b0e4d789b9 the fnorm argument
has been unused. Fix documentation also.

Reported-by: Barry Smith <bsmith@mcs.anl.gov>

Comments (0)

Files changed (9)

include/petscsnes.h

 PETSC_EXTERN PetscErrorCode SNESGetDM(SNES,DM*);
 PETSC_EXTERN PetscErrorCode SNESSetPC(SNES,SNES);
 PETSC_EXTERN PetscErrorCode SNESGetPC(SNES,SNES*);
-PETSC_EXTERN PetscErrorCode SNESApplyPC(SNES,Vec,Vec,PetscReal*,Vec);
+PETSC_EXTERN PetscErrorCode SNESApplyPC(SNES,Vec,Vec,Vec);
 PETSC_EXTERN PetscErrorCode SNESGetPCFunction(SNES,Vec,PetscReal*);
 PETSC_EXTERN PetscErrorCode SNESComputeFunctionDefaultPC(SNES,Vec,Vec);
 PETSC_EXTERN PetscErrorCode SNESSetPCSide(SNES,PCSide);

src/snes/impls/ls/ls.c

 
   /* compute the preconditioned function first in the case of left preconditioning with preconditioned function */
   if (snes->pc && snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;
         }
         ierr = SNESGetPCFunction(snes,F,&fnorm);CHKERRQ(ierr);
       } else if (snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_UNPRECONDITIONED) {
-        ierr = SNESApplyPC(snes,X,F,&fnorm,F);CHKERRQ(ierr);
+        ierr = SNESApplyPC(snes,X,F,F);CHKERRQ(ierr);
         ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
         if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
           snes->reason = SNES_DIVERGED_INNER;

src/snes/impls/ncg/snesncg.c

   /* compute the initial function and preconditioned update dX */
 
   if (snes->pc && snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,dX);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,dX);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;
   }
   if (snes->pc) {
     if (snes->functype == SNES_FUNCTION_UNPRECONDITIONED) {
-      ierr = SNESApplyPC(snes,X,F,&fnorm,dX);CHKERRQ(ierr);
+      ierr = SNESApplyPC(snes,X,F,dX);CHKERRQ(ierr);
       ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
       if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
         snes->reason = SNES_DIVERGED_INNER;
     }
     if (snes->pc) {
       if (snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-        ierr = SNESApplyPC(snes,X,NULL,NULL,dX);CHKERRQ(ierr);
+        ierr = SNESApplyPC(snes,X,NULL,dX);CHKERRQ(ierr);
         ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
         if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
           snes->reason = SNES_DIVERGED_INNER;
         }
         ierr = VecCopy(dX,F);CHKERRQ(ierr);
       } else {
-        ierr = SNESApplyPC(snes,X,F,&fnorm,dX);CHKERRQ(ierr);
+        ierr = SNESApplyPC(snes,X,F,dX);CHKERRQ(ierr);
         ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
         if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
           snes->reason = SNES_DIVERGED_INNER;

src/snes/impls/ngmres/anderson.c

   /* r = F(x) */
 
   if (snes->pc && snes->pcside == PC_LEFT) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;

src/snes/impls/ngmres/ngmresfunc.c

   ierr = SNESLineSearchPostCheck(snes->linesearch,X,Y,XA,&changed_y,&changed_w);CHKERRQ(ierr);
   if (!ngmres->approxfunc) {
     if (snes->pc && snes->pcside == PC_LEFT) {
-      ierr = SNESApplyPC(snes,XA,NULL,NULL,FA);CHKERRQ(ierr);
+      ierr = SNESApplyPC(snes,XA,NULL,FA);CHKERRQ(ierr);
     } else {
       ierr =SNESComputeFunction(snes,XA,FA);CHKERRQ(ierr);
     }

src/snes/impls/ngmres/snesngmres.c

   /* initialization */
 
   if (snes->pc && snes->pcside == PC_LEFT) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;

src/snes/impls/qn/qn.c

   ierr       = PetscObjectSAWsGrantAccess((PetscObject)snes);CHKERRQ(ierr);
 
   if (snes->pc && snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;
     }
   }
   if (snes->pc && snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_UNPRECONDITIONED) {
-      ierr = SNESApplyPC(snes,X,F,&fnorm,D);CHKERRQ(ierr);
+      ierr = SNESApplyPC(snes,X,F,D);CHKERRQ(ierr);
       ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
       if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
         snes->reason = SNES_DIVERGED_INNER;
     ierr = (*snes->ops->converged)(snes,snes->iter,xnorm,ynorm,fnorm,&snes->reason,snes->cnvP);CHKERRQ(ierr);
     if (snes->reason) PetscFunctionReturn(0);
     if (snes->pc && snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_UNPRECONDITIONED) {
-      ierr = SNESApplyPC(snes,X,F,&fnorm,D);CHKERRQ(ierr);
+      ierr = SNESApplyPC(snes,X,F,D);CHKERRQ(ierr);
       ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
       if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
         snes->reason = SNES_DIVERGED_INNER;

src/snes/impls/richardson/snesrichardson.c

   ierr       = PetscObjectSAWsGrantAccess((PetscObject)snes);CHKERRQ(ierr);
 
   if (snes->pc && snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       snes->reason = SNES_DIVERGED_INNER;
     }
   }
   if (snes->pc && snes->functype == SNES_FUNCTION_UNPRECONDITIONED) {
-      ierr = SNESApplyPC(snes,X,F,&fnorm,Y);CHKERRQ(ierr);
+      ierr = SNESApplyPC(snes,X,F,Y);CHKERRQ(ierr);
       ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
       if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
         snes->reason = SNES_DIVERGED_INNER;
 
     if (snes->pc) {
       if (snes->functype == SNES_FUNCTION_PRECONDITIONED) {
-        ierr = SNESApplyPC(snes,X,NULL,NULL,Y);CHKERRQ(ierr);
+        ierr = SNESApplyPC(snes,X,NULL,Y);CHKERRQ(ierr);
         ierr = VecNorm(F,NORM_2,&fnorm);CHKERRQ(ierr);
         ierr = VecCopy(Y,F);CHKERRQ(ierr);
       } else {
-        ierr = SNESApplyPC(snes,X,F,&fnorm,Y);CHKERRQ(ierr);
+        ierr = SNESApplyPC(snes,X,F,Y);CHKERRQ(ierr);
       }
       ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
       if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {

src/snes/interface/snespc.c

 #undef __FUNCT__
 #define __FUNCT__ "SNESApplyPC"
 /*@
-   SNESApplyPC - Calls the function that has been set with SNESSetFunction().
+   SNESApplyPC - Runs the nonlinear preconditioner and returns the step.
 
    Collective on SNES
 
    Input Parameters:
 +  snes - the SNES context
--  x - input vector
+.  x - input vector
+-  f - optional; the function evaluation on x
 
    Output Parameter:
 .  y - function vector, as set by SNESSetFunction()
 
    Notes:
-   SNESComputeFunction() should be called on X before SNESApplyPC() is called, as it is
+   SNESComputeFunction() should be called on x before SNESApplyPC() is called, as it is
    with SNESComuteJacobian().
 
    Level: developer
 
 .seealso: SNESGetPC(),SNESSetPC(),SNESComputeFunction()
 @*/
-PetscErrorCode  SNESApplyPC(SNES snes,Vec x,Vec f,PetscReal *fnorm,Vec y)
+PetscErrorCode  SNESApplyPC(SNES snes,Vec x,Vec f,Vec y)
 {
   PetscErrorCode ierr;
 
 
   PetscFunctionBegin;
   if (snes->pc) {
-    ierr = SNESApplyPC(snes,X,NULL,NULL,F);CHKERRQ(ierr);
+    ierr = SNESApplyPC(snes,X,NULL,F);CHKERRQ(ierr);
     ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
     if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
       ierr = SNESSetFunctionDomainError(snes);CHKERRQ(ierr);