On Mon, Nov 28, 2011 at 2:20 PM, Tim Gallagher <span dir="ltr">&lt;<a href="mailto:tim.gallagher@gatech.edu">tim.gallagher@gatech.edu</a>&gt;</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&#39;m a little confused about why this section of code doesn&#39;t work, so hopefully somebody can help me. I&#39;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&#39;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 &quot;./ex19.h5&quot; {</div><div>GROUP &quot;/&quot; {</div><div>   GROUP &quot;testBlockSize&quot; {</div><div>      DATASET &quot;TestVec&quot; {</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 &quot;testTimestep&quot; {</div><div>      DATASET &quot;TestVec&quot; {</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__ &quot;Body::SaveGrid&quot;<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,&amp;coordVec);<br>
  CHKERRXX(m_lastError);<br>
<br>
  m_lastError = PetscObjectSetName((PetscObject) coordVec, &quot;Coordinates&quot;);<br>
  CHKERRXX(m_lastError);<br>
<br>
  // Open the file<br>
  m_lastError = PetscViewerHDF5Open(m_commGroup, filename, FILE_MODE_WRITE, &amp;hdf5File);<br>
  CHKERRXX(m_lastError);<br>
<br>
  // Set the group to dump the grid in<br>
  m_lastError = PetscViewerHDF5PushGroup(hdf5File, &quot;/grid&quot;);<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(&amp;hdf5File);<br>
  CHKERRXX(m_lastError);<br>
}<br>
<br>
The only thing I can really see different about this and ex19 is that I don&#39;t first write any dataset to the root group, but that&#39;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>