xref: /petsc/src/snes/interface/snesj2.c (revision 0752156a28ac8f8e9dfaef7ce98457a01bf27fb6)
1 #ifdef PETSC_RCS_HEADER
2 static char vcid[] = "$Id: snesj2.c,v 1.8 1997/08/13 22:26:08 bsmith Exp curfman $";
3 #endif
4 
5 #include "src/mat/matimpl.h"      /*I  "mat.h"  I*/
6 #include "src/snes/snesimpl.h"    /*I  "snes.h"  I*/
7 
8 #undef __FUNC__
9 #define __FUNC__ "SNESDefaultComputeJacobianWithColoring"
10 /*@C
11     SNESDefaultComputeJacobianWithColoring - Computes the Jacobian using
12     finite differences and coloring to exploit matrix sparsity.
13 
14     Input Parameters:
15 .   snes - nonlinear solver object
16 .   x1 - location at which to evaluate Jacobian
17 .   ctx - MatFDColoring contex
18 
19     Output Parameters:
20 .   J - Jacobian matrix (not altered in this routine)
21 .   B - newly computed Jacobian matrix to use with preconditioner (generally the same as J)
22 .   flag - flag indicating whether the matrix sparsity structure has changed
23 
24 .keywords: SNES, finite differences, Jacobian, coloring, sparse
25 
26 .seealso: SNESSetJacobian(), SNESTestJacobian(), SNESDefaultComputeJacobian()
27 @*/
28 int SNESDefaultComputeJacobianWithColoring(SNES snes,Vec x1,Mat *J,Mat *B,MatStructure *flag,void *ctx)
29 {
30   MatFDColoring color = (MatFDColoring) ctx;
31   int           ierr;
32 
33   ierr = MatFDColoringApply(*B,color,x1,flag,snes); CHKERRQ(ierr);
34   return 0;
35 }
36 
37 
38 
39