SNESSetUp() and matrix-free options

Lisandro Dalcin dalcinl at gmail.com
Thu May 7 18:03:23 CDT 2009


On Thu, May 7, 2009 at 6:14 PM, Jed Brown <jed at 59a2.org> wrote:
> Barry Smith wrote:
>>
>>    I understand this. I just don't view this as a big deal worth
>> changing the code over.
>
> I agree.  My comment was that *if* the options were to be changed, as
> Lisandro was suggesting, then it would be better to eliminate
> unnecessary options conflicts.
>

Well, now that I'm actually writing the code, things are a bit more clear...

perhaps we should have just two options

1) -snes_mf, if passed, should be string "full" or "operator" (not
sure about these)
2) -snes_mf_version, if passed, should be integer 1 or 2

In Python pseudocode (thinking options like a Python dict)


if "snes_mf" in options:

   version = options.get("snes_mf_version", 1)
   if version == 1:
      MatCreateSNESMF(...)
   elif version == 2:
      SNESDefaultMatrixFreeCreate2(...)
   else:
      raise PetscError

   value = options["snes_mf"]
   if value == "operator":
      SNESSetJacobian(J,0,0,...)
   elif value == "full":
      SNESSetJacobian(J,J,MatMFFDComputeJacobian)
   else:
      raise PetscError


Note that I expect snes_mf_version=2 (despite being MatShell based) to
work with snes_mf="operator"

What do you think?

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594



More information about the petsc-dev mailing list