1a5eb4965SSatish Balay #ifdef PETSC_RCS_HEADER 2*b4fc646aSLois Curfman McInnes static char vcid[] = "$Id: snesj2.c,v 1.8 1997/08/13 22:26:08 bsmith Exp curfman $"; 391627157SBarry Smith #endif 491627157SBarry Smith 5639f9d9dSBarry Smith #include "src/mat/matimpl.h" /*I "mat.h" I*/ 6639f9d9dSBarry Smith #include "src/snes/snesimpl.h" /*I "snes.h" I*/ 791627157SBarry Smith 85615d1e5SSatish Balay #undef __FUNC__ 95615d1e5SSatish Balay #define __FUNC__ "SNESDefaultComputeJacobianWithColoring" 1091627157SBarry Smith /*@C 11*b4fc646aSLois Curfman McInnes SNESDefaultComputeJacobianWithColoring - Computes the Jacobian using 12*b4fc646aSLois Curfman McInnes finite differences and coloring to exploit matrix sparsity. 1391627157SBarry Smith 1491627157SBarry Smith Input Parameters: 1591627157SBarry Smith . snes - nonlinear solver object 1691627157SBarry Smith . x1 - location at which to evaluate Jacobian 1791627157SBarry Smith . ctx - MatFDColoring contex 1891627157SBarry Smith 1991627157SBarry Smith Output Parameters: 20*b4fc646aSLois Curfman McInnes . J - Jacobian matrix (not altered in this routine) 21*b4fc646aSLois Curfman McInnes . B - newly computed Jacobian matrix to use with preconditioner (generally the same as J) 22*b4fc646aSLois Curfman McInnes . flag - flag indicating whether the matrix sparsity structure has changed 2391627157SBarry Smith 24*b4fc646aSLois Curfman McInnes .keywords: SNES, finite differences, Jacobian, coloring, sparse 2591627157SBarry Smith 26*b4fc646aSLois Curfman McInnes .seealso: SNESSetJacobian(), SNESTestJacobian(), SNESDefaultComputeJacobian() 2791627157SBarry Smith @*/ 28*b4fc646aSLois Curfman McInnes int SNESDefaultComputeJacobianWithColoring(SNES snes,Vec x1,Mat *J,Mat *B,MatStructure *flag,void *ctx) 2991627157SBarry Smith { 3091627157SBarry Smith MatFDColoring color = (MatFDColoring) ctx; 3143a90d84SBarry Smith int ierr; 3288389382SBarry Smith 33005c665bSBarry Smith ierr = MatFDColoringApply(*B,color,x1,flag,snes); CHKERRQ(ierr); 3491627157SBarry Smith return 0; 3591627157SBarry Smith } 3691627157SBarry Smith 3791627157SBarry Smith 3891627157SBarry Smith 39