[petsc-users] Vector layout in PetscBinaryRead.m

Smith, Barry F. bsmith at mcs.anl.gov
Thu May 2 02:08:50 CDT 2019



   Actually there is magic code that can be generated to tell Matlab the "shape" of the result when coming from DMDA. 

   You need to first push onto the viewer the format PETSC_VIEWER_BINARY_MATLAB. This will cause the VecView to save additional information about the dimensions (not in the binary file) but in the file with the same name but ending in .info.   Once the vec saves are done you just look at the .info file and it tells you what matlab commands to run to load the vector into matlab and how to reshape it for 3d.

   Good luck,

   Barry

   


> On May 1, 2019, at 4:42 PM, zakaryah via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> I'm using PETSc to solve some equations, outputting the results using PetscViewerBinaryOpen and VecView, then loading the vector files into Matlab using PetscBinaryRead.m.  The vectors are global vectors created from a 3D DMDA.  Is there a way to extract the layout from the binary file, so that I can visualize the vectors on a 3D grid?



More information about the petsc-users mailing list