[petsc-users] MatDenseGetArrayF90

Jed Brown jed at jedbrown.org
Fri Aug 3 13:42:10 CDT 2018


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