[petsc-users] extract data from vector in petsc into fortran array

Barry Smith bsmith at mcs.anl.gov
Thu May 3 00:01:14 CDT 2012


On May 2, 2012, at 11:32 PM, Bo Sun wrote:

> Hi there,
> I am coding using Fortran 90 with petsc. I extract the results from vector in petsc as follows,
>  
>    PetscScalar, pointer :: xx_v(:)
>    Vec pet_u 
>   
>    ..............
>    call VecGetArrayF90(pet_u,xx_v,ierr)  
>     data_for_fortran = xx_v
>     call VecRestoreArrayF90(pet_u,xx_v,ierr)
>    ...................
>    
> 
> For small size of vector, there is no problem. But when the size of vector is above million, some strange data appear.

   What do you mean strange data? Is this reproducable? Do two different Fortran compilers give the same problem? I you can send us a simple Fortran code that demonstrates the problem we can try to reproduce it. Please send such a bug report to petsc-maint at mcs.anl.gov

   VecGetArrayF90() is generally the way to go, other things are more cumbersome.
> 

  
> Could you recommend another way to output the data of vector in petsc into fortran array ? 
> 
> 
> Thanks,
> Bo  



More information about the petsc-users mailing list