[hdf-forum] problems writing the correct .h5-file

Natalie Happenhofer nataliehapp at hotmail.com
Mon Oct 13 04:14:17 EDT 2008


Hi!

I´m trying to write my data in the xdmf-format and read it in paraview.
I have a 3D - curvilinear grid, i.e. I have to specify every point with
its coordinates and then I have scalar attribute data, to be assigned
to each node. 

The .xmf meta-data file is recognised by paraview and works fine, but
when I click the "Apply"- button, paraview crashes. I believe that I
get the .h5 files wrong, when I write them (as I don´t get the Xdmf-API
to work, I writing the .xmf-file "manually" with a program and the
.h5-files with the HDF5-API. 

Does anyone know how to set the parameters for writing the correct
.h5-file (Rank, and the shape of the array which is written to the
file)? 

This is as I have it now:



The coordinate file, which has (in this case) the dimensions 350 140 1. 

I write the coordinates in the following array:

float* Coordinates;

Coordinates = new float [3*xdims];

int j=0; //counter



//write xCoord to array

for(i=0;i<xdims;i=i+3) 

    {Coordinates[i] = xPoints[j];

     j++;

    }

//write yCoord to array

j=0;

for(i=1;i<xdims;i=i+3) 

    {Coordinates[i] = yPoints[j];

     j++;

    }

//write zCoord to array

for(i=2;i<xdims;i=i+3) 

    {Coordinates[i] = 0.0;

    }



This array obviously has rank 1, so I write the .h5 file with the following parameters:



file = H5Fcreate(H5FileName.c_str(), H5F_ACC_TRUNC , H5P_DEFAULT, H5P_DEFAULT);

dataspace = H5Screate_simple(1, dims, NULL);

datatype = H5Tcopy(H5T_NATIVE_FLOAT);

status = H5Tset_order(datatype,H5T_ORDER_LE);

dataset = H5Dcreate2(file,DATASETNAME1,datatype,dataspace,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);

status = H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, Coordinates);





The attribute data files I write analogue. 



My .xmf file looks like this:

<?xml version="1.0" ?>

<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>



<Xdmf>

<Domain>

<Grid Name="Curvilinear" GridType="Uniform">

<Topology TopologyType="3DSMesh" Dimensions ="350 140 1">

</Topology><Geometry GeometryType="XYZ">

<DataItem DataType="Float" Precision="4" Dimensions="350 140 1"  Format="HDF">

C:\Dokumente und Einstellungen\User1\Eigene Dateien\xdmf_files\c1d-T132-30SEPT-deep_coord_00000.h5/Curvilinear/XYZ

</DataItem>

</Geometry>

<Attribute Name="Density" Active="1" Type="Scalar" Center="Node">

<DataItem DataType="Float" Precision="4" Dimensions="350 140 1" Format="HDF">

C:\Dokumente und Einstellungen\User1\Eigene Dateien\xdmf_files\c1d-T132-30SEPT-deep.p_00000.h5:/Curvilinear/Density

</DataItem>

</Attribute>

</Grid>

</Domain>

</Xdmf>



Any help would be appreciated!

Thx,

NH
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.hdfgroup.org/pipermail/hdf-forum_hdfgroup.org/attachments/20081013/8c6123c5/attachment.html>


More information about the Hdf-forum mailing list