[petsc-dev] SNES, Coloring, DM, and TS

Matthew Knepley knepley at gmail.com
Mon Feb 27 11:48:30 CST 2012


On Mon, Feb 27, 2012 at 11:31 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Mon, Feb 27, 2012 at 11:28, Matthew Knepley <knepley at gmail.com> wrote:
>
>> PetscErrorCode SNESDMComputeJacobian(SNES snes,Vec X,Mat *J,Mat
>>> *B,MatStructure *flag,void *ptr)
>>> {
>>>   PetscErrorCode ierr;
>>>   DM             dm;
>>>
>>>   PetscFunctionBegin;
>>>   ierr = SNESGetDM(snes,&dm);CHKERRQ(ierr);
>>>   ierr = DMComputeJacobian(dm,X,*J,*B,flag);CHKERRQ(ierr);
>>>   PetscFunctionReturn(0);
>>> }
>>>
>>
>> I thought the idea was for the solver to come in through the context
>> argument of the user callback. Maybe there should be
>> a structured way to for SNES to modify the DM context which it passes to
>> the user callback.
>>
>
> The way the code is written, there is no user context. The user can call
> DMGetApplicationContext() if they want one, _but_ that should not contain a
> SNES or TS. The application context should only contain
> resolution-independent parameters.
>

? My signature for FormJacobianLocal(DM dm, Vec X, Mat Jac, AppCtx *user)
definitely has a context, which is
required to have DM as the first member. We could require the solver as the
second member.

   Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120227/794938d1/attachment.html>


More information about the petsc-dev mailing list