On Mon, Nov 28, 2011 at 2:20 PM, Tim Gallagher <span dir="ltr"><<a href="mailto:tim.gallagher@gatech.edu">tim.gallagher@gatech.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I'm a little confused about why this section of code doesn't work, so hopefully somebody can help me. I'm able to run the vec/vec/examples/tutorials/ex19.c test that creates an HDF5 file, and h5dump verifies that it is making the groups and putting vectors in them. However, my code does not make the group (so it obviously doesn't put the vector in it!). The function is:<br>
</blockquote><div><br></div><div>I commented out the write into the root group in ex19 and it worked fine:</div><div><br></div><div><div>knepley:/PETSc3/petsc/petsc-dev$ ./arch-sieve-fdatatypes-debug/bin/h5dump ./ex19.h5 </div>
<div>./arch-sieve-fdatatypes-debug/bin/h5dump ./ex19.h5 </div><div>HDF5 "./ex19.h5" {</div><div>GROUP "/" {</div><div> GROUP "testBlockSize" {</div><div> DATASET "TestVec" {</div>
<div> DATATYPE H5T_IEEE_F64LE</div><div> DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) }</div><div> DATA {</div><div> (0,0): 1, 1,</div><div> (1,0): 1, 1,</div><div> (2,0): 1, 1</div>
<div> }</div><div> }</div><div> }</div><div> GROUP "testTimestep" {</div><div> DATASET "TestVec" {</div><div> DATATYPE H5T_IEEE_F64LE</div><div> DATASPACE SIMPLE { ( 2, 3, 2 ) / ( H5S_UNLIMITED, 3, 2 ) }</div>
<div> DATA {</div><div> (0,0,0): 1, 1,</div><div> (0,1,0): 1, 1,</div><div> (0,2,0): 1, 1,</div><div> (1,0,0): 1, 1,</div><div> (1,1,0): 1, 1,</div><div> (1,2,0): 1, 1</div>
<div> }</div><div> }</div><div> }</div><div>}</div><div>}</div></div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
#undef __FUNCT__<br>
#define __FUNCT__ "Body::SaveGrid"<br>
PetscErrorCode Body::SaveGrid(const char filename[])<br>
{<br>
PetscViewer hdf5File;<br>
Vec coordVec;<br>
<br>
// Grab the coordinate vector<br>
m_lastError = DMDAGetCoordinates(m_nodes,&coordVec);<br>
CHKERRXX(m_lastError);<br>
<br>
m_lastError = PetscObjectSetName((PetscObject) coordVec, "Coordinates");<br>
CHKERRXX(m_lastError);<br>
<br>
// Open the file<br>
m_lastError = PetscViewerHDF5Open(m_commGroup, filename, FILE_MODE_WRITE, &hdf5File);<br>
CHKERRXX(m_lastError);<br>
<br>
// Set the group to dump the grid in<br>
m_lastError = PetscViewerHDF5PushGroup(hdf5File, "/grid");<br>
CHKERRXX(m_lastError);<br>
<br>
// Dump the coordinates<br>
m_lastError = VecView(coordVec, hdf5File);<br>
CHKERRXX(m_lastError);<br>
<br>
m_lastError = PetscViewerHDF5PopGroup(hdf5File);<br>
CHKERRXX(m_lastError);<br>
<br>
// Clean up<br>
m_lastError = PetscViewerDestroy(&hdf5File);<br>
CHKERRXX(m_lastError);<br>
}<br>
<br>
The only thing I can really see different about this and ex19 is that I don't first write any dataset to the root group, but that's not required to be valid HDF5. If I call PetscViewerHDF5GetGroup after the PushGroup call, it returns /grid.<br>
<br>
Any ideas?<br>
<br>
Thanks,<br>
<font color="#888888"><br>
Tim<br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>