an small and perhaps unimportant gotcha
Lisandro Dalcin
dalcinl at gmail.com
Tue Dec 2 11:05:56 CST 2008
On Tue, Dec 2, 2008 at 2:06 PM, Matthew Knepley <knepley at gmail.com> wrote:
> This is strange. I just tried KSP ex2 and after MatSetType() the type_name
> is
> set. What does *.setType() call?
It's a plain call to {Vec|Mat}SetType() . Matt, look at the actual
functions in core PETSc. If the sizes are not set, the create rutine
is "saved" in the ops table. Then the create rutine is acutally called
when VecSetSizes() is called.
> Matt
>
> On Tue, Dec 2, 2008 at 9:12 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>
>> Other (really nice!) change I've noticed is that now we can call
>> {Vec|Mat}Create() and next {Vec|Mat}SetType() and it works!
>>
>> However, see this.
>>
>> In [1]: from petsc4py import PETSc
>>
>> In [2]: x = PETSc.Vec().create()
>>
>> In [3]: x.setType('seq')
>>
>> In [4]: print x.getType()
>>
>> None
>>
>> In [5]: A = PETSc.Mat().create()
>>
>> In [6]: A.setType('seqaij')
>>
>> In [7]: print A.getType()
>>
>> None
>>
>>
>> Internally, the "type_name" field is never set, it still is NULL (then
>> petsc4y returns None).
>> The problem is that forcing the "type_name" to be set will be really
>> dangerous (rmember PetscValidType macro).
>> Any comments?
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> 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
>
--
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