Re: [petsc-users] PETSc binary write format

2018-12-07 Thread Sajid Ali via petsc-users
For future reference, attached is a snippet of code in C to convert ascii numbers (integers and doubles) to petsc readable binary vectors. -- Sajid Ali Applied Physics Northwestern University ascii_to_bin.c Description: Binary data

Re: [petsc-users] PETSc binary write format

2018-12-06 Thread Sajid Ali via petsc-users
I'm attaching the file vector.dat and the file petsc saves (vec_old.dat) with this email. Thank You, Sajid Ali Applied Physics Northwestern University vector.dat Description: Binary data vec_old.dat Description: Binary data

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Smith, Barry F. via petsc-users
Please email the binary file that you created that is causing you problems. Barry > On Dec 5, 2018, at 1:05 PM, Sajid Ali via petsc-users > wrote: > > To clarify : > The data from xxd -b petsc_output_dat is what I've reordered. The binary dump > is confusing to read since it

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Sajid Ali via petsc-users
To clarify : The data from xxd -b petsc_output_dat is what I've reordered. The binary dump is confusing to read since it contains 6 bytes per line (alongside the unnecessary ascii conversions) and the numbers start and end in odd places. I wanted each line to have only one number and copy pasted

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Sajid Ali via petsc-users
It's just a cleaner re-write of the petsc output that I can understand (which I intend to modify from python in the future). I tried removing the new line characters but that didn't work either. Looking at the first line of the binary dump from petsc output : [sajid at xrm

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Smith, Barry F. via petsc-users
> On Dec 5, 2018, at 12:40 PM, Sajid Ali > wrote: > > Exactly. > > When I run ex10 and inspect it with cat, I get garbage since the data is in > binary : > > [sajid@xrm temp]$ cat vector.dat > {N?�▒@@ @"@$@&@(@*@,@.@0@1@2@3[sajid@xrm temp]$ > > > But doing a binary dump shows the

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Sajid Ali via petsc-users
Exactly. When I run ex10 and inspect it with cat, I get garbage since the data is in binary : [sajid@xrm temp]$ cat vector.dat {N?�▒@@ @"@$@&@(@*@,@.@0@1@2@3[sajid@xrm temp]$ But doing a binary dump shows the data : [sajid@xrm temp]$ xxd -b vector.dat 000: 00010010 0011

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Mark Adams via petsc-users
On Wed, Dec 5, 2018 at 1:27 PM Sajid Ali via petsc-users < petsc-users@mcs.anl.gov> wrote: > I have created a file as per the specification as shown below > > [sajid@xrm temp]$ cat vector.dat > 00010010001101001110 > 00010100 >

Re: [petsc-users] PETSc binary write format

2018-12-05 Thread Sajid Ali via petsc-users
I have created a file as per the specification as shown below [sajid@xrm temp]$ cat vector.dat 00010010001101001110 00010100 0011

Re: [petsc-users] PETSc binary write format

2018-12-04 Thread Sajid Ali via petsc-users
For future reference, the numbers do look like they're stored as per IEEE 754 64-bit convention. I don't know what the special characters in the xxd output are but the size of the file is consistent with 2*int_32+num_elements*dobule_64. Thank you ! Sajid Ali Applied Physics Northwestern

Re: [petsc-users] PETSc binary write format

2018-12-03 Thread Smith, Barry F. via petsc-users
> On Dec 3, 2018, at 1:57 PM, Sajid Ali > wrote: > > Apologies for the error on my part. > > Does the vector binary format also work the same way : VEC_FILE_CLASSID (32 > bit int), num_elements (32 bit int) , value of the elements in double > (num_elements*64 bit double) ? Yes. >

Re: [petsc-users] PETSc binary write format

2018-12-03 Thread Sajid Ali via petsc-users
Apologies for the error on my part. Does the vector binary format also work the same way : VEC_FILE_CLASSID (32 bit int), num_elements (32 bit int) , value of the elements in double (num_elements*64 bit double) ? Are the doubles stored in IEEE_754 format ? On Mon, Dec 3, 2018 at 1:43 PM Smith,

Re: [petsc-users] PETSc binary write format

2018-12-03 Thread Smith, Barry F. via petsc-users
You saved a Vec to the file, not a Mat. > On Dec 3, 2018, at 1:38 PM, Sajid Ali via petsc-users > wrote: > > Hi, > > I ran ex10 from /vec/examples/tutorials and saved the matrix in binary format. > > Looking at the matrix in binary using xxd, I see > > [sajid@xrm temp]$ xxd -b

[petsc-users] PETSc binary write format

2018-12-03 Thread Sajid Ali via petsc-users
Hi, I ran ex10 from /vec/examples/tutorials and saved the matrix in binary format. Looking at the matrix in binary using xxd, I see [sajid@xrm temp]$ xxd -b vector.dat 000: 00010010 0011 01001110 ..{N.. 006: 00010100