about src/mat/examples/tutorials/ex5.c.html

Barry Smith bsmith at mcs.anl.gov
Sun Jul 12 16:41:56 CDT 2009


   The manual page for MatLoad() and VecLoad() contain the definitions  
of those structs.

    The file binary format is independent of parallel storage of the  
matrix so has no information about the "diagonal" and "off-diagonal"  
parts of the matrix. That is all determined when the binary file is  
read in.

    Barry


On Jul 12, 2009, at 3:30 PM, Ryan Yan wrote:

> http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/src/mat/examples/tutorials/ex5.c.html
>
> Hi All,
> I am tring to read through an example about PetscBinaryRead. It  
> looks like the matrix is reading from a CRS matrix object descriptor  
> "fd1, or fd2".
>
> I have difficulty of understand the line 50:
> +++++++++++++++++++++++++++++
> 50: PetscBinaryRead(fd2,(char *)header,4,PETSC_INT);
> +++++++++++++++++++++++++++++
> From the context, my guess is:
> header[0] unknown
>
> header[1] contains the info of how many rows of matrix stored on  
> this processor
>
> header[2] contains the info of how many global columns of the matrix
>
> header[3] unknown
>
> and line:
> ++++++++++++++++++++++++++++
> 86: PetscBinaryRead(fd1,ourlens,m,PETSC_INT);
> 101: PetscBinaryRead(fd1,mycols,ourlens[i],PETSC_INT);
> +++++++++++++++++++++++++++++++
> From the context, my guess is:
> ourlens[i] stores the length of the ith local row for the "local"  
> portion of the matrix.
>
> mycols is an array storing the column indices of the nonzero entries  
> of the ith local row for the "local" portion of the matrix(include  
> diagonal and off diagonal).
>
>
>
>
>
> Is there any pointer to the definition of the struct descriptor.
>
> Can anyone confirm my guess and provide a pointer or example?  How  
> does the PetscBinaryRead() switch smoothly between reading different  
> informations with the same parameter list.
>
> Thank you very much,
>
> Yan
>



More information about the petsc-users mailing list