[petsc-users] SetVariableBounds vs ComputeVariableBounds

Barry Smith bsmith at mcs.anl.gov
Wed Jun 22 12:13:54 CDT 2016


> On Jun 22, 2016, at 2:42 AM, Justin Chang <jychang48 at gmail.com> wrote:
> 
> Hi all,
> 
> I am looking at the SNES tutorials ex9.c and ex58.c and am wondering why SNESVISetComputeVariableBounds() is called instead of just SNESVISetVariableBounds(). When would it be appropriate to use only using the latter?

   It is sort of similar to KSPSetOperators() and KSPSetComputeOperators(). The first is perhaps conceptually simpler since it is based on the old "subroutine library" model where you pass data to a subroutine and it does something and returns while the second is like a "call-back" library where during the time the library "does something" it comes back and asks the user for something. I think you can always reproduce the "subroutine library" approach with the "call-back" approach so in some sense the SNESVISetVariableBounds() is not needed.

  Barry

Matt has always wanted to get rid of KSPSetOperators() and always use the call back approach for solvers; I've resisted because many people like the simplicity of not providing callbacks.

> 
> Thanks,
> Justin



More information about the petsc-users mailing list