I believe it, it works for me that way too. But my function to write the data
doesn't create the group. I get:
|16:45||tgallagher at harpy:MSDM-Build|> h5dump -A test.h5
HDF5 "test.h5" {
GROUP "/" {
DATASET "Coordinates" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10, 10, 10, 3 ) / ( 10, 10, 10, 3 ) }
}
}
}
despite the call to PetscViewerHDF5PushGroup I showed in the code snippet. I'm
pretty stumped why it's not working.
Tim
----- Original Message -----
From: "Matthew Knepley" <[email protected]>
To: gtg085x at mail.gatech.edu, "PETSc users list" <petsc-users at mcs.anl.gov>
Sent: Monday, November 28, 2011 4:39:57 PM
Subject: Re: [petsc-users] Creating HDF5 groups
On Mon, Nov 28, 2011 at 2:20 PM, Tim Gallagher < tim.gallagher at gatech.edu >
wrote:
Hi,
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:
I commented out the write into the root group in ex19 and it worked fine:
knepley:/PETSc3/petsc/petsc-dev$ ./arch-sieve-fdatatypes-debug/bin/h5dump
./ex19.h5
./arch-sieve-fdatatypes-debug/bin/h5dump ./ex19.h5
HDF5 "./ex19.h5" {
GROUP "/" {
GROUP "testBlockSize" {
DATASET "TestVec" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 3, 2 ) / ( 3, 2 ) }
DATA {
(0,0): 1, 1,
(1,0): 1, 1,
(2,0): 1, 1
}
}
}
GROUP "testTimestep" {
DATASET "TestVec" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 2, 3, 2 ) / ( H5S_UNLIMITED, 3, 2 ) }
DATA {
(0,0,0): 1, 1,
(0,1,0): 1, 1,
(0,2,0): 1, 1,
(1,0,0): 1, 1,
(1,1,0): 1, 1,
(1,2,0): 1, 1
}
}
}
}
}
Matt
<blockquote>
#undef __FUNCT__
#define __FUNCT__ "Body::SaveGrid"
PetscErrorCode Body::SaveGrid(const char filename[])
{
PetscViewer hdf5File;
Vec coordVec;
// Grab the coordinate vector
m_lastError = DMDAGetCoordinates(m_nodes,&coordVec);
CHKERRXX(m_lastError);
m_lastError = PetscObjectSetName((PetscObject) coordVec, "Coordinates");
CHKERRXX(m_lastError);
// Open the file
m_lastError = PetscViewerHDF5Open(m_commGroup, filename, FILE_MODE_WRITE,
&hdf5File);
CHKERRXX(m_lastError);
// Set the group to dump the grid in
m_lastError = PetscViewerHDF5PushGroup(hdf5File, "/grid");
CHKERRXX(m_lastError);
// Dump the coordinates
m_lastError = VecView(coordVec, hdf5File);
CHKERRXX(m_lastError);
m_lastError = PetscViewerHDF5PopGroup(hdf5File);
CHKERRXX(m_lastError);
// Clean up
m_lastError = PetscViewerDestroy(&hdf5File);
CHKERRXX(m_lastError);
}
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.
Any ideas?
Thanks,
Tim
</blockquote>
--
What most experimenters take for granted before they begin their experiments is
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111128/50e1ec80/attachment.htm>