[petsc-dev] petsc4py and DMDA

Loic Gouarin loic.gouarin at math.u-psud.fr
Sun Jul 24 04:40:08 CDT 2016



Le 20/07/2016 à 07:14, gouarin a écrit :
>
>
> Le 20/07/2016 à 04:59, Matthew Knepley a écrit :
>> On Tue, Jul 19, 2016 at 11:12 PM, gouarin <loic.gouarin at math.u-psud.fr
>> <mailto:loic.gouarin at math.u-psud.fr>> wrote:
>>
>>     I have an other problem: I have to optimize a Python function that
>>     take a numpy array given by the function getVecArray of a DMDA and I
>>     would like to use Pythran to do that. The problem is that Pythran
>>     doesn't recognize the array as a numpy array because the flags
>>     C_CONTIGUOUS and F_CONTIGUOUS are both set to False. Is there a
>>     reason that the C_CONTIGUOUS flag is set to False and not to True ?
>>
>>
>> For this, can't you just use vec.getArray()?
> It's ok if I use vec.getArray().
>
Finally, it's not exactly the good way because getArray return an 1D 
array whereas getVecArray of a DMDA gives an array with the good shape. 
So, for the moment, I need to reshape the array given by getArray.

I think that it could be better that getVecArray has the same behaviour 
of getArray with the good shape of the DMDA. Do you know what are the 
differences between these two functions and why the first one has no 
C_CONTIGUOUS flag set to True ?

Thanks,
Loic
> Thanks,
> Loic
>
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>     Best,
>>     Loic
>>
>>
>>
>>
>> -- 
>> 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
>




More information about the petsc-dev mailing list