SNESSetUp() and matrix-free options
Lisandro Dalcin
dalcinl at gmail.com
Mon May 11 14:46:31 CDT 2009
On Fri, May 8, 2009 at 3:55 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Quick look is ok for me.
>
Just a note, to put it clear. With my patch, passing both "-snes_mf
-snes_mf_operator" is valid, and equivalent to just passing
"-snes_mf_operator" ...
> Barry
>
> On May 8, 2009, at 1:39 PM, Lisandro Dalcin wrote:
>
>> Well, it was not so easy to change the options name...
>>
>> We would need to update docs, tests, tutorial examples, and at this
>> point it is not clear if we could agree on better options names...
>>
>> I'm now following a different approach, hope the diff attached make it
>> clear enough... Just take a look to changes to SNESSetFromOptions()
>>
>> -
>>
>>
>> On Thu, May 7, 2009 at 10:26 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>> How about?
>>>
>>> -snes_mf (means what it currently means)
>>>
>>> -snes_mf operator (means what -snes_mf_operator means)
>>>
>>> Barry
>>>
>>> On May 7, 2009, at 6:03 PM, Lisandro Dalcin wrote:
>>>
>>>> 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
>>>
>>>
>>
>>
>>
>> --
>> 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
>> <snes.diff>
>
>
--
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