Dear PETSc --

The attached at least fixes links.  I believe it fixes confusion on order
in ex5.c, too.  It came from "git format-patch origin/master" as
recommended.

Ed

-- 
Ed Bueler
Dept of Math and Stat and Geophysical Institute
University of Alaska Fairbanks
Fairbanks, AK 99775-6660
301C Chapman and 410D Elvey
907 474-7693 and 907 474-7199  (fax 907 474-5394)
From 5ad08c4da5485b75b50253bdba403aa58fdf9042 Mon Sep 17 00:00:00 2001
From: Ed Bueler <[email protected]>
Date: Thu, 26 Mar 2015 13:58:04 -0600
Subject: [PATCH] Fix documentation on callback functions for DMSNES_DA.

- fixes links to "see also" methods

- clarify arguments of func() by using variable names in prototype

- corrects order of jac,jacpre in ex5.c to match doc
  (correct order also defined here in src/snes/interface/snes.c:
    ...
    } else if (!snes->jacobian_pre) {
      Mat J,B;
      J    = snes->jacobian;
      ierr = DMCreateMatrix(snes->dm,&B);CHKERRQ(ierr);
      ierr = SNESSetJacobian(snes,J ? J : B,B,NULL,NULL);CHKERRQ(ierr);
    ...)
---
 src/snes/examples/tutorials/ex5.c |  2 +-
 src/snes/utils/dmdasnes.c         | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/snes/examples/tutorials/ex5.c b/src/snes/examples/tutorials/ex5.c
index 17df00c..7533eac 100644
--- a/src/snes/examples/tutorials/ex5.c
+++ b/src/snes/examples/tutorials/ex5.c
@@ -354,7 +354,7 @@ PetscErrorCode FormObjectiveLocal(DMDALocalInfo *info,PetscScalar **x,PetscReal
 /*
    FormJacobianLocal - Evaluates Jacobian matrix on local process patch
 */
-PetscErrorCode FormJacobianLocal(DMDALocalInfo *info,PetscScalar **x,Mat jacpre,Mat jac,AppCtx *user)
+PetscErrorCode FormJacobianLocal(DMDALocalInfo *info,PetscScalar **x,Mat jac,Mat jacpre,AppCtx *user)
 {
   PetscErrorCode ierr;
   PetscInt       i,j,k;
diff --git a/src/snes/utils/dmdasnes.c b/src/snes/utils/dmdasnes.c
index 680c2ad..ba39987 100644
--- a/src/snes/utils/dmdasnes.c
+++ b/src/snes/utils/dmdasnes.c
@@ -221,15 +221,16 @@ static PetscErrorCode SNESComputeJacobian_DMDA(SNES snes,Vec X,Mat A,Mat B,void
 .  func - local residual evaluation
 -  ctx - optional context for local residual evaluation
 
-   Calling sequence for func:
+   Calling sequence:
+   For PetscErrorCode (*func)(DMDALocalInfo *info,void *x, void *f, void *ctx),
 +  info - DMDALocalInfo defining the subdomain to evaluate the residual on
-.  x - dimensional pointer to state at which to evaluate residual
-.  f - dimensional pointer to residual, write the residual here
+.  x - dimensional pointer to state at which to evaluate residual (e.g. PetscScalar *x or **x or ***x)
+.  f - dimensional pointer to residual, write the residual here (e.g. PetscScalar *f or **f or ***f)
 -  ctx - optional context passed above
 
    Level: beginner
 
-.seealso: DMSNESSetFunction(), DMDASNESSetJacobian(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
+.seealso: DMDASNESSetJacobianLocal(), DMSNESSetFunction(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
 @*/
 PetscErrorCode DMDASNESSetFunctionLocal(DM dm,InsertMode imode,PetscErrorCode (*func)(DMDALocalInfo*,void*,void*,void*),void *ctx)
 {
@@ -265,16 +266,17 @@ PetscErrorCode DMDASNESSetFunctionLocal(DM dm,InsertMode imode,PetscErrorCode (*
 .  func - local Jacobian evaluation
 -  ctx - optional context for local Jacobian evaluation
 
-   Calling sequence for func:
+   Calling sequence:
+   For PetscErrorCode (*func)(DMDALocalInfo *info,void *x,Mat J,Mat M,void *ctx),
 +  info - DMDALocalInfo defining the subdomain to evaluate the Jacobian at
-.  x - dimensional pointer to state at which to evaluate Jacobian
+.  x - dimensional pointer to state at which to evaluate Jacobian (e.g. PetscScalar *x or **x or ***x)
 .  J - Mat object for the Jacobian
 .  M - Mat object for the Jacobian preconditioner matrix
 -  ctx - optional context passed above
 
    Level: beginner
 
-.seealso: DMSNESSetJacobian(), DMDASNESSetJacobian(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
+.seealso: DMDASNESSetFunctionLocal(), DMSNESSetJacobian(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
 @*/
 PetscErrorCode DMDASNESSetJacobianLocal(DM dm,PetscErrorCode (*func)(DMDALocalInfo*,void*,Mat,Mat,void*),void *ctx)
 {
@@ -315,7 +317,7 @@ PetscErrorCode DMDASNESSetJacobianLocal(DM dm,PetscErrorCode (*func)(DMDALocalIn
 
    Level: beginner
 
-.seealso: DMSNESSetFunction(), DMDASNESSetJacobian(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
+.seealso: DMSNESSetFunction(), DMDASNESSetJacobianLocal(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d()
 @*/
 PetscErrorCode DMDASNESSetObjectiveLocal(DM dm,DMDASNESObjective func,void *ctx)
 {
-- 
1.9.1

Reply via email to