Hi guys, <div><br></div><div>I have compiled petsc to use HDF5 package. </div><div><br></div><div>I like to store the data from a parallel vector(s) (obtained from structured DA in 3 dimensions) to file using VecView() in conjunction with <span class="Apple-style-span" style="font-family:monospace;white-space:pre"><font class="Apple-style-span" size="4">PetscViewerHDF5Open(). </font></span></div>
<div>I followed the example here <a href="http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html">http://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex10.c.html</a></div><div>and everything looks fine. </div>
<div><br></div><div>However, I had a couple questions: </div><div><br></div><div>1- When I am done writing the parallel vector obtained from the DA (and PETSC_COMM_WORLD), </div><div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)"><br>
</span></div><div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">// Create the HDF5 viewer</span></div><div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)"> </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5Open.html#PetscViewerHDF5Open" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">PetscViewerHDF5Open</a><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">(</span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">PETSC_COMM_WORLD</a><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">,</span><font color="#666666" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">"gauss.h5"</font><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">,FILE_MODE_WRITE,&H5viewer);</span></div>
<div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">// Write the H5 file</span></div><div> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecView.html#VecView" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">VecView</a><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">(gauss,H5viewer);</span></div>
<div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">// Cleaning stage</span></div><div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)"> </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">PetscViewerDestroy</a><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)">(&H5viewer);</span></div>
<div><span class="Apple-style-span" style="font-family:monospace;white-space:pre;background-color:rgb(255,255,255)"><br></span></div><div>how can I add data that are just simple 1-D numbers stored on local arrays. </div>
<div>
Easier said, I would like to add the structured grid coordinates (first all x's, then all y's, and then all z's) at the end (or to the beginning) of each data (*.h5) file. But the grid coordinates are stored locally on each machine and not derived from any parallel vectors or DA. I was thinking about creating vectors and viewers using PETSC_COMM_SELF but i am not sure if that is the right approach since that vector is created on all processors locally. </div>
<div><br></div><div>2- When using VecView() and HDF5 writer, what is the status of data compression? </div><div>The reason that I am asking is that, I used the same example above and comparing two files saved via two different PetscViewers, i.e. (just) Binary and HDF5 (Binary) the size is not reduced in the (*.h5) case. </div>
<div>In fact, it is slightly bigger than pure binary file!!</div><div>Is there any command we have to set in Petsc to tell HDF5 viewer to use data compression? </div><div><br></div><div>Thanks for your patience, </div><div>
Best, </div><div>Mohamad</div><div><br></div><div><br></div><div><br></div>
<div><br></div>