[petsc-users] A flag for FormFunction.

Jed Brown jed at 59A2.org
Thu Jan 14 09:25:19 CST 2010


On Thu, 14 Jan 2010 10:14:07 -0500, "(Rebecca) Xuefei YUAN" <xy2102 at columbia.edu> wrote:
> Dear all,
> 
> I would like to setup a flag for the FormFunction like:
> 
> if (FormFunction is called by SNESComputeFunction){
>      flag = 1;
> }else{
>      flag = 0;
> }
> 
> Is there any way I can know which function called FormFunction? I can  
> tell very clear in debug mode, but I need this information in the code.

Why do you need it in the code?  If your FormFunction does something
different when called in a different context, it's very easy to end up
with incorrect results as you change the algorithm.

In any case, PETSc only calls it through SNESComputeFunction(), if you
want it to do something different when *you* call it, you can put the
flag in your user context.

Jed


More information about the petsc-users mailing list