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

Ryan Yan vyan2000 at gmail.com
Sun Jul 12 15:30:09 CDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090712/d4289578/attachment.htm>


More information about the petsc-users mailing list