[petsc-users] MatDenseGetArrayF90
Jed Brown
jed at jedbrown.org
Fri Aug 3 15:22:42 CDT 2018
https://bitbucket.org/petsc/petsc/pull-requests/1064/jed-fix-matdensegetarrayf90-maint/diff
"Smith, Barry F." <bsmith at mcs.anl.gov> writes:
> Yikes, bad bug. It wasn't returning the diagonal block just the wrong wrong size for columns.
>
> Barry
>
>
>> On Aug 3, 2018, at 1:42 PM, Jed Brown <jed at jedbrown.org> wrote:
>>
>> Can you test the patch below?
>>
>>
>> diff --git i/src/mat/interface/f90-custom/zmatrixf90.c w/src/mat/interface/f90-custom/zmatrixf90.c
>> index 0497d33fe7..7b2ab1011f 100644
>> --- i/src/mat/interface/f90-custom/zmatrixf90.c
>> +++ w/src/mat/interface/f90-custom/zmatrixf90.c
>> @@ -31,10 +31,11 @@ PETSC_EXTERN void PETSC_STDCALL matgetghostsf90_(Mat *mat,F90Array1d *ptr,int *i
>> PETSC_EXTERN void PETSC_STDCALL matdensegetarrayf90_(Mat *mat,F90Array2d *ptr,int *ierr PETSC_F90_2PTR_PROTO(ptrd))
>> {
>> PetscScalar *fa;
>> - PetscInt m,n;
>> + PetscInt m,N;
>> *ierr = MatDenseGetArray(*mat,&fa); if (*ierr) return;
>> - *ierr = MatGetLocalSize(*mat,&m,&n); if (*ierr) return;
>> - *ierr = F90Array2dCreate(fa,MPIU_SCALAR,1,m,1,n,ptr PETSC_F90_2PTR_PARAM(ptrd));
>> + *ierr = MatGetLocalSize(*mat,&m,NULL); if (*ierr) return;
>> + *ierr = MatGetSize(*mat,NULL,&N); if (*ierr) return;
>> + *ierr = F90Array2dCreate(fa,MPIU_SCALAR,1,m,1,N,ptr PETSC_F90_2PTR_PARAM(ptrd));
>> }
>> PETSC_EXTERN void PETSC_STDCALL matdenserestorearrayf90_(Mat *mat,F90Array2d *ptr,int *ierr PETSC_F90_2PTR_PROTO(ptrd))
>> {
>>
>>
>> Marius Buerkle <mbuerkle at web.de> writes:
>>
>>> No I don't get the whole block, only the diagonal block of the matrix. Maybe I am doing something wrong.
>>>
>>>>
>>>> Marius Buerkle <mbuerkle at web.de> writes:
>>>>
>>>>> Hi
>>>>>
>>>>> When using MatDenseGetArrayF90 only the diaognal part of the matrix is
>>>>> returned. Is it possible to get the whole matrix?
>>>>
>>>> You should get the entire block row (local size m by global size N).
>>>>
More information about the petsc-users
mailing list