diff options
Diffstat (limited to 'doc/html')
91 files changed, 8418 insertions, 0 deletions
diff --git a/doc/html/Tutor/Contents.html b/doc/html/Tutor/Contents.html new file mode 100644 index 0000000..49c4a32 --- /dev/null +++ b/doc/html/Tutor/Contents.html @@ -0,0 +1,103 @@ +<html> + +<body bgcolor="#BBFFFF"> + +<!-- +The following tag is for use only in the distributed doc set. +Remove (or comment out) when served from HDF web server. +--> +<center> +<font size=-1><a href="../index.html" target=_top>Return to HDF5 Doc Set</a></font> +</center> + +<hr> + +<!-- +<A HREF="READ1ST.HTML" Target="RdFirstWin" onClick="window.open("READ1ST.HTML","RdFirstWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=500,height=250,titlebar=yes")"><IMG SRC="GRAPHICS/READ1ST.GIF" BORDER=0 ALT="Read this first!"></A> +--> + + +<a href="title.html" TARGET="CONTENT"><IMG SRC="Graphics/TitlePg.gif" BORDER=0 ALT="Tutorial Title Page"></a> +<br> + +<hr> +<a href="ContentsIntro.html" TARGET="BUTTONS"><IMG SRC="Graphics/IntroTopics.gif" BORDER=0 ALT="Introductory Topics"></a> +<br> +<!-- +<a href="intro.html" TARGET="CONTENT"><IMG SRC="Graphics/Intro.gif" BORDER=0 ALT="Introduction"></a> +<br> +<a href="fileorg.html" TARGET="CONTENT"><img src="Graphics/FileOrg.gif" BORDER=0 ALT="HDF5 File Organization"></a> +<br> +<a href="api.html" TARGET="CONTENT"><IMG SRC="Graphics/H5API.gif" BORDER=0 ALT="The HDF5 API"></a> +<br> +<a href="crtfile.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateFile.gif" BORDER=0 ALT="Creating an HDF5 File"></a> +<br> +<a href="crtdat.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset1.gif" BORDER=0 ALT="Creating a Dataset"></a> +<br> +<a href="rdwt.html" TARGET="CONTENT"><IMG SRC="Graphics/RdWrDataset.gif" BORDER=0 ALT="Reading from and Writing to a Dataset"></a> +<br> +<a href="crtatt.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateAttr.gif" BORDER=0 ALT="Creating an Attribute"></a> +<br> +<a href="crtgrp.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp1.gif" BORDER=0 ALT="Creating a Group"></a> +<br> +<a href="crtgrpar.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp2.gif" BORDER=0 ALT="Creating Groups Using Absolute and Relative Names"></a> +<br> +<a href="crtgrpd.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset2.gif" BORDER=0 ALT="Creating Datasets in a Group"></a> + + +<br> +<br> +<a href="questions.html" TARGET="CONTENT"><IMG SRC="Graphics/Quiz.gif" BORDER=0 ALT="Quiz Questions"></a> +<br> +<a href="answers.html" TARGET="CONTENT"><IMG SRC="Graphics/QuizAns.gif" BORDER=0 ALT="Quiz Answers"></a> +--> + +<hr> +<a href="ContentsAdv.html" TARGET="BUTTONS"><IMG SRC="Graphics/AdvTopics.gif" BORDER=0 ALT="Advanced Topics"></a> +<!-- +<br> +<a href="compound.html" TARGET="CONTENT"><IMG SRC="Graphics/CompDTypes.gif" BORDER=0 ALT="Compound Data Types"></a> +<br> +<a href="select.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectHyp.gif" BORDER=0 ALT="Selections Using H5Sselect_hyperslab"></a> +<br> +<a href="selectc.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectElemCp.gif" BORDER=0 ALT="Selections Using H5Sselect_elements and H5Scopy"></a> +<br> +<a href="reftoobj.html" TARGET="CONTENT"><IMG SRC="Graphics/RefObject.gif" BORDER=0 ALT="References to Objects"></a> +<br> +<a href="reftoreg.html" TARGET="CONTENT"><IMG SRC="Graphics/RefRegion.gif" BORDER=0 ALT="References to Dataset Regions"></a> +<br> +<a href="extend.html" TARGET="CONTENT"><IMG SRC="Graphics/ChunkExt.gif" BORDER=0 ALT="Chunking and Extendible Datasets"></a> +<br> +<a href="mount.html" TARGET="CONTENT"><IMG SRC="Graphics/MountFile.gif" BORDER=0 ALT="Mounting Files"></a> +<br> +<a href="iterate.html" TARGET="CONTENT"><IMG SRC="Graphics/Iterate.gif" BORDER=0 ALT="Group Iteration"></a> +--> + + +<hr> +<a href="ContentsAdd.html" TARGET="BUTTONS"><IMG SRC="Graphics/AddInfo.gif" BORDER=0 ALT="Additional Information"></a> +<!-- +<br> +<a href="util.html" TARGET="CONTENT"><IMG SRC="Graphics/Utilities.gif" BORDER=0 ALT="HDF5 Utilities -- h5ls and h5dump"></a> +<br> +<a href="glossary.html" TARGET="CONTENT"><IMG SRC="Graphics/Glossary.gif" BORDER=0 ALT="Glossary"></a> +<br> +<a href="references.html" TARGET="CONTENT"><IMG SRC="Graphics/References.gif" BORDER=0 ALT="References"></a> +<br> +<a href="examples/" TARGET="CONTENT"><IMG SRC="Graphics/Examples.gif" BORDER=0 ALT="Example Programs"></a> +--> + + +<hr> +<a href="ContentsFull.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCFull.gif" BORDER=0 ALT="Full TOC"></a> +<br> + + +<hr> +<br> +<a href="Copyright.html" TARGET="CONTENT"><IMG SRC="Graphics/Copy.gif" BORDER=0 ALT="Copyright, Etc."></a><br> + + +</body> +</html> + diff --git a/doc/html/Tutor/ContentsAdd.html b/doc/html/Tutor/ContentsAdd.html new file mode 100644 index 0000000..78a1386 --- /dev/null +++ b/doc/html/Tutor/ContentsAdd.html @@ -0,0 +1,106 @@ +<html> + +<body bgcolor="#BBFFFF"> + + +<!-- +The following tag is for use only in the distributed doc set. +Remove (or comment out) when served from HDF web server. +--> +<center> +<font size=-1><a href="../index.html" target=_top>Return to HDF5 Doc Set</a></font> +</center> + +<hr> + +<!-- +<A HREF="READ1ST.HTML" Target="RdFirstWin" onClick="window.open("READ1ST.HTML","RdFirstWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=500,height=250,titlebar=yes")"><IMG SRC="GRAPHICS/READ1ST.GIF" BORDER=0 ALT="Read this first!"></A> +--> + + +<a href="Contents.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCShort.gif" BORDER=0 ALT="(Short TOC)"></a> +<br> +<hr> + +<a href="title.html" TARGET="CONTENT"><IMG SRC="Graphics/TitlePg.gif" BORDER=0 ALT="Tutorial Title Page"></a> +<br> + +<hr> +<a href="ContentsIntro.html" TARGET="BUTTONS"><IMG SRC="Graphics/IntroTopics.gif" BORDER=0 ALT="Introductory Topics"></a> +<!-- +<a href="intro.html" TARGET="CONTENT"><IMG SRC="Graphics/Intro.gif" BORDER=0 ALT="Introduction"></a> +<br> +<br> +<a href="fileorg.html" TARGET="CONTENT"><img src="Graphics/FileOrg.gif" BORDER=0 ALT="HDF5 File Organization"></a> +<br> +<a href="api.html" TARGET="CONTENT"><IMG SRC="Graphics/H5API.gif" BORDER=0 ALT="The HDF5 API"></a> +<br> +<a href="crtfile.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateFile.gif" BORDER=0 ALT="Creating an HDF5 File"></a> +<br> +<a href="crtdat.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset1.gif" BORDER=0 ALT="Creating a Dataset"></a> +<br> +<a href="rdwt.html" TARGET="CONTENT"><IMG SRC="Graphics/RdWrDataset.gif" BORDER=0 ALT="Reading from and Writing to a Dataset"></a> +<br> +<a href="crtatt.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateAttr.gif" BORDER=0 ALT="Creating an Attribute"></a> +<br> +<a href="crtgrp.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp1.gif" BORDER=0 ALT="Creating a Group"></a> +<br> +<a href="crtgrpar.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp2.gif" BORDER=0 ALT="Creating Groups Using Absolute and Relative Names"></a> +<br> +<a href="crtgrpd.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset2.gif" BORDER=0 ALT="Creating Datasets in a Group"></a> + +<br> +<br> +<a href="questions.html" TARGET="CONTENT"><IMG SRC="Graphics/Quiz.gif" BORDER=0 ALT="Quiz Questions"></a> +<br> +<a href="answers.html" TARGET="CONTENT"><IMG SRC="Graphics/QuizAns.gif" BORDER=0 ALT="Quiz Answers"></a> +--> + + +<hr> +<a href="ContentsAdv.html" TARGET="BUTTONS"><IMG SRC="Graphics/AdvTopics.gif" BORDER=0 ALT="Advanced Topics"></a> +<!-- +<br> +<a href="compound.html" TARGET="CONTENT"><IMG SRC="Graphics/CompDTypes.gif" BORDER=0 ALT="Compound Data Types"></a> +<br> +<a href="select.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectHyp.gif" BORDER=0 ALT="Selections Using H5Sselect_hyperslab"></a> +<br> +<a href="selectc.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectElemCp.gif" BORDER=0 ALT="Selections Using H5Sselect_elements and H5Scopy"></a> +<br> +<a href="reftoobj.html" TARGET="CONTENT"><IMG SRC="Graphics/RefObject.gif" BORDER=0 ALT="References to Objects"></a> +<br> +<a href="reftoreg.html" TARGET="CONTENT"><IMG SRC="Graphics/RefRegion.gif" BORDER=0 ALT="References to Dataset Regions"></a> +<br> +<a href="extend.html" TARGET="CONTENT"><IMG SRC="Graphics/ChunkExt.gif" BORDER=0 ALT="Chunking and Extendible Datasets"></a> +<br> +<a href="mount.html" TARGET="CONTENT"><IMG SRC="Graphics/MountFile.gif" BORDER=0 ALT="Mounting Files"></a> +<br> +<a href="iterate.html" TARGET="CONTENT"><IMG SRC="Graphics/Iterate.gif" BORDER=0 ALT="Group Iteration"></a> +--> + + +<hr> +<IMG SRC="Graphics/AddInfo.gif" BORDER=0 ALT="Additional Information"> +<br> +<a href="util.html" TARGET="CONTENT"><IMG SRC="Graphics/Utilities.gif" BORDER=0 ALT="HDF5 Utilities -- h5ls and h5dump"></a> +<br> +<a href="glossary.html" TARGET="CONTENT"><IMG SRC="Graphics/Glossary.gif" BORDER=0 ALT="Glossary"></a> +<br> +<a href="references.html" TARGET="CONTENT"><IMG SRC="Graphics/References.gif" BORDER=0 ALT="References"></a> +<br> +<a href="examples/" TARGET="CONTENT"><IMG SRC="Graphics/Examples.gif" BORDER=0 ALT="Example Programs"></a> + + +<hr> +<a href="ContentsFull.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCFull.gif" BORDER=0 ALT="Full TOC"></a> +<br> + + +<hr> +<br> +<a href="Copyright.html" TARGET="CONTENT"><IMG SRC="Graphics/Copy.gif" BORDER=0 ALT="Copyright, Etc."></a><br> + + +</body> +</html> + diff --git a/doc/html/Tutor/ContentsAdv.html b/doc/html/Tutor/ContentsAdv.html new file mode 100644 index 0000000..b2ac014 --- /dev/null +++ b/doc/html/Tutor/ContentsAdv.html @@ -0,0 +1,105 @@ +<html> + +<body bgcolor="#BBFFFF"> + + +<!-- +The following tag is for use only in the distributed doc set. +Remove (or comment out) when served from HDF web server. +--> +<center> +<font size=-1><a href="../index.html" target=_top>Return to HDF5 Doc Set</a></font> +</center> + +<hr> + +<!-- +<A HREF="READ1ST.HTML" Target="RdFirstWin" onClick="window.open("READ1ST.HTML","RdFirstWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=500,height=250,titlebar=yes")"><IMG SRC="GRAPHICS/READ1ST.GIF" BORDER=0 ALT="Read this first!"></A> +--> + +<a href="Contents.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCShort.gif" BORDER=0 ALT="(Short TOC)"></a> +<br> +<hr> + +<a href="title.html" TARGET="CONTENT"><IMG SRC="Graphics/TitlePg.gif" BORDER=0 ALT="Tutorial Title Page"></a> +<br> + +<hr> +<a href="ContentsIntro.html" TARGET="BUTTONS"><IMG SRC="Graphics/IntroTopics.gif" BORDER=0 ALT="Introductory Topics"></a> +<!-- +<br> +<a href="intro.html" TARGET="CONTENT"><IMG SRC="Graphics/Intro.gif" BORDER=0 ALT="Introduction"></a> +<br> +<a href="fileorg.html" TARGET="CONTENT"><img src="Graphics/FileOrg.gif" BORDER=0 ALT="HDF5 File Organization"></a> +<br> +<a href="api.html" TARGET="CONTENT"><IMG SRC="Graphics/H5API.gif" BORDER=0 ALT="The HDF5 API"></a> +<br> +<a href="crtfile.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateFile.gif" BORDER=0 ALT="Creating an HDF5 File"></a> +<br> +<a href="crtdat.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset1.gif" BORDER=0 ALT="Creating a Dataset"></a> +<br> +<a href="rdwt.html" TARGET="CONTENT"><IMG SRC="Graphics/RdWrDataset.gif" BORDER=0 ALT="Reading from and Writing to a Dataset"></a> +<br> +<a href="crtatt.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateAttr.gif" BORDER=0 ALT="Creating an Attribute"></a> +<br> +<a href="crtgrp.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp1.gif" BORDER=0 ALT="Creating a Group"></a> +<br> +<a href="crtgrpar.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp2.gif" BORDER=0 ALT="Creating Groups Using Absolute and Relative Names"></a> +<br> +<a href="crtgrpd.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset2.gif" BORDER=0 ALT="Creating Datasets in a Group"></a> + + +<br> +<br> +<a href="questions.html" TARGET="CONTENT"><IMG SRC="Graphics/Quiz.gif" BORDER=0 ALT="Quiz Questions"></a> +<br> +<a href="answers.html" TARGET="CONTENT"><IMG SRC="Graphics/QuizAns.gif" BORDER=0 ALT="Quiz Answers"></a> +--> + +<hr> +<IMG SRC="Graphics/AdvTopics.gif" BORDER=0 ALT="Advanced Topics"> +<br> +<a href="compound.html" TARGET="CONTENT"><IMG SRC="Graphics/CompDTypes.gif" BORDER=0 ALT="Compound Data Types"></a> +<br> +<a href="select.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectHyp.gif" BORDER=0 ALT="Selections Using H5Sselect_hyperslab"></a> +<br> +<a href="selectc.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectElemCp.gif" BORDER=0 ALT="Selections Using H5Sselect_elements and H5Scopy"></a> +<br> +<a href="reftoobj.html" TARGET="CONTENT"><IMG SRC="Graphics/RefObject.gif" BORDER=0 ALT="References to Objects"></a> +<br> +<a href="reftoreg.html" TARGET="CONTENT"><IMG SRC="Graphics/RefRegion.gif" BORDER=0 ALT="References to Dataset Regions"></a> +<br> +<a href="extend.html" TARGET="CONTENT"><IMG SRC="Graphics/ChunkExt.gif" BORDER=0 ALT="Chunking and Extendible Datasets"></a> +<br> +<a href="mount.html" TARGET="CONTENT"><IMG SRC="Graphics/MountFile.gif" BORDER=0 ALT="Mounting Files"></a> +<br> +<a href="iterate.html" TARGET="CONTENT"><IMG SRC="Graphics/Iterate.gif" BORDER=0 ALT="Group Iteration"></a> + + +<hr> +<a href="ContentsAdd.html" TARGET="BUTTONS"><IMG SRC="Graphics/AddInfo.gif" BORDER=0 ALT="Additional Information"></a> +<!-- +<br> +<a href="util.html" TARGET="CONTENT"><IMG SRC="Graphics/Utilities.gif" BORDER=0 ALT="HDF5 Utilities -- h5ls and h5dump"></a> +<br> +<a href="glossary.html" TARGET="CONTENT"><IMG SRC="Graphics/Glossary.gif" BORDER=0 ALT="Glossary"></a> +<br> +<a href="references.html" TARGET="CONTENT"><IMG SRC="Graphics/References.gif" BORDER=0 ALT="References"></a> +<br> +<a href="examples/" TARGET="CONTENT"><IMG SRC="Graphics/Examples.gif" BORDER=0 ALT="Example Programs"></a> +--> + + +<hr> +<a href="ContentsFull.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCFull.gif" BORDER=0 ALT="Full TOC"></a> +<br> + + +<hr> +<br> +<a href="Copyright.html" TARGET="CONTENT"><IMG SRC="Graphics/Copy.gif" BORDER=0 ALT="Copyright, Etc."></a><br> + + +</body> +</html> + diff --git a/doc/html/Tutor/ContentsFull.html b/doc/html/Tutor/ContentsFull.html new file mode 100644 index 0000000..09cd5b9 --- /dev/null +++ b/doc/html/Tutor/ContentsFull.html @@ -0,0 +1,100 @@ +<html> + +<body bgcolor="#BBFFFF"> + + +<!-- +The following tag is for use only in the distributed doc set. +Remove (or comment out) when served from HDF web server. +--> +<center> +<font size=-1><a href="../index.html" target=_top>Return to HDF5 Doc Set</a></font> +</center> + +<hr> + +<!-- +<A HREF="READ1ST.HTML" Target="RdFirstWin" onClick="window.open("READ1ST.HTML","RdFirstWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=500,height=250,titlebar=yes")"><IMG SRC="GRAPHICS/READ1ST.GIF" BORDER=0 ALT="Read this first!"></A> +--> + + +<a href="Contents.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCShort.gif" BORDER=0 ALT="(Short TOC)"></a> +<br> +<hr> + +<a href="title.html" TARGET="CONTENT"><IMG SRC="Graphics/TitlePg.gif" BORDER=0 ALT="Tutorial Title Page"></a> +<br> + +<hr> +<IMG SRC="Graphics/IntroTopics.gif" BORDER=0 ALT="Introductory Topics"> +<br> +<a href="intro.html" TARGET="CONTENT"><IMG SRC="Graphics/Intro.gif" BORDER=0 ALT="Introduction"></a> +<br> +<a href="fileorg.html" TARGET="CONTENT"><img src="Graphics/FileOrg.gif" BORDER=0 ALT="HDF5 File Organization"></a> +<br> +<a href="api.html" TARGET="CONTENT"><IMG SRC="Graphics/H5API.gif" BORDER=0 ALT="The HDF5 API"></a> +<br> +<a href="crtfile.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateFile.gif" BORDER=0 ALT="Creating an HDF5 File"></a> +<br> +<a href="crtdat.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset1.gif" BORDER=0 ALT="Creating a Dataset"></a> +<br> +<a href="rdwt.html" TARGET="CONTENT"><IMG SRC="Graphics/RdWrDataset.gif" BORDER=0 ALT="Reading from and Writing to a Dataset"></a> +<br> +<a href="crtatt.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateAttr.gif" BORDER=0 ALT="Creating an Attribute"></a> +<br> +<a href="crtgrp.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp1.gif" BORDER=0 ALT="Creating a Group"></a> +<br> +<a href="crtgrpar.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp2.gif" BORDER=0 ALT="Creating Groups Using Absolute and Relative Names"></a> +<br> +<a href="crtgrpd.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset2.gif" BORDER=0 ALT="Creating Datasets in a Group"></a> + +<br> +<br> +<a href="questions.html" TARGET="CONTENT"><IMG SRC="Graphics/Quiz.gif" BORDER=0 ALT="Quiz Questions"></a> +<br> +<a href="answers.html" TARGET="CONTENT"><IMG SRC="Graphics/QuizAns.gif" BORDER=0 ALT="Quiz Answers"></a> + + +<hr> +<IMG SRC="Graphics/AdvTopics.gif" BORDER=0 ALT="Advanced Topics"> +<br> +<a href="compound.html" TARGET="CONTENT"><IMG SRC="Graphics/CompDTypes.gif" BORDER=0 ALT="Compound Data Types"></a> +<br> +<a href="select.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectHyp.gif" BORDER=0 ALT="Selections Using H5Sselect_hyperslab"></a> +<br> +<a href="selectc.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectElemCp.gif" BORDER=0 ALT="Selections Using H5Sselect_elements and H5Scopy"></a> +<br> +<a href="reftoobj.html" TARGET="CONTENT"><IMG SRC="Graphics/RefObject.gif" BORDER=0 ALT="References to Objects"></a> +<br> +<a href="reftoreg.html" TARGET="CONTENT"><IMG SRC="Graphics/RefRegion.gif" BORDER=0 ALT="References to Dataset Regions"></a> +<br> +<a href="extend.html" TARGET="CONTENT"><IMG SRC="Graphics/ChunkExt.gif" BORDER=0 ALT="Chunking and Extendible Datasets"></a> +<br> +<a href="mount.html" TARGET="CONTENT"><IMG SRC="Graphics/MountFile.gif" BORDER=0 ALT="Mounting Files"></a> +<br> +<a href="iterate.html" TARGET="CONTENT"><IMG SRC="Graphics/Iterate.gif" BORDER=0 ALT="Group Iteration"></a> + + +<hr> +<IMG SRC="Graphics/AddInfo.gif" BORDER=0 ALT="Additional Information"> +<br> +<a href="util.html" TARGET="CONTENT"><IMG SRC="Graphics/Utilities.gif" BORDER=0 ALT="HDF5 Utilities -- h5ls and h5dump"></a> +<br> +<a href="glossary.html" TARGET="CONTENT"><IMG SRC="Graphics/Glossary.gif" BORDER=0 ALT="Glossary"></a> +<br> +<a href="references.html" TARGET="CONTENT"><IMG SRC="Graphics/References.gif" BORDER=0 ALT="References"></a> +<br> +<a href="examples/" TARGET="CONTENT"><IMG SRC="Graphics/Examples.gif" BORDER=0 ALT="Example Programs"></a> + +<hr> +<a href="Contents.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCShort.gif" BORDER=0 ALT="(Short TOC)"></a> + + +<hr> +<br> +<a href="Copyright.html" TARGET="CONTENT"><IMG SRC="Graphics/Copy.gif" BORDER=0 ALT="Copyright, Etc."></a><br> + + +</body> +</html> + diff --git a/doc/html/Tutor/ContentsIntro.html b/doc/html/Tutor/ContentsIntro.html new file mode 100644 index 0000000..5b974d1 --- /dev/null +++ b/doc/html/Tutor/ContentsIntro.html @@ -0,0 +1,106 @@ +<html> + +<body bgcolor="#BBFFFF"> + + +<!-- +The following tag is for use only in the distributed doc set. +Remove (or comment out) when served from HDF web server. +--> +<center> +<font size=-1><a href="../index.html" target=_top>Return to HDF5 Doc Set</a></font> +</center> + +<hr> + +<!-- +<A HREF="READ1ST.HTML" Target="RdFirstWin" onClick="window.open("READ1ST.HTML","RdFirstWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=500,height=250,titlebar=yes")"><IMG SRC="GRAPHICS/READ1ST.GIF" BORDER=0 ALT="Read this first!"></A> +--> + + +<a href="Contents.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCShort.gif" BORDER=0 ALT="(Short TOC)"></a> +<br> +<hr> + +<a href="title.html" TARGET="CONTENT"><IMG SRC="Graphics/TitlePg.gif" BORDER=0 ALT="Tutorial Title Page"></a> +<br> + +<hr> +<IMG SRC="Graphics/IntroTopics.gif" BORDER=0 ALT="Introductory Topics"> +<br> +<a href="intro.html" TARGET="CONTENT"><IMG SRC="Graphics/Intro.gif" BORDER=0 ALT="Introduction"></a> +<br> +<a href="fileorg.html" TARGET="CONTENT"><img src="Graphics/FileOrg.gif" BORDER=0 ALT="HDF5 File Organization"></a> +<br> +<a href="api.html" TARGET="CONTENT"><IMG SRC="Graphics/H5API.gif" BORDER=0 ALT="The HDF5 API"></a> +<br> +<a href="crtfile.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateFile.gif" BORDER=0 ALT="Creating an HDF5 File"></a> +<br> +<a href="crtdat.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset1.gif" BORDER=0 ALT="Creating a Dataset"></a> +<br> +<a href="rdwt.html" TARGET="CONTENT"><IMG SRC="Graphics/RdWrDataset.gif" BORDER=0 ALT="Reading from and Writing to a Dataset"></a> +<br> +<a href="crtatt.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateAttr.gif" BORDER=0 ALT="Creating an Attribute"></a> +<br> +<a href="crtgrp.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp1.gif" BORDER=0 ALT="Creating a Group"></a> +<br> +<a href="crtgrpar.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateGrp2.gif" BORDER=0 ALT="Creating Groups Using Absolute and Relative Names"></a> +<br> +<a href="crtgrpd.html" TARGET="CONTENT"><IMG SRC="Graphics/CreateDset2.gif" BORDER=0 ALT="Creating Datasets in a Group"></a> + +<br> +<br> +<a href="questions.html" TARGET="CONTENT"><IMG SRC="Graphics/Quiz.gif" BORDER=0 ALT="Quiz Questions"></a> +<br> +<a href="answers.html" TARGET="CONTENT"><IMG SRC="Graphics/QuizAns.gif" BORDER=0 ALT="Quiz Answers"></a> + + +<hr> +<a href="ContentsAdv.html" TARGET="BUTTONS"><IMG SRC="Graphics/AdvTopics.gif" BORDER=0 ALT="Advanced Topics"></a> +<!-- +<br> +<a href="compound.html" TARGET="CONTENT"><IMG SRC="Graphics/CompDTypes.gif" BORDER=0 ALT="Compound Data Types"></a> +<br> +<a href="select.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectHyp.gif" BORDER=0 ALT="Selections Using H5Sselect_hyperslab"></a> +<br> +<a href="selectc.html" TARGET="CONTENT"><IMG SRC="Graphics/SelectElemCp.gif" BORDER=0 ALT="Selections Using H5Sselect_elements and H5Scopy"></a> +<br> +<a href="reftoobj.html" TARGET="CONTENT"><IMG SRC="Graphics/RefObject.gif" BORDER=0 ALT="References to Objects"></a> +<br> +<a href="reftoreg.html" TARGET="CONTENT"><IMG SRC="Graphics/RefRegion.gif" BORDER=0 ALT="References to Dataset Regions"></a> +<br> +<a href="extend.html" TARGET="CONTENT"><IMG SRC="Graphics/ChunkExt.gif" BORDER=0 ALT="Chunking and Extendible Datasets"></a> +<br> +<a href="mount.html" TARGET="CONTENT"><IMG SRC="Graphics/MountFile.gif" BORDER=0 ALT="Mounting Files"></a> +<br> +<a href="iterate.html" TARGET="CONTENT"><IMG SRC="Graphics/Iterate.gif" BORDER=0 ALT="Group Iteration"></a> +--> + + +<hr> +<a href="ContentsAdd.html" TARGET="BUTTONS"><IMG SRC="Graphics/AddInfo.gif" BORDER=0 ALT="Additional Information"></a> +<!-- +<br> +<a href="util.html" TARGET="CONTENT"><IMG SRC="Graphics/Utilities.gif" BORDER=0 ALT="HDF5 Utilities -- h5ls and h5dump"></a> +<br> +<a href="glossary.html" TARGET="CONTENT"><IMG SRC="Graphics/Glossary.gif" BORDER=0 ALT="Glossary"></a> +<br> +<a href="references.html" TARGET="CONTENT"><IMG SRC="Graphics/References.gif" BORDER=0 ALT="References"></a> +<br> +<a href="examples/" TARGET="CONTENT"><IMG SRC="Graphics/Examples.gif" BORDER=0 ALT="Example Programs"></a> +--> + + +<hr> +<a href="ContentsFull.html" TARGET="BUTTONS"><IMG SRC="Graphics/TOCFull.gif" BORDER=0 ALT="Full TOC"></a> +<br> + + +<hr> +<br> +<a href="Copyright.html" TARGET="CONTENT"><IMG SRC="Graphics/Copy.gif" BORDER=0 ALT="Copyright, Etc."></a><br> + + +</body> +</html> + diff --git a/doc/html/Tutor/Copyright.html b/doc/html/Tutor/Copyright.html new file mode 100644 index 0000000..b22c16c --- /dev/null +++ b/doc/html/Tutor/Copyright.html @@ -0,0 +1,80 @@ +<html> +<html> + <head> + <title> + HDF5 Copyright Notice + </title> + </head> + + <body bgcolor="#FFFFFF"> + + + +<hr> + +<h3>Copyright Notice and Statement for +<br> +NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities</h3> +<hr> +<p> + + +NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities +<br> +Copyright 1998, 1999 by the Board of Trustees of the University of Illinois +<br> +<strong>All rights reserved.</strong> +<p> + +Contributors: National Center for Supercomputing Applications (NCSA) at +the University of Illinois at Urbana-Champaign (UIUC), Lawrence Livermore +National Laboratory (LLNL), Sandia National Laboratories (SNL), Los Alamos +National Laboratory (LANL), Jean-loup Gailly and Mark Adler (gzip library). +<p> + +Redistribution and use in source and binary forms, with or without +modification, are permitted for any purpose (including commercial purposes) +provided that the following conditions are met: +<p> + +<ol> +<li>Redistributions of source code must retain the above copyright notice, +this list of conditions, and the following disclaimer. + +<li>Redistributions in binary form must reproduce the above copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or materials provided with the distribution. + +<li>In addition, redistributions of modified forms of the source or binary +code must carry prominent notices stating that the original code was +changed and the date of the change. + +<li>All publications or advertising materials mentioning features or use of +this software are asked, but not required, to acknowledge that it was +developed by the National Center for Supercomputing Applications at the +University of Illinois at Urbana-Champaign and to credit the contributors. + +<li>Neither the name of the University nor the names of the Contributors may +be used to endorse or promote products derived from this software without +specific prior written permission from the University or the Contributors. + +<li>THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND THE CONTRIBUTORS "AS IS" +WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no event +shall the University or the Contributors be liable for any damages suffered +by the users arising out of the use of this software, even if advised of +the possibility of such damage. + +</ol> + + +<hr> + +<address> +<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a> + +<br> +Last modified: 13 October 1999 + +</body> +</html> + diff --git a/doc/html/Tutor/Graphics/AddInfo.gif b/doc/html/Tutor/Graphics/AddInfo.gif Binary files differnew file mode 100644 index 0000000..335107f --- /dev/null +++ b/doc/html/Tutor/Graphics/AddInfo.gif diff --git a/doc/html/Tutor/Graphics/AdvTopics.gif b/doc/html/Tutor/Graphics/AdvTopics.gif Binary files differnew file mode 100644 index 0000000..9cea247 --- /dev/null +++ b/doc/html/Tutor/Graphics/AdvTopics.gif diff --git a/doc/html/Tutor/Graphics/BLANK.gif b/doc/html/Tutor/Graphics/BLANK.gif Binary files differnew file mode 100644 index 0000000..03134e7 --- /dev/null +++ b/doc/html/Tutor/Graphics/BLANK.gif diff --git a/doc/html/Tutor/Graphics/ChunkExt.gif b/doc/html/Tutor/Graphics/ChunkExt.gif Binary files differnew file mode 100644 index 0000000..52f9130 --- /dev/null +++ b/doc/html/Tutor/Graphics/ChunkExt.gif diff --git a/doc/html/Tutor/Graphics/CompDTypes.gif b/doc/html/Tutor/Graphics/CompDTypes.gif Binary files differnew file mode 100644 index 0000000..0549b32 --- /dev/null +++ b/doc/html/Tutor/Graphics/CompDTypes.gif diff --git a/doc/html/Tutor/Graphics/Copy.gif b/doc/html/Tutor/Graphics/Copy.gif Binary files differnew file mode 100644 index 0000000..7df2e6a --- /dev/null +++ b/doc/html/Tutor/Graphics/Copy.gif diff --git a/doc/html/Tutor/Graphics/CreateAttr.gif b/doc/html/Tutor/Graphics/CreateAttr.gif Binary files differnew file mode 100644 index 0000000..82c7f72 --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateAttr.gif diff --git a/doc/html/Tutor/Graphics/CreateDset1.gif b/doc/html/Tutor/Graphics/CreateDset1.gif Binary files differnew file mode 100644 index 0000000..2641d88 --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateDset1.gif diff --git a/doc/html/Tutor/Graphics/CreateDset2.gif b/doc/html/Tutor/Graphics/CreateDset2.gif Binary files differnew file mode 100644 index 0000000..294c0a5 --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateDset2.gif diff --git a/doc/html/Tutor/Graphics/CreateFile.gif b/doc/html/Tutor/Graphics/CreateFile.gif Binary files differnew file mode 100644 index 0000000..e07d0aa --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateFile.gif diff --git a/doc/html/Tutor/Graphics/CreateGrp1.gif b/doc/html/Tutor/Graphics/CreateGrp1.gif Binary files differnew file mode 100644 index 0000000..66be2fd --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateGrp1.gif diff --git a/doc/html/Tutor/Graphics/CreateGrp2.gif b/doc/html/Tutor/Graphics/CreateGrp2.gif Binary files differnew file mode 100644 index 0000000..93a5c87 --- /dev/null +++ b/doc/html/Tutor/Graphics/CreateGrp2.gif diff --git a/doc/html/Tutor/Graphics/Examples.gif b/doc/html/Tutor/Graphics/Examples.gif Binary files differnew file mode 100644 index 0000000..d6b3ac6 --- /dev/null +++ b/doc/html/Tutor/Graphics/Examples.gif diff --git a/doc/html/Tutor/Graphics/FileOrg.gif b/doc/html/Tutor/Graphics/FileOrg.gif Binary files differnew file mode 100644 index 0000000..a0f812d --- /dev/null +++ b/doc/html/Tutor/Graphics/FileOrg.gif diff --git a/doc/html/Tutor/Graphics/FullTOC1.gif b/doc/html/Tutor/Graphics/FullTOC1.gif Binary files differnew file mode 100644 index 0000000..9a7a810 --- /dev/null +++ b/doc/html/Tutor/Graphics/FullTOC1.gif diff --git a/doc/html/Tutor/Graphics/FullTOC2.gif b/doc/html/Tutor/Graphics/FullTOC2.gif Binary files differnew file mode 100644 index 0000000..651e0c7 --- /dev/null +++ b/doc/html/Tutor/Graphics/FullTOC2.gif diff --git a/doc/html/Tutor/Graphics/Glossary.gif b/doc/html/Tutor/Graphics/Glossary.gif Binary files differnew file mode 100644 index 0000000..157208a --- /dev/null +++ b/doc/html/Tutor/Graphics/Glossary.gif diff --git a/doc/html/Tutor/Graphics/H5API.gif b/doc/html/Tutor/Graphics/H5API.gif Binary files differnew file mode 100644 index 0000000..7d5c8a6 --- /dev/null +++ b/doc/html/Tutor/Graphics/H5API.gif diff --git a/doc/html/Tutor/Graphics/Intro.gif b/doc/html/Tutor/Graphics/Intro.gif Binary files differnew file mode 100644 index 0000000..a9d299b --- /dev/null +++ b/doc/html/Tutor/Graphics/Intro.gif diff --git a/doc/html/Tutor/Graphics/IntroTopics.gif b/doc/html/Tutor/Graphics/IntroTopics.gif Binary files differnew file mode 100644 index 0000000..384d7a7 --- /dev/null +++ b/doc/html/Tutor/Graphics/IntroTopics.gif diff --git a/doc/html/Tutor/Graphics/Iterate.gif b/doc/html/Tutor/Graphics/Iterate.gif Binary files differnew file mode 100644 index 0000000..0dc68d5 --- /dev/null +++ b/doc/html/Tutor/Graphics/Iterate.gif diff --git a/doc/html/Tutor/Graphics/MountFile.gif b/doc/html/Tutor/Graphics/MountFile.gif Binary files differnew file mode 100644 index 0000000..fb476df --- /dev/null +++ b/doc/html/Tutor/Graphics/MountFile.gif diff --git a/doc/html/Tutor/Graphics/Quiz.gif b/doc/html/Tutor/Graphics/Quiz.gif Binary files differnew file mode 100644 index 0000000..5bba11e --- /dev/null +++ b/doc/html/Tutor/Graphics/Quiz.gif diff --git a/doc/html/Tutor/Graphics/QuizAns.gif b/doc/html/Tutor/Graphics/QuizAns.gif Binary files differnew file mode 100644 index 0000000..6b73566 --- /dev/null +++ b/doc/html/Tutor/Graphics/QuizAns.gif diff --git a/doc/html/Tutor/Graphics/RdWrDataset.gif b/doc/html/Tutor/Graphics/RdWrDataset.gif Binary files differnew file mode 100644 index 0000000..962fed1 --- /dev/null +++ b/doc/html/Tutor/Graphics/RdWrDataset.gif diff --git a/doc/html/Tutor/Graphics/RefObject.gif b/doc/html/Tutor/Graphics/RefObject.gif Binary files differnew file mode 100755 index 0000000..ae9dc05 --- /dev/null +++ b/doc/html/Tutor/Graphics/RefObject.gif diff --git a/doc/html/Tutor/Graphics/RefRegion.gif b/doc/html/Tutor/Graphics/RefRegion.gif Binary files differnew file mode 100755 index 0000000..250039f --- /dev/null +++ b/doc/html/Tutor/Graphics/RefRegion.gif diff --git a/doc/html/Tutor/Graphics/References.gif b/doc/html/Tutor/Graphics/References.gif Binary files differnew file mode 100644 index 0000000..0d94116 --- /dev/null +++ b/doc/html/Tutor/Graphics/References.gif diff --git a/doc/html/Tutor/Graphics/SelectElemCp.gif b/doc/html/Tutor/Graphics/SelectElemCp.gif Binary files differnew file mode 100644 index 0000000..ed8e976 --- /dev/null +++ b/doc/html/Tutor/Graphics/SelectElemCp.gif diff --git a/doc/html/Tutor/Graphics/SelectHyp.gif b/doc/html/Tutor/Graphics/SelectHyp.gif Binary files differnew file mode 100644 index 0000000..29ac707 --- /dev/null +++ b/doc/html/Tutor/Graphics/SelectHyp.gif diff --git a/doc/html/Tutor/Graphics/TOC.gif b/doc/html/Tutor/Graphics/TOC.gif Binary files differnew file mode 100644 index 0000000..0bc3251 --- /dev/null +++ b/doc/html/Tutor/Graphics/TOC.gif diff --git a/doc/html/Tutor/Graphics/TOCFull.gif b/doc/html/Tutor/Graphics/TOCFull.gif Binary files differnew file mode 100644 index 0000000..bb1e982 --- /dev/null +++ b/doc/html/Tutor/Graphics/TOCFull.gif diff --git a/doc/html/Tutor/Graphics/TOCShort.gif b/doc/html/Tutor/Graphics/TOCShort.gif Binary files differnew file mode 100644 index 0000000..a17aaee --- /dev/null +++ b/doc/html/Tutor/Graphics/TOCShort.gif diff --git a/doc/html/Tutor/Graphics/TitlePg.gif b/doc/html/Tutor/Graphics/TitlePg.gif Binary files differnew file mode 100644 index 0000000..5f9a633 --- /dev/null +++ b/doc/html/Tutor/Graphics/TitlePg.gif diff --git a/doc/html/Tutor/Graphics/Utilities.gif b/doc/html/Tutor/Graphics/Utilities.gif Binary files differnew file mode 100644 index 0000000..62e1d78 --- /dev/null +++ b/doc/html/Tutor/Graphics/Utilities.gif diff --git a/doc/html/Tutor/answers.html b/doc/html/Tutor/answers.html new file mode 100644 index 0000000..6bc239b --- /dev/null +++ b/doc/html/Tutor/answers.html @@ -0,0 +1,216 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Introductory Topics Questions with Answers +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Introductory Topics Questions with +Answers</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> +<PRE> + + +Section 2: HDF File Organization +================================ + +1. Name and describe the two primary objects that can be stored in an HDF5 + file: + +Answer: +Group: A grouping structure containing zero or more HDF5 objects, together + with supporting metadata. + +Dataset: A multidimensional array of data elements, together with + supporting metadata. + +2. What is an attribute? + +Answer: An HDF attribute is a user-defined HDF5 structure that provides extra + information about an HDF5 object. + +3. Give the path name for an object called "harry" that is a member of a + group called "dick," which in turn is a member of the root group. + +Answer: /dick/harry + +Section 3: The HDF5 API +======================= + +Describe the purpose of each of the following HDF5 APIs: + +H5A, H5D, H5E, F5F, H5G, H5T, H5Z + +H5A: Attribute access and manipulation routines. +H5D: Dataset access and manipulation routines. +H5E: Error handling routines. +F5F: File access routines. +H5G: Routines for creating and operating on groups. +H5T: Routines for creating and manipulating the datatypes of dataset elements. +H5Z: Data compression routines. + + +Section 4: Creating an HDF File +=============================== + +1. What two HDF5 routines must be called in order to create an HDF5 file? + +Answer: H5Fcreate and H5Fclose. + +2. What include file must be included in any file that uses the HDF5 library. + +Answer: hdf5.h must be included because it contains definitions and + declarations used by the library. + +3. An HDF5 file is never completely empty because as soon as an HDF5 file + is created, it automatically contains a certain primary object. What is + that object? + +Answer: The root group. + + +Section 5: Creating a Dataset +============================= + +1. Name and describe two major datatype categories. + +Answer: atomic datatype - An atomic datatype cannot be decomposed into + smaller units at the API level. + compound datatype - A compound datatype is a collection of atomic/ + compound datatypes, or small arrays of such types. + +2. List the HDF5 atomic datatypes. Give an example of a predefined datatype. + +Answer: There are six HDF5 atomic datatypes: integer, floating point, + date and time, character string, bit field, opaque. + H5T_IEEE_F32LE - 4-byte little-endian, IEEE floating point, + H5T_NATIVE_INT - native integer + +3. What does the dataspace describe? What are the major characteristics of the + simple dataspace? + +Answer: The dataspace describes the dimensionality of the dataset. It is + characterized by its rank and dimension sizes. + +4. What information needs to be passed to the H5Dcreate function, i.e. + what information is needed to describe a dataset at creation time? + +Answer: dataset location, name, dataspace, datatype, and creation properties. + + +Section 6: Reading from/Writing to a Dataset +============================================ + +1. What are six pieces of information which need to be specified for + reading and writing a dataset? + +Answer: A dataset, a dataset's datatype and dataspace in memory, the + dataspace in the file, the transfer properties and data buffer. + +2. Why are both the memory dataspace and file dataspace needed for + read/write operations, but only the memory datatype is specified for the + datatype? + +Answer: A dataset's file datatype is specified at creation time and cannot be + changed. Both file and memory dataspaces are needed for performing + subsetting and partial I/O operations. + +3. What does the line DATASPACE { SIMPLE (4 , 6 ) / ( 4 , 6 ) } in Fig 6.1 + means? + +Answer: It means that the dataset "dset" has a simple dataspace with the + current dimensions (4,6) and the maximum size of the dimensions (4,6). + + +Section 7: Creating an Attribute +================================ + +1. What is an attribute? + +Answer: An attribute is a dataset attached to an object. It describes the + nature and/or the intended usage of the object. + +2. Can partial I/O operations be performed on attributes? + +Answer: No + + +Section 8: Creating a Group +=========================== + +What are the two primary objects that can be included in +a group? + +Answer: A group and a dataset + + +Section 9: Creating Groups using Absolute/Relative Names +======================================================== + +1. Group names can be specified in two "ways". What are these + two types of group names that you can specify? + +Answer: relative and absolute + +2. You have a dataset named "moo" in the group "boo", which is + in the group "foo", which in turn, is in the root group. How would + you specify an absolute name to access this dataset? + +Answer: /foo/boo/moo + +Section 10: Creating Datasets in Groups +======================================= + +Describe a way to access the dataset "moo" described in the previous section +(Section 9, question 2), using a relative and absolute pathname. + +Answers: 1. Access the group, "/foo", and get the group ID. + Access the group "boo" using the group ID obtained in Step 1. + Access the dataset "moo" using the group ID in Step 2. + gid = H5Gopen (file_id, "/foo", 0); /* absolute path */ + gid1 = H5Gopen (gid, "boo", 0); /* relative path */ + did = H5Dopen (gid1, "moo"); /* relative path */ + + 2. Access the group, "/foo", and get the group ID. + Access the dataset "boo/moo", with the group ID just obtained. + gid = H5Gopen (file_id, "/foo", 0); /* absolute path */ + did = H5Dopen (gid, "boo/moo"); /* relative path */ + + 3. Access the dataset with an absolute path. + did = H5Dopen (file_id, "/foo/boo/moo"); /* absolute path */ +</PRE> +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 2, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/api.html b/doc/html/Tutor/api.html new file mode 100644 index 0000000..3ed0a84 --- /dev/null +++ b/doc/html/Tutor/api.html @@ -0,0 +1,140 @@ +<HTML><HEAD> +<TITLE>The HDF5 API +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">The HDF5 API</FONT> +</BIG></BIG></BIG></H1> + + +<hr noshade size=1> + +<BODY> +<P> +The HDF5 library provides several interfaces, and is currently implemented in +C. The APIs provide routines for accessing HDF5 files and creating and +manipulating HDF5 objects. All C routines in the HDF5 library begin with +a prefix of the form H5*, where * is a single letter indicating the object on +which the operation is to be performed. The APIs are listed below: +<P> +<table width="65%" border="2" cellpadding="4"> + <tr bgcolor="#FFCC99" bordercolor="#FFFFFF"> + <td width="11%"> + <div align="center"><b>API </b></div> + </td> + <td width="89%"> + <div align="left"><b>DESCRIPTION</b> </div> + </td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5</b></div> + </td> + <td width="89%">Library Functions: the general-purpose H5 functions.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5A</b></div> + </td> + <td width="89%">Annotation Interface: attribute access and manipulating routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5D</b></div> + </td> + <td width="89%">Dataset Interface: dataset access and manipulating routines. + </td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5E</b></div> + </td> + <td width="89%">Error Interface: error handling routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5F</b></div> + </td> + <td width="89%">File Interface: file access routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5G</b></div> + </td> + <td width="89%">Group Interface: group creating and operating routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5I</b></div> + </td> + <td width="89%">Identifier Interface: identifier routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5P</b></div> + </td> + <td width="89%">Property List Interface: object property list manipulating + routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5R</b></div> + </td> + <td width="89%">Reference Interface: reference routines.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5S</b></div> + </td> + <td width="89%">Dataspace Interface: routines for defining dataspaces.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5T</b></div> + </td> + <td width="89%">Data type Interface: routines for creating and manipulating + the data type of dataset elements.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td width="11%" bgcolor="#99CCCC"> + <div align="center"><b>H5Z</b></div> + </td> + <td width="89%">Compression Interface: compression routine(s).</td> + </tr> +</table> + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: July 30, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/bighdf2sp.JPG b/doc/html/Tutor/bighdf2sp.JPG Binary files differnew file mode 100644 index 0000000..aad590e --- /dev/null +++ b/doc/html/Tutor/bighdf2sp.JPG diff --git a/doc/html/Tutor/compound.html b/doc/html/Tutor/compound.html new file mode 100644 index 0000000..7983bf4 --- /dev/null +++ b/doc/html/Tutor/compound.html @@ -0,0 +1,378 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Compound Data Types +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Compound Data Types</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#def">Creating Compound Data Types</A> + <LI>Programming Example +<UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> +</UL> +</UL> +<HR> +<A NAME="def"> +<H2>Creating Compound Data Types</H2> +A compound data type is similar to a struct in C or a common block in +Fortran. It is a collection of one or more atomic types or small arrays of +such types. To create and use a compound data type you need to refer to +various properties of the data compound data type: +<UL> + <LI>It is of class compound. + <LI>It has a fixed total size, in bytes. + <LI>It consists of zero or more members (defined in any order) with + unique names and which occupy non-overlapping regions within the datum. + <LI>Each member has its own data type. + <LI>Each member is referenced by an index number between zero and N-1, + where N is the number of members in the compound data type. + <LI>Each member has a name which is unique among its siblings in a + compound data type. + <LI>Each member has a fixed byte offset, which is the first byte + (smallest byte address) of that member in a compound data type. + <LI>Each member can be a small array of up to four dimensions. +</UL> +Properties of members of a compound data type are defined when the +member is added to the compound type and cannot be subsequently modified. +<P> +Compound data types must be built out of other data types. First, one +creates an empty compound data type and specifies its total size. Then +members are added to the compound data type in any order. + +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> + +This example shows how to create a compound data type, write an array +to the file which uses the compound data type, and read back subsets of +the members.<BR> + +[<A HREF="examples/h5_compound.c">Download h5_compound.c</A>] +<PRE> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +#include "hdf5.h" + +#define FILE "SDScompound.h5" +#define DATASETNAME "ArrayOfStructures" +#define LENGTH 10 +#define RANK 1 + +int +main(void) +{ + + /* First structure and dataset*/ + typedef struct s1_t { + int a; + float b; + double c; + } s1_t; + s1_t s1[LENGTH]; + hid_t s1_tid; /* File datatype identifier */ + + /* Second structure (subset of s1_t) and dataset*/ + typedef struct s2_t { + double c; + int a; + } s2_t; + s2_t s2[LENGTH]; + hid_t s2_tid; /* Memory datatype handle */ + + /* Third "structure" ( will be used to read float field of s1) */ + hid_t s3_tid; /* Memory datatype handle */ + float s3[LENGTH]; + + int i; + hid_t file, dataset, space; /* Handles */ + herr_t status; + hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */ + + + /* + * Initialize the data + */ + for (i = 0; i < LENGTH; i++) { + s1[i].a = i; + s1[i].b = i*i; + s1[i].c = 1./(i+1); + } + + /* + * Create the data space. + */ + space = H5Screate_simple(RANK, dim, NULL); + + /* + * Create the file. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create the memory data type. + */ + s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); + H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + + /* + * Create the dataset. + */ + dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT); + + /* + * Wtite data to the dataset; + */ + status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); + + /* + * Release resources + */ + H5Tclose(s1_tid); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(file); + + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + + dataset = H5Dopen(file, DATASETNAME); + + /* + * Create a data type for s2 + */ + s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); + + H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT); + + /* + * Read two fields c and a from s1 dataset. Fields in the file + * are found by their names "c_name" and "a_name". + */ + status = H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2); + + /* + * Display the fields + */ + printf("\n"); + printf("Field c : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c); + printf("\n"); + + printf("\n"); + printf("Field a : \n"); + for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a); + printf("\n"); + + /* + * Create a data type for s3. + */ + s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float)); + + status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT); + + /* + * Read field b from s1 dataset. Field in the file is found by its name. + */ + status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3); + + /* + * Display the field + */ + printf("\n"); + printf("Field b : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]); + printf("\n"); + + /* + * Release resources + */ + H5Tclose(s2_tid); + H5Tclose(s3_tid); + H5Dclose(dataset); + H5Fclose(file); + + return 0; +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +The program outputs the following: +<PRE> + +Field c : +1.0000 0.5000 0.3333 0.2500 0.2000 0.1667 0.1429 0.1250 0.1111 0.1000 + +Field a : +0 1 2 3 4 5 6 7 8 9 + +Field b : +0.0000 1.0000 4.0000 9.0000 16.0000 25.0000 36.0000 49.0000 64.0000 81.0000 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI>H5Tcreate creates a new data type of the specified class with +the specified number of bytes. +<PRE> + hid_t H5Tcreate ( H5T_class_t class, size_t size ) +</PRE> +<UL> +<LI>The <I>class</I> parameter specifies the data type to create. +Currently only the H5T_COMPOUND data type class is supported with this +function. +<LI>The <I>size</I> parameter specifies the number of bytes in the +data type to create. +</UL> +<P> +<LI>H5Tinsert adds a member to the compound data type specified by +<I>type_id</I>. +<PRE> + herr_t H5Tinsert ( hid_t type_id, const char * name, off_t offset, hid_t field_id ) +</PRE> +<UL> +<LI>The <I>type_id</I> parameter is the identifier of the compound data type +to modify. +<LI>The <I>name</I> parameter is the name of the field to insert. The new +member name must be unique within a compound data type. +<LI>The <I>offset</I> parameter is the offset in the memory structure of +the field to insert. + +The library defines the HOFFSET macro to compute the offset of a member within +a struct: +<PRE> + HOFFSET ( s, m ) +</PRE> +This macro computes the offset of member <I>m</I> within a struct +variable <I>s</I>. + +<LI>The <I>field_id</I> parameter is the data type identifier of the +field to insert. +</UL> +<P> +<LI>H5Tclose releases a data type. +<PRE> + herr_t H5Tclose ( hid_t type_id ) +</PRE> +The <I>type_id</I> parameter is the identifier of the data type to release. +</UL> +<A NAME="fc"> +<H3><U>File Contents</U></H3> + +<PRE> +HDF5 "SDScompound.h5" { +GROUP "/" { + DATASET "ArrayOfStructures" { + DATATYPE { + H5T_STD_I32BE "a_name"; + H5T_IEEE_F32BE "b_name"; + H5T_IEEE_F64BE "c_name"; + } + DATASPACE { SIMPLE ( 10 ) / ( 10 ) } + DATA { + { + [ 0 ], + [ 0 ], + [ 1 ] + }, + { + [ 1 ], + [ 1 ], + [ 0.5 ] + }, + { + [ 2 ], + [ 4 ], + [ 0.333333 ] + }, + { + [ 3 ], + [ 9 ], + [ 0.25 ] + }, + { + [ 4 ], + [ 16 ], + [ 0.2 ] + }, + { + [ 5 ], + [ 25 ], + [ 0.166667 ] + }, + { + [ 6 ], + [ 36 ], + [ 0.142857 ] + }, + { + [ 7 ], + [ 49 ], + [ 0.125 ] + }, + { + [ 8 ], + [ 64 ], + [ 0.111111 ] + }, + { + [ 9 ], + [ 81 ], + [ 0.1 ] + } + } + } +} +} +</PRE> + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/crtatt.html b/doc/html/Tutor/crtatt.html new file mode 100644 index 0000000..82de873 --- /dev/null +++ b/doc/html/Tutor/crtatt.html @@ -0,0 +1,267 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating an Attribute +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating an Attribute</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">What is an Attribute</A>? + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + <LI> <A HREF="#ddl">Attribute Definition in DDL</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>What is an Attribute?</h2> +<P> +Attributes are small datasets that can be used to describe the nature and/or +the intended usage of the object they are attached to. In this section, we +show how to create and read/write an attribute. +<P> +<P> +<H3>Creating an attribute</H3> +<P> + Creating an attribute is similar to the creation of a dataset. To create an + attribute the application must specify the object which the attribute is + attached to, the data type and space of the attribute data and the creation + properties. +<P> + The steps to create an attribute are as follows: +<OL> + <LI> Obtain the object identifier that the attribute is to be attached to. + <LI> Define the characteristics of the attribute and specify creation + properties. + <UL> + <LI> Define the data type. + <LI> Define the dataspace. + <LI> Specify the creation properties. + </UL> + <LI> Create the attribute. + <LI> Close the attribute and data type, dataspace, and creation property + list if necessary. +</OL> +<P> + To create an attribute, the calling program must contain the following calls: +<PRE> + attr_id = H5Acreate(loc_id, attr_name, type_id, space_id, create_plist); + H5Aclose(attr_id); +</PRE> + +<H3>Reading/Writing an attribute</H3> +<P> + Attributes may only be read/written as an entire object. No partial I/O is + currently supported. Therefore, to perform I/O operations on an attribute, the + application needs only to specify the attribute and the attribute's memory + data type. +<P> + The steps to read/write an attribute are as follows. +<OL> + <LI> Obtain the attribute identifier. + <LI> Specify the attribute's memory data type. + <LI> Perform the desired operation. + <LI> Close the memory data type if necessary. +</OL> +<P> +To read/write an attribute, the calling program must contain the following + calls: +<PRE> + status = H5Aread(attr_id, mem_type_id, buf); +</PRE> + or +<PRE> + status = H5Awrite(attr_id, mem_type_id, buf); +</PRE> +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +This example shows how to create and write a dataset attribute. +It opens an existing file 'dset.h5', obtains the id of the dataset "/dset1", +defines the attribute's dataspace, creates the dataset attribute, writes +the attribute, and then closes the attribute's dataspace, attribute, dataset, +and file. <BR> +[ <A HREF="examples/h5_crtatt.c">Download h5_crtatt.c</A> ] +<PRE> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers +*/ + hsize_t dims; + int attr_data[2]; + herr_t status; + + /* Initialize the attribute data. */ + attr_data[0] = 100; + attr_data[1] = 200; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open an existing dataset. */ + dataset_id = H5Dopen(file_id, "/dset"); + + /* Create the data space for the attribute. */ + dims = 2; + dataspace_id = H5Screate_simple(1, &dims, NULL); + + /* Create a dataset attribute. */ + attribute_id = H5Acreate(dataset_id, "attr", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); + + /* Write the attribute data. */ + status = H5Awrite(attribute_id, H5T_NATIVE_INT, attr_data); + + /* Close the attribute. */ + status = H5Aclose(attribute_id); + + /* Close the dataspace. */ + status = H5Sclose(dataspace_id); + + /* Close to the dataset. */ + status = H5Dclose(dataset_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> H5Acreate creates an attribute which is attached to the object specified by + the first parameter, and returns an identifier. +<PRE> + hid_t H5Acreate (hid_t loc_id, const char *name, hid_t type_id, + hid_t space_id, hid_t create_plist) +</PRE> +<UL> + <LI> The first parameter is the identifier of the object which the attribute is + attached to. + + <LI> The second parameter is the name of the attribute to create. + + <LI> The third parameter is the identifier of the attribute's datatype. + + <LI> The fourth parameter is the identifier of the attribute's dataspace. + + <LI> The last parameter is the identifier of the creation property list. + H5P_DEFAULT specifies the default creation property list. +</UL> +<P> +<LI> H5Awrite writes the entire attribute, and returns the status of the write. +<PRE> + herr_t H5Awrite (hid_t attr_id, hid_t mem_type_id, void *buf) +</PRE> +<UL> + <LI> The first parameter is the identifier of the attribute to write. + + <LI> The second parameter is the identifier of the attribute's memory datatype. + + <LI> The last parameter is the data buffer. +</UL> +<P> +<LI> When an attribute is no longer accessed by a program, H5Aclose must be called + to release the attribute from use. This call is mandatory. +<PRE> + herr_t H5Aclose (hid_t attr_id) +</PRE> +</UL> + + + +<A NAME="fc"> +<H3><U>File Contents</U></H3> +<P> +The contents of 'dset.h5' and the attribute definition are given in the +following: +<P> +<B>Fig. 7.1</B> <I>'dset.h5' in DDL</I> + +<PRE> + + HDF5 "dset.h5" { + GROUP "/" { + DATASET "dset" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } + DATA { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24 + } + ATTRIBUTE "attr" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 2 ) / ( 2 ) } + DATA { + 100, 200 + } + } + } + } + } +</PRE> + + +<A NAME="ddl"> +<h3><U>Attribute Definition in DDL</U></H3> +<B>Fig. 7.2</B> <I>HDF5 Attribute Definition</I> +<PRE> + + <attribute> ::= ATTRIBUTE "<attr_name>" { <datatype> + <dataspace> + <data> } + +</PRE> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/crtdat.html b/doc/html/Tutor/crtdat.html new file mode 100644 index 0000000..cb07ccd --- /dev/null +++ b/doc/html/Tutor/crtdat.html @@ -0,0 +1,340 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating a Dataset +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating a Dataset</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">What is a Dataset</A>? + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + <LI> <A HREF="#ddl">Dataset Definition in DDL</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>What is a Dataset?</h2> +<P> +A dataset is a multidimensional array of data elements, together with +supporting metadata. To create a dataset, the application program must specify +the location to create the dataset, the dataset name, the data type and space +of the data array, and the dataset creation properties. +<P> + <H3> Data Types</H3> + A data type is a collection of data type properties, all of which can + be stored on disk, and which when taken as a whole, provide complete + information for data conversion to or from that data type. +<P> + There are two categories of data types in HDF5: atomic and compound data + types. An atomic type is a type which cannot be decomposed into smaller + units at the API level. A compound data type is a collection of one or more + atomic types or small arrays of such types. +<P> + Atomic types include integer, float, date and time, string, bit field, and + opaque. Figure 5.1 shows the HDF5 data types. Some of the HDF5 predefined + atomic data types are listed in Figure 5.2. In this tutorial, we consider + only + HDF5 predefined integers. For information on data types, see the HDF5 + User's Guide. +<P> + <B>Fig 5.1</B> <I>HDF5 data types</I> +<PRE> + + +-- integer + +-- floating point + +---- atomic ----+-- date and time + | +-- character string + HDF5 datatypes --| +-- bit field + | +-- opaque + | + +---- compound + +</PRE> + <B>Fig. 5.2</B> <I>Examples of HDF5 predefined data types</I> +<table width="52%" border="1" cellpadding="4"> + <tr bgcolor="#ffcc99" bordercolor="#FFFFFF"> + <td width="20%"><b>Data Type</b></td> + <td width="80%"><b>Description</b></td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" width="20%">H5T_STD_I32LE</td> + <td width="80%">Four-byte, little-endian, signed two's complement integer</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" width="20%">H5T_STD_U16BE</td> + <td width="80%">Two-byte, big-endian, unsigned integer</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" width="20%">H5T_IEEE_F32BE</td> + <td width="80%">Four-byte, big-endian, IEEE floating point</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" width="20%">H5T_IEEE_F64LE</td> + <td width="80%">Eight-byte, little-endian, IEEE floating point</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" width="20%">H5T_C_S1</td> + <td width="80%">One-byte, null-terminated string of eight-bit characters</td> + </tr> +</table> + + <H3>Dataspaces</H3> + + A dataspace describes the dimensionality of the data array. A dataspace + is either a regular N-dimensional array of data points, called a simple + dataspace, or a more general collection of data points organized in + another manner, called a complex dataspace. Figure 5.3 shows HDF5 dataspaces. + In this tutorial, we only consider simple dataspaces. +<P> + <B>Fig 5.3</B> <I>HDF5 dataspaces</I> +<PRE> + + +-- simple + HDF5 dataspaces --| + +-- complex + +</PRE> + The dimensions of a dataset can be fixed (unchanging), or they may be + unlimited, which means that they are extendible. A dataspace can also + describe portions of a dataset, making it possible to do partial I/O + operations on selections. + + <h3>Dataset creation properties</H3> + + When creating a dataset, HDF5 allows users to specify how raw data is + organized on disk and how the raw data is compressed. This information is + stored in a dataset creation property list and passed to the dataset + interface. The raw data on disk can be stored contiguously (in the same + linear way that it is organized in memory), partitioned into chunks and + stored externally, etc. In this tutorial, we use the default creation + property list; that is, no compression and + contiguous storage layout is used. For more information about the creation + properties, see the HDF5 User's Guide. + +<P> +In HDF5, data types and spaces are independent objects, which are created +separately from any dataset that they might be attached to. Because of this the +creation of a dataset requires definitions of data type and dataspace. +In this tutorial, we use HDF5 predefined data types (integer) and consider +only simple dataspaces. Hence, only the creation of dataspace objects is +needed. +<P> + +To create an empty dataset (no data written) the following steps need to be +taken: +<OL> +<LI> Obtain the location id where the dataset is to be created. +<LI> Define the dataset characteristics and creation properties. + <UL> + <LI> define a data type + <LI> define a dataspace + <LI> specify dataset creation properties +</UL> +<LI> Create the dataset. +<LI> Close the data type, dataspace, and the property list if necessary. +<LI> Close the dataset. +</OL> +To create a simple dataspace, the calling program must contain the following +calls: +<PRE> + dataspace_id = H5Screate_simple(rank, dims, maxdims); + H5Sclose(dataspace_id ); +</PRE> + +To create a dataset, the calling program must contain the following calls: +<PRE> + dataset_id = H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, + hid_t space_id, hid_t create_plist_id); + H5Dclose (dataset_id); +</PRE> + + +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +The following example shows how to create an empty dataset. +It creates a file called 'dset.h5', defines the dataset dataspace, creates a +dataset which is a 4x6 integer array, and then closes the dataspace, +the dataset, and the file. <BR> +[ <A HREF="examples/h5_crtdat.c">Download h5_crtdat.c</A> ] +<PRE> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create the data + space for the dataset. */ + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the dataset. */ + dataset_id = H5Dcreate(file_id, "/dset", H5T_STD_I32BE, dataspace_id, + H5P_DEFAULT); + + /* End access to the dataset and release resources used by it. */ + status = H5Dclose(dataset_id); + + /* Terminate access to the data space. */ + status = H5Sclose(dataspace_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> H5Screate_simple creates a new simple data space and returns a data space + identifier. +<PRE> + hid_t H5Screate_simple (int rank, const hsize_t * dims, + const hsize_t * maxdims) +</PRE> +<UL> + <LI> The first parameter specifies the rank of the dataset. + + <LI> The second parameter specifies the size of the dataset. + + <LI> The third parameter is for the upper limit on the size of the dataset. + If it is NULL, the upper limit is the same as the dimension + sizes specified by the second parameter. +</UL> +<P> +<LI> H5Dcreate creates a dataset at the specified location and returns a + dataset identifier. +<PRE> + hid_t H5Dcreate (hid_t loc_id, const char *name, hid_t type_id, + hid_t space_id, hid_t create_plist_id) +</PRE> +<UL> + <LI> The first parameter is the location identifier. + + <LI> The second parameter is the name of the dataset to create. + + <LI> The third parameter is the data type identifier. H5T_STD_I32BE, a + 32-bit Big Endian integer, is an HDF atomic data type. + + <LI> The fourth parameter is the data space identifier. + + <LI> The last parameter specifies the dataset creation property list. + H5P_DEFAULT specifies the default dataset creation property list. +</UL> +<P> +<LI>H5Dcreate creates an empty array and initializes the data to 0. +<P> +<LI> When a dataset is no longer accessed by a program, H5Dclose must be +called to release the resource used by the dataset. This call is mandatory. +<PRE> + hid_t H5Dclose (hid_t dataset_id) +</PRE> +</UL> + +<A NAME="fc"> +<H3><U>File Contents</U></H3> +The file contents of 'dset.h5' are shown is <B>Figure 5.4</B> and <B>Figure 5.5</B>. +<table width="73%" border="1" cellspacing="4" bordercolor="#FFFFFF"> + <tr bordercolor="#FFFFFF"> + <td width="37%"><b>Figure 5.4</b> <i>The Contents of 'dset.h5'</i> + </td> + <td width="63%"><b>Figure 5.5</b> <i>'dset.h5' in DDL</i> </td> + </tr> + <tr bordercolor="#000000"> +<!-- <td width="37%"><IMG src="dseth5.jpg" width="206" height="333"></td> --> + <td width="37%"><IMG src="img002.gif"></td> + <td width="63%"> + <pre> HDF5 "dset.h5" { + GROUP "/" { + DATASET "dset" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } + DATA { + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 + } + } + } + } +</pre> + </td> + </tr> +</table> + + + +<A NAME="ddl"> +<h3><U>Dataset Definition in DDL</U></H3> +The following is the simplified DDL dataset definition: +<P> + <B>Fig. 5.6</B> <I>HDF5 Dataset Definition</I> +<PRE> + <dataset> ::= DATASET "<dataset_name>" { <data type> + <dataspace> + <data> + <dataset_attribute>* } + + <data type> ::= DATATYPE { <atomic_type> } + + <dataspace> ::= DATASPACE { SIMPLE <current_dims> / <max_dims> } + + <dataset_attribute> ::= <attribute> +</PRE> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@@ncsa.uiuc.edu"> +hdfhelp@@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + diff --git a/doc/html/Tutor/crtfile.html b/doc/html/Tutor/crtfile.html new file mode 100644 index 0000000..8786aab --- /dev/null +++ b/doc/html/Tutor/crtfile.html @@ -0,0 +1,224 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating an HDF5 File +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating an HDF5 file</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">What is an HDF5 file</A>? + <LI>Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + <LI> <A HREF="#ddl">File Definition in DDL</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>What is an HDF5 file?</h2> +<P> +An HDF5 file is a binary file which contains scientific data and supporting +metadata. The two primary objects stored in an HDF5 file are groups and +datasets. Groups and datasets will be discussed in the other sessions. +<P> +To create a file, the program application must specify a file name, file +access mode, file creation property list, and file access property list. +<P> +<UL> + <LI><B> File Creation Property List:</B><BR> + The file creation property list is used to control the file metadata. + File metadata contains information about the size of the user-block, the + size of various file data structures used by the HDF5 library, etc. +<P> + The user-block is a fixed length block of data located at the beginning + of the file which is ignored by the HDF5 library and may be used to store + any data information found to be useful to applications. +<P> + For more details, see the HDF5 documentation. In this tutorial, + the default file metadata is used. +<P> + <LI><B> File Access Property List:</B><BR> + The file access property list is used to control different methods of + performing I/O on files. See the HDF5 User's Guide for details. The default + file access property is used in this tutorial. +</UL> +<P> +The steps to create and close an HDF5 file are as follows: +<OL> + <LI> Specify the file creation and access property lists if necessary. + <LI> Create a file. + <LI> Close the file and close the property lists if necessary. +</OL> +To create an HDF5 file, the calling program must contain the following calls: + +<PRE> + file_id = H5Fcreate(filename, access_mode, create_id, access_id); + + H5Fclose(file_id); +</PRE> +<P> +<H2>Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +The following example demonstrates how to create and close an HDF5 file. +It creates a file called 'file.h5', and then closes the file.<BR> +[ <A HREF="examples/h5_crtfile.c">Download h5_crtfile.c</A> ] +<PRE> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +#include <hdf5.h> +#define FILE "file.h5" + +main() { + + hid_t file_id; /* file identifier */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Terminate access to the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI>The include file 'hdf5.h' contains definitions and declarations, and it must + be included in any file that uses the HDF5 library. +<P> +<LI>H5Fcreate creates an HDF5 file and returns the file identifier. +<PRE> + hid_t H5Fcreate (const char *name, unsigned flags, hid_t create_id, + hid_t access_id) +</PRE> +<UL> + <LI> The first parameter specifies the name of the file to be created. +<P> + <LI> The second parameter specifies the file access mode. H5F_ACC_TRUNC will + truncate a file if it already exists. +<P> + <LI> The third parameter specifies the file creation property list. + H5P_DEFAULT indicates that the default file creation property list is + used. + +<P> + <LI> The last parameter of H5Fcreate specifies the file access property list. + H5P_DEFAULT indicates that the default file access property list is used. + +</UL> +<P> +<LI> When a file is no longer accessed by a program, H5Fclose must be called to + release the resource used by the file. This call is mandatory. +<PRE> + herr_t H5Fclose (hid_t file_id) +</PRE> +<P> +<LI>The root group is automatically created when a file is created. + Every file has a root group and the path name of the root group is '/'. +</UL> +<A NAME="fc"> +<H3><U>File Contents</U></H3> +HDF has developed tools to examine the contents of HDF5 files. The tool used +in this tutorial is the HDF5 dumper, h5dump. h5dump is a tool that displays +the file contents in human readable form to an ASCII file in DDL. DDL (Data +Description Language) is a language that describes HDF5 objects in Backus-Naur +Form. To view the file contents, type: +<PRE> + <B>h5dump <filename></B> +</PRE> +Figure 4.1 describes the file contents of 'file.h5' using a directed graph. +Each HDF5 object is represented by a rectangle and the arrows indicate +the structure of the contents. In Fig. 4.2, 'file.h5' contains +a group object named '/' (the root group). + +<P> +<B>Fig. 4.1</B> <I>Contents of 'file.h5'</I> +<PRE> +<!-- +<IMG src="fileh5.jpg" width="205" height="208"></PRE> --> +<IMG src="img001.gif"></PRE> +Figure 4.2 is the text-description of 'file.h5' generated by h5dump. The HDF5 +file called 'file.h5' contains a group called '/'. +<P> +<B> Fig. 4.2</B> <I>'file.h5' in DDL</I> +<PRE> + + HDF5 "file.h5" { + GROUP "/" { + } + } + +</PRE> +<A NAME="ddl"> +<h3><U>File Definition in DDL</U></H3> +Figure 4.3 is the simplified DDL file definition for creating an HDF5 file. +For simplicity, a simplified DDL is used in this tutorial. A complete and +more rigorous DDL can be found in the HDF5 User's Guide. See the +<A HREF="references.html">References</A> section of this tutorial. +<P> +<B> Fig. 4.3</B> <I>HDF5 File Definition</I> +<P> + The explanation of the symbols used in the DDL: +<PRE> + + ::= defined as + <tname> a token with the name <I>tname</I> + <a> | <b> one of <a> or <b> + <a>* zero or more occurrences of <a> +</PRE> + The simplified DDL file definition: +<PRE> + <file> ::= HDF5 "<file_name>" { <root_group> } + + <root_group> ::= GROUP "/" { <group_attribute>* <group_member>* } + + <group_attribute> ::= <attribute> + + <group_member> ::= <group> | <dataset> +</PRE> +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/crtgrp.html b/doc/html/Tutor/crtgrp.html new file mode 100644 index 0000000..566fd2c --- /dev/null +++ b/doc/html/Tutor/crtgrp.html @@ -0,0 +1,167 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating a Group +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating a Group</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">What is a Group</A>? + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>What is a Group?</h2> +<P> +An HDF5 group is a structure containing zero or more HDF5 objects. The two +primary HDF5 objects are groups and datasets. To create a group, the calling +program must: +<OL> + <LI> Obtain the location identifier where the group is to be created. + <LI> Create the group. + <LI> Close the group. +</OL> +To create a group, the calling program must contain the following calls: +<PRE> + group_id = H5Gcreate (loc_id, name, size_hint); + H5Gclose (group_id); +</PRE> + + + + +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +The following example shows how to create and close a group. It creates a file +called 'group.h5', creates a group called <I>MyGroup</I> in the root group, +and then closes the group and file. <BR> +[ <A HREF="examples/h5_crtgrp.c">Download h5_crtgrp.c</A> ] +<PRE> + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "group.h5" + +main() { + + hid_t file_id, group_id; /* identifiers */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create a group named "/MyGroup" in the file. */ + group_id = H5Gcreate(file_id, "/MyGroup", 0); + + /* Close the group. */ + status = H5Gclose(group_id); + + /* Terminate access to the file. */ + status = H5Fclose(file_id); +} +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> H5Gcreate creates a new empty group and returns a group identifier. +<PRE> + hid_t H5Gcreate (hid_t loc_id, const char *name, size_t size_hint) +</PRE> +<UL> + <LI> The first parameter specifies the location to create the group. + + <LI> The second parameter specifies the name of the group to be created. + + <LI> The third parameter specifies how much file space to reserve to store the + names that will appear in the group. If a non-positive value is supplied, + then a default size is used. Passing a value of zero is usually adequate + since the library is able to dynamically resize the name heap. +</UL> +<P> +<LI> H5Gcreate creates a group named <I>MyGroup</I> in the root group of the specified + file. +<P> +<LI> H5Gclose closes the group. This call is mandatory. +<PRE> + herr_t H5Gclose (hid_t group_id) +</PRE> +</UL> + +<A NAME="fc"> +<H3><U>File Contents</U></H3> +The contents of 'group.h5' and the definition of the group are given in the +following: +<P> +<table width="56%" border="1" bordercolor="#FFFFFF" cellpadding="6" cellspacing="6"> + <tr> + <td width="47%"><b>Fig. 8.1</b> <i>The Contents of 'group.h5'.</i> + </td> + <td width="53%"><b>Fig. 8.2</b> <i>'group.h5' in DDL</i> </td> + </tr> + <tr bordercolor="#000000"> +<!-- <td width="47%"><IMG src="grouph5.jpg" width="205" height="333"></td> --> + <td width="47%"><IMG src="img003.gif"></td> + <td width="53%" valign="top"> + <pre> +HDF5 "group.h5" { +GROUP "/" { + GROUP "MyGroup" { + } +} +} +</pre> + </td> + </tr> +</table> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/crtgrpar.html b/doc/html/Tutor/crtgrpar.html new file mode 100644 index 0000000..d5fbc66 --- /dev/null +++ b/doc/html/Tutor/crtgrpar.html @@ -0,0 +1,246 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating Groups using Absolute/Relative Names +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating Groups using +Absolute/Relative Names</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">Absolute vs. Relative Names</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>Absolute vs. Relative Names</h2> +<P> +Recall that to create an HDF5 object, we have to specify the location where the +object is to be created. This location is determined by the identifier of an HDF5 +object and the name of the object to be created. The name of the created +object can be either an absolute name or a name relative to the specified +identifier. +In Example 5, we used the file identifier and the absolute name "/MyGroup" to create a +group. The file identifier and the name "/" specifies the location where the group +"MyGroup" was created. +<P> +In this section, we discuss HDF5 names and show how to use absolute/relative +names by giving an example of creating groups in a file. + +<H3>Names</H3> + +HDF5 object names are a slash-separated list of components. There are few +restrictions on names: component names may be any length except zero and may +contain any character except slash ("/") and the null terminator. A full name +may be composed of any number of component names separated by slashes, with any +of the component names being the special name ".". A name which begins with a +slash is an absolute name which is accessed beginning with the root group of the +file while all other relative names are accessed beginning with the specified +group. Multiple consecutive slashes in a full name are treated as single slashes +and trailing slashes are not significant. A special case is the name "/" (or +equivalent) which refers to the root group. +<P> +Functions which operate on names generally take a location identifier which +is either a file ID or a group ID and perform the lookup with respect to that +location. Some possibilities are: + +<table width="67%" border="1" bordercolor="#000000" cellpadding="4"> + <tr bgcolor="#ffcc99" bordercolor="#FFFFFF"> + <td><b> Location Type </b></td> + <td><b>Object Name</b></td> + <td><b>Description</b></td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc" height="22">File ID</td> + <td height="22" bgcolor="#CCCCCC"> + <div align="center">/foo/bar</div> + </td> + <td height="22">The object bar in group foo in the root group. </td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">Group ID </td> + <td bgcolor="#CCCCCC"> + <div align="center">/foo/bar</div> + </td> + <td>The object bar in group foo in the root group of the file containing the + specified group. In other words, the group ID's only purpose is to supply + a file. </td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">File ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">/</div> + </td> + <td>The root group of the specified file.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">Group ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">/</div> + </td> + <td>The root group of the file containing the specified group.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">Group ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">foo/bar</div> + </td> + <td>The object bar in group foo in the specified group.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">File ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">.</div> + </td> + <td>The root group of the file.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">Group ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">.</div> + </td> + <td>The specified group.</td> + </tr> + <tr bordercolor="#FFFFFF"> + <td bgcolor="#99cccc">Other ID</td> + <td bgcolor="#CCCCCC"> + <div align="center">.</div> + </td> + <td>The specified object.</td> + </tr> +</table> + + +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +The following example code shows how to create groups using absolute +and relative names. It creates three groups: the first two groups are +created using the file identifier and the group absolute names, and the +third group is created using a group identifier and the name relative +to the specified group. <BR> +[ <A HREF="examples/h5_crtgrpar.c">Download h5_crtgrpar.c</A> ] + +<PRE> + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "groups.h5" + +main() { + + hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create group "MyGroup" in the root group using absolute name. */ + group1_id = H5Gcreate(file_id, "/MyGroup", 0); + + /* Create group "Group_A" in group "MyGroup" using absolute name. */ + group2_id = H5Gcreate(file_id, "/MyGroup/Group_A", 0); + + /* Create group "Group_B" in group "MyGroup" using relative name. */ + group3_id = H5Gcreate(group1_id, "Group_B", 0); + + /* Close groups. */ + status = H5Gclose(group1_id); + status = H5Gclose(group2_id); + status = H5Gclose(group3_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> H5Gcreate creates a group at the location specified by a location ID and a + name. The location ID can be a file ID or a group ID and the name can be + relative or absolute. + +<LI> The first H5Gcreate creates the group 'MyGroup' in the root group of the + specified file. + +<LI> The second H5Gcreate creates the group 'Group_A' in the group 'MyGroup' + in the root group of the specified file. Note that the parent group (MyGroup) + already exists. + +<LI> The third H5Gcreate creates the group 'Group_B' in the specified group. +</UL> +<A NAME="fc"> +<H3><U>File Contents</U></H3> +The file contents are shown below: +<P> +<B>Fig. 9.1</B> <I>The Contents of 'groups.h5'</I> +<P> +<!--<IMG src="groupsh5.jpg" width="285" height="383"></P> --> +<IMG src="img004.gif"></P> + + + <B> Fig. 9.2</B> <I>'groups.h5' in DDL</I> +<PRE> + + HDF5 "groups.h5" { + GROUP "/" { + GROUP "MyGroup" { + GROUP "Group_A" { + } + GROUP "Group_B" { + } + } + } + } + +</PRE> + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/crtgrpd.html b/doc/html/Tutor/crtgrpd.html new file mode 100644 index 0000000..e92a101 --- /dev/null +++ b/doc/html/Tutor/crtgrpd.html @@ -0,0 +1,191 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Creating Datasets in Groups +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Creating Datasets in Groups</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#ds"> Creating datasets in groups</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> +<!-- <LI> <A HREF="#rem">Remarks</A> --> + <LI> <A HREF="#fc">File Contents</A> + </UL> +</UL> +<HR> +<A NAME="ds"> +<H2><U>Creating datasets in groups</U></H2> +We have shown how to create groups, datasets and attributes. In this section, +we show how to create datasets in groups. Recall that H5Dcreate creates a +dataset at the location specified by a location identifier and a name. Similar to +H5Gcreate, the location identifier can be a file identifier or a group identifier and the name can be +relative or absolute. The location identifier and the name together determine the +location where the dataset is to be created. If the location identifier and name +refers to a group, then the dataset is created in that group. + + +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +This example shows how to create a dataset in a particular group. +It opens the file created in the previous example and creates two datasets.<BR> +[ <A HREF="examples/h5_crtgrpd.c">Download h5_crtgrpd.c</A> ] +<PRE> + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "groups.h5" + +main() { + + hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + int i, j, dset1_data[3][3], dset2_data[2][10]; + + /* Initialize the first dataset. */ + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + dset1_data[i][j] = j + 1; + + /* Initialize the second dataset. */ + for (i = 0; i < 2; i++) + for (j = 0; j < 10; j++) + dset2_data[i][j] = j + 1; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Create the data space for the first dataset. */ + dims[0] = 3; + dims[1] = 3; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create a dataset in group "MyGroup". */ + dataset_id = H5Dcreate(file_id, "/MyGroup/dset1", H5T_STD_I32BE, dataspace_id +, + H5P_DEFAULT); + + /* Write the first dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset1_data); + + /* Close the data space for the first dataset. */ + status = H5Sclose(dataspace_id); + + /* Close the first dataset. */ + status = H5Dclose(dataset_id); + + /* Open an existing group of the specified file. */ + group_id = H5Gopen(file_id, "/MyGroup/Group_A"); + + /* Create the data space for the second dataset. */ + dims[0] = 2; + dims[1] = 10; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the second dataset in group "Group_A". */ + dataset_id = H5Dcreate(group_id, "dset2", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); + + /* Write the second dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset2_data); + + /* Close the data space for the second dataset. */ + status = H5Sclose(dataspace_id); + + /* Close the second dataset */ + status = H5Dclose(dataset_id); + + /* Close the group. */ + status = H5Gclose(group_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + + +<A NAME="fc"> +<H3><U>File Contents</U></H3> +<P> +<B>Fig. 10.1</B> <I>The Contents of 'groups.h5'</I> +<PRE> +<IMG src="img005.gif"></PRE> +<!-- <IMG src="groups2.jpg" width="324" height="433"></PRE> --> + +</PRE> + <B>Fig. 10.2</B> <I>'groups.h5' in DDL</I> +<PRE> + + HDF5 "groups.h5" { + GROUP "/" { + GROUP "MyGroup" { + GROUP "Group_A" { + DATASET "dset2" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 2, 10 ) / ( 2, 10 ) } + DATA { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + } + } + } + GROUP "Group_B" { + } + DATASET "dset1" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 3, 3 ) / ( 3, 3 ) } + DATA { + 1, 2, 3, + 1, 2, 3, + 1, 2, 3 + } + } + } + } + } +</PRE> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br>The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois at Urbana-Champaign</a><br> +<!-- <A HREF="helpdesk.mail.html"> --> +<BR><A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/examples/h5_compound.c b/doc/html/Tutor/examples/h5_compound.c new file mode 100644 index 0000000..4bb4ad1 --- /dev/null +++ b/doc/html/Tutor/examples/h5_compound.c @@ -0,0 +1,153 @@ +/* + * This example shows how to create a compound data type, + * write an array which has the compound data type to the file, + * and read back fields' subsets. + */ + +#include "hdf5.h" + +#define FILE "SDScompound.h5" +#define DATASETNAME "ArrayOfStructures" +#define LENGTH 10 +#define RANK 1 + +int +main(void) +{ + + /* First structure and dataset*/ + typedef struct s1_t { + int a; + float b; + double c; + } s1_t; + s1_t s1[LENGTH]; + hid_t s1_tid; /* File datatype identifier */ + + /* Second structure (subset of s1_t) and dataset*/ + typedef struct s2_t { + double c; + int a; + } s2_t; + s2_t s2[LENGTH]; + hid_t s2_tid; /* Memory datatype handle */ + + /* Third "structure" ( will be used to read float field of s1) */ + hid_t s3_tid; /* Memory datatype handle */ + float s3[LENGTH]; + + int i; + hid_t file, dataset, space; /* Handles */ + herr_t status; + hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */ + + + /* + * Initialize the data + */ + for (i = 0; i< LENGTH; i++) { + s1[i].a = i; + s1[i].b = i*i; + s1[i].c = 1./(i+1); + } + + /* + * Create the data space. + */ + space = H5Screate_simple(RANK, dim, NULL); + + /* + * Create the file. + */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create the memory data type. + */ + s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); + H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + + /* + * Create the dataset. + */ + dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT); + + /* + * Wtite data to the dataset; + */ + status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); + + /* + * Release resources + */ + H5Tclose(s1_tid); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(file); + + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + + dataset = H5Dopen(file, DATASETNAME); + + /* + * Create a data type for s2 + */ + s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t)); + + H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT); + + /* + * Read two fields c and a from s1 dataset. Fields in the file + * are found by their names "c_name" and "a_name". + */ + status = H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2); + + /* + * Display the fields + */ + printf("\n"); + printf("Field c : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c); + printf("\n"); + + printf("\n"); + printf("Field a : \n"); + for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a); + printf("\n"); + + /* + * Create a data type for s3. + */ + s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float)); + + status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT); + + /* + * Read field b from s1 dataset. Field in the file is found by its name. + */ + status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3); + + /* + * Display the field + */ + printf("\n"); + printf("Field b : \n"); + for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]); + printf("\n"); + + /* + * Release resources + */ + H5Tclose(s2_tid); + H5Tclose(s3_tid); + H5Dclose(dataset); + H5Fclose(file); + + return 0; +} diff --git a/doc/html/Tutor/examples/h5_copy.c b/doc/html/Tutor/examples/h5_copy.c new file mode 100644 index 0000000..b0a5e00 --- /dev/null +++ b/doc/html/Tutor/examples/h5_copy.c @@ -0,0 +1,148 @@ +/***********************************************************************/ +/* */ +/* PROGRAM: h5_copy.c */ +/* PURPOSE: Shows how to use the H5SCOPY function. */ +/* DESCRIPTION: */ +/* This program creates two files, copy1.h5, and copy2.h5. */ +/* In copy1.h5, it creates a 3x4 dataset called 'Copy1', */ +/* and write 0's to this dataset. */ +/* In copy2.h5, it create a 3x4 dataset called 'Copy2', */ +/* and write 1's to this dataset. */ +/* It closes both files, reopens both files, selects two */ +/* points in copy1.h5 and writes values to them. Then it */ +/* does an H5Scopy from the first file to the second, and */ +/* writes the values to copy2.h5. It then closes the */ +/* files, reopens them, and prints the contents of the */ +/* two datasets. */ +/* */ +/***********************************************************************/ + +#include "hdf5.h" +#define FILE1 "copy1.h5" +#define FILE2 "copy2.h5" + +#define RANK 2 +#define DIM1 3 +#define DIM2 4 +#define NUMP 2 + +int main (void) +{ + hid_t file1, file2, dataset1, dataset2; + hid_t mid1, mid2, fid1, fid2; + hsize_t fdim[] = {DIM1, DIM2}; + hsize_t mdim[] = {DIM1, DIM2}; + hsize_t start[2], stride[2], count[2], block[2]; + int buf1[DIM1][DIM2]; + int buf2[DIM1][DIM2]; + int bufnew[DIM1][DIM2]; + int val[] = {53, 59}; + hsize_t marray[] = {2}; + hssize_t coord[NUMP][RANK]; + herr_t ret; + uint i, j; + +/***********************************************************************/ +/* */ +/* Create two files containing identical datasets. Write 0's to one */ +/* and 1's to the other. */ +/* */ +/***********************************************************************/ + + for ( i = 0; i < DIM1; i++ ) + for ( j = 0; j < DIM2; j++ ) + buf1[i][j] = 0; + + for ( i = 0; i < DIM1; i++ ) + for ( j = 0; j < DIM2; j++ ) + buf2[i][j] = 1; + + file1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + fid1 = H5Screate_simple (RANK, fdim, NULL); + fid2 = H5Screate_simple (RANK, fdim, NULL); + + dataset1 = H5Dcreate (file1, "Copy1", H5T_NATIVE_INT, fid1, H5P_DEFAULT); + dataset2 = H5Dcreate (file2, "Copy2", H5T_NATIVE_INT, fid2, H5P_DEFAULT); + + ret = H5Dwrite(dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1); + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); + + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + + ret = H5Sclose (fid1); + ret = H5Sclose (fid2); + + ret = H5Fclose (file1); + ret = H5Fclose (file2); + +/***********************************************************************/ +/* */ +/* Open the two files. Select two points in one file, write values to */ +/* those point locations, then do H5Scopy and write the values to the */ +/* other file. Close files. */ +/* */ +/***********************************************************************/ + + file1 = H5Fopen (FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + file2 = H5Fopen (FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + dataset1 = H5Dopen (file1, "Copy1"); + dataset2 = H5Dopen (file2, "Copy2"); + fid1 = H5Dget_space (dataset1); + mid1 = H5Screate_simple(1, marray, NULL); + coord[0][0] = 0; coord[0][1] = 3; + coord[1][0] = 0; coord[1][1] = 1; + + ret = H5Sselect_elements (fid1, H5S_SELECT_SET, NUMP, (const hssize_t **)coord); + + ret = H5Dwrite (dataset1, H5T_NATIVE_INT, mid1, fid1, H5P_DEFAULT, val); + + fid2 = H5Scopy (fid1); + + ret = H5Dwrite (dataset2, H5T_NATIVE_INT, mid1, fid2, H5P_DEFAULT, val); + + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + ret = H5Sclose (fid1); + ret = H5Sclose (fid2); + ret = H5Fclose (file1); + ret = H5Fclose (file2); + ret = H5Sclose (mid1); + +/***********************************************************************/ +/* */ +/* Open both files and print the contents of the datasets. */ +/* */ +/***********************************************************************/ + + file1 = H5Fopen (FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + file2 = H5Fopen (FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + dataset1 = H5Dopen (file1, "Copy1"); + dataset2 = H5Dopen (file2, "Copy2"); + + ret = H5Dread (dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, bufnew); + + printf ("\nDataset 'Copy1' in file 'copy1.h5' contains: \n"); + for (i=0;i<DIM1; i++) { + for (j=0;j<DIM2;j++) printf ("%3d ", bufnew[i][j]); + printf("\n"); + } + + printf ("\nDataset 'Copy2' in file 'copy2.h5' contains: \n"); + + ret = H5Dread (dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, bufnew); + + for (i=0;i<DIM1; i++) { + for (j=0;j<DIM2;j++) printf ("%3d ", bufnew[i][j]); + printf("\n"); + } + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + ret = H5Fclose (file1); + ret = H5Fclose (file2); + +} diff --git a/doc/html/Tutor/examples/h5_crtatt.c b/doc/html/Tutor/examples/h5_crtatt.c new file mode 100644 index 0000000..a2b887c --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtatt.c @@ -0,0 +1,46 @@ +/* + * Creating a dataset attribute. + */ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers */ + hsize_t dims; + int attr_data[2]; + herr_t status; + + /* Initialize the attribute data. */ + attr_data[0] = 100; + attr_data[1] = 200; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open an existing dataset. */ + dataset_id = H5Dopen(file_id, "/dset"); + + /* Create the data space for the attribute. */ + dims = 2; + dataspace_id = H5Screate_simple(1, &dims, NULL); + + /* Create a dataset attribute. */ + attribute_id = H5Acreate(dataset_id, "attr", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); + + /* Write the attribute data. */ + status = H5Awrite(attribute_id, H5T_NATIVE_INT, attr_data); + + /* Close the attribute. */ + status = H5Aclose(attribute_id); + + /* Close the dataspace. */ + status = H5Sclose(dataspace_id); + + /* Close to the dataset. */ + status = H5Dclose(dataset_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} diff --git a/doc/html/Tutor/examples/h5_crtdat.c b/doc/html/Tutor/examples/h5_crtdat.c new file mode 100644 index 0000000..d704cf1 --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtdat.c @@ -0,0 +1,34 @@ +/* + * Creating and closing a dataset. + */ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create the data space for the dataset. */ + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the dataset. */ + dataset_id = H5Dcreate(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); + + /* End access to the dataset and release resources used by it. */ + status = H5Dclose(dataset_id); + + /* Terminate access to the data space. */ + status = H5Sclose(dataspace_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} + diff --git a/doc/html/Tutor/examples/h5_crtfile.c b/doc/html/Tutor/examples/h5_crtfile.c new file mode 100644 index 0000000..680cde8 --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtfile.c @@ -0,0 +1,19 @@ +/* + * Creating and closing a file. + */ + +#include <hdf5.h> +#define FILE "file.h5" + +main() { + + hid_t file_id; /* file identifier */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Terminate access to the file. */ + status = H5Fclose(file_id); +} + diff --git a/doc/html/Tutor/examples/h5_crtgrp.c b/doc/html/Tutor/examples/h5_crtgrp.c new file mode 100644 index 0000000..a6aad93 --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtgrp.c @@ -0,0 +1,24 @@ +/* + * Creating and closing a group. + */ + +#include <hdf5.h> +#define FILE "group.h5" + +main() { + + hid_t file_id, group_id; /* identifiers */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create a group named "/MyGroup" in the file. */ + group_id = H5Gcreate(file_id, "/MyGroup", 0); + + /* Close the group. */ + status = H5Gclose(group_id); + + /* Terminate access to the file. */ + status = H5Fclose(file_id); +} diff --git a/doc/html/Tutor/examples/h5_crtgrpar.c b/doc/html/Tutor/examples/h5_crtgrpar.c new file mode 100644 index 0000000..6dcc003 --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtgrpar.c @@ -0,0 +1,32 @@ +/* + * Creating groups using absolute and relative names. + */ + +#include <hdf5.h> +#define FILE "groups.h5" + +main() { + + hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */ + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create group "MyGroup" in the root group using absolute name. */ + group1_id = H5Gcreate(file_id, "/MyGroup", 0); + + /* Create group "Group_A" in group "MyGroup" using absolute name. */ + group2_id = H5Gcreate(file_id, "/MyGroup/Group_A", 0); + + /* Create group "Group_B" in group "MyGroup" using relative name. */ + group3_id = H5Gcreate(group1_id, "Group_B", 0); + + /* Close groups. */ + status = H5Gclose(group1_id); + status = H5Gclose(group2_id); + status = H5Gclose(group3_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} diff --git a/doc/html/Tutor/examples/h5_crtgrpd.c b/doc/html/Tutor/examples/h5_crtgrpd.c new file mode 100644 index 0000000..e497764 --- /dev/null +++ b/doc/html/Tutor/examples/h5_crtgrpd.c @@ -0,0 +1,74 @@ +/* + * Create two datasets within groups. + */ + +#include <hdf5.h> +#define FILE "groups.h5" + +main() { + + hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + int i, j, dset1_data[3][3], dset2_data[2][10]; + + /* Initialize the first dataset. */ + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + dset1_data[i][j] = j + 1; + + /* Initialize the second dataset. */ + for (i = 0; i < 2; i++) + for (j = 0; j < 10; j++) + dset2_data[i][j] = j + 1; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Create the data space for the first dataset. */ + dims[0] = 3; + dims[1] = 3; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create a dataset in group "MyGroup". */ + dataset_id = H5Dcreate(file_id, "/MyGroup/dset1", H5T_STD_I32BE, dataspace_id, + H5P_DEFAULT); + + /* Write the first dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset1_data); + + /* Close the data space for the first dataset. */ + status = H5Sclose(dataspace_id); + + /* Close the first dataset. */ + status = H5Dclose(dataset_id); + + /* Open an existing group of the specified file. */ + group_id = H5Gopen(file_id, "/MyGroup/Group_A"); + + /* Create the data space for the second dataset. */ + dims[0] = 2; + dims[1] = 10; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the second dataset in group "Group_A". */ + dataset_id = H5Dcreate(group_id, "dset2", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT); + + /* Write the second dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset2_data); + + /* Close the data space for the second dataset. */ + status = H5Sclose(dataspace_id); + + /* Close the second dataset */ + status = H5Dclose(dataset_id); + + /* Close the group. */ + status = H5Gclose(group_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} + diff --git a/doc/html/Tutor/examples/h5_extend.c b/doc/html/Tutor/examples/h5_extend.c new file mode 100644 index 0000000..ae26ed6 --- /dev/null +++ b/doc/html/Tutor/examples/h5_extend.c @@ -0,0 +1,141 @@ +/************************************************************** + * + * This example shows how to work with extendible datasets. + * In the current version of the library a dataset MUST be + * chunked in order to be extendible. + * + * This example is derived from the h5_extend_write.c and + * h5_read_chunk.c examples that are in the "Introduction + * to HDF5". + * + *************************************************************/ + +#include "hdf5.h" + +#define FILE "ext.h5" +#define DATASETNAME "ExtendibleArray" +#define RANK 2 + +int +main (void) +{ + hid_t file; /* handles */ + hid_t dataspace, dataset; + hid_t filespace; + hid_t cparms; + hid_t memspace; + + hsize_t dims[2] = { 3, 3}; /* dataset dimensions + at creation time */ + hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */ + hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */ + + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t size[2]; + hssize_t offset[2]; + hsize_t i,j; + herr_t status, status_n; + int data1[3][3] = { {1, 1, 1}, /* data to write */ + {1, 1, 1}, + {1, 1, 1} }; + + int data2[7] = { 2, 2, 2, 2, 2, 2, 2}; + + /* Variables used in reading data back */ + hsize_t chunk_dims[2] ={2, 5}; + hsize_t chunk_dimsr[2]; + hsize_t dimsr[2]; + int data_out[10][3]; + int rank, rank_chunk; + + /* Create the data space with unlimited dimensions. */ + dataspace = H5Screate_simple (RANK, dims, maxdims); + + /* Create a new file. If file exists its contents will be overwritten. */ + file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Modify dataset creation properties, i.e. enable chunking */ + cparms = H5Pcreate (H5P_DATASET_CREATE); + status = H5Pset_chunk ( cparms, RANK, chunk_dims); + + /* Create a new dataset within the file using cparms + creation properties. */ + dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, dataspace, + cparms); + + /* Extend the dataset. This call assures that dataset is 3 x 3.*/ + size[0] = 3; + size[1] = 3; + status = H5Dextend (dataset, size); + + /* Select a hyperslab */ + filespace = H5Dget_space (dataset); + offset[0] = 0; + offset[1] = 0; + status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL, + dims1, NULL); + + /* Write the data to the hyperslab */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data1); + + /* Extend the dataset. Dataset becomes 10 x 3 */ + dims[0] = dims1[0] + dims2[0]; + size[0] = dims[0]; + size[1] = dims[1]; + status = H5Dextend (dataset, size); + + /* Select a hyperslab */ + filespace = H5Dget_space (dataset); + offset[0] = 3; + offset[1] = 0; + status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL, + dims2, NULL); + + /* Define memory space */ + dataspace = H5Screate_simple (RANK, dims2, NULL); + + /* Write the data to the hyperslab */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data2); + + /* Close resources */ + status = H5Dclose (dataset); + status = H5Sclose (dataspace); + status = H5Sclose (filespace); + status = H5Fclose (file); + +/**************************************************************** + Read the data back + ***************************************************************/ + + file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen (file, DATASETNAME); + filespace = H5Dget_space (dataset); + rank = H5Sget_simple_extent_ndims (filespace); + status_n = H5Sget_simple_extent_dims (filespace, dimsr, NULL); + + cparms = H5Dget_create_plist (dataset); + if (H5D_CHUNKED == H5Pget_layout (cparms)) + { + rank_chunk = H5Pget_chunk (cparms, 2, chunk_dimsr); + } + + memspace = H5Screate_simple (rank,dimsr,NULL); + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, data_out); + printf("\n"); + printf("Dataset: \n"); + for (j = 0; j < dimsr[0]; j++) + { + for (i = 0; i < dimsr[1]; i++) + printf("%d ", data_out[j][i]); + printf("\n"); + } + + status = H5Pclose (cparms); + status = H5Dclose (dataset); + status = H5Sclose (filespace); + status = H5Sclose (memspace); + status = H5Fclose (file); +} diff --git a/doc/html/Tutor/examples/h5_hyperslab.c b/doc/html/Tutor/examples/h5_hyperslab.c new file mode 100644 index 0000000..fc953d5 --- /dev/null +++ b/doc/html/Tutor/examples/h5_hyperslab.c @@ -0,0 +1,192 @@ +/************************************************************ + + This example shows how to write and read a hyperslab. It + is derived from the h5_read.c and h5_write.c examples in + the "Introduction to HDF5". + + ************************************************************/ + +#include "hdf5.h" + +#define FILE "sds.h5" +#define DATASETNAME "IntArray" +#define NX_SUB 3 /* hyperslab dimensions */ +#define NY_SUB 4 +#define NX 7 /* output buffer dimensions */ +#define NY 7 +#define NZ 3 +#define RANK 2 +#define RANK_OUT 3 + +#define X 5 /* dataset dimensions */ +#define Y 6 + +int +main (void) +{ + hsize_t dimsf[2]; /* dataset dimensions */ + int data[X][Y]; /* data to write */ + + /* + * Data and output buffer initialization. + */ + hid_t file, dataset; /* handles */ + hid_t dataspace; + hid_t memspace; + hsize_t dimsm[3]; /* memory space dimensions */ + hsize_t dims_out[2]; /* dataset dimensions */ + herr_t status; + + int data_out[NX][NY][NZ ]; /* output buffer */ + + hsize_t count[2]; /* size of the hyperslab in the file */ + hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t count_out[3]; /* size of the hyperslab in memory */ + hssize_t offset_out[3]; /* hyperslab offset in memory */ + int i, j, k, status_n, rank; + + + +/********************************************************* + This writes data to the HDF5 file. + *********************************************************/ + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < X; j++) { + for (i = 0; i < Y; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + */ + + /* + * Create a new file using H5F_ACC_TRUNC access, + * the default file creation properties, and the default file + * access properties. + */ + file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Describe the size of the array and create the data space for fixed + * size dataset. + */ + dimsf[0] = X; + dimsf[1] = Y; + dataspace = H5Screate_simple (RANK, dimsf, NULL); + + /* + * Create a new dataset within the file using defined dataspace and + * default dataset creation properties. + */ + dataset = H5Dcreate (file, DATASETNAME, H5T_STD_I32BE, dataspace, + H5P_DEFAULT); + + /* + * Write the data to the dataset using default transfer properties. + */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); + + /* + * Close/release resources. + */ + H5Sclose (dataspace); + H5Dclose (dataset); + H5Fclose (file); + + +/************************************************************* + + This reads the hyperslab from the sds.h5 file just + created, into a 2-dimensional plane of the 3-dimensional + array. + + ************************************************************/ + + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; + } + } + + /* + * Open the file and the dataset. + */ + file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen (file, DATASETNAME); + + dataspace = H5Dget_space (dataset); /* dataspace handle */ + rank = H5Sget_simple_extent_ndims (dataspace); + status_n = H5Sget_simple_extent_dims (dataspace, dims_out, NULL); + printf("\nRank: %d\nDimensions: %lu x %lu \n", rank, + (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1])); + + /* + * Define hyperslab in the dataset. + */ + offset[0] = 1; + offset[1] = 2; + count[0] = NX_SUB; + count[1] = NY_SUB; + status = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, offset, NULL, + count, NULL); + + /* + * Define the memory dataspace. + */ + dimsm[0] = NX; + dimsm[1] = NY; + dimsm[2] = NZ; + memspace = H5Screate_simple (RANK_OUT, dimsm, NULL); + + /* + * Define memory hyperslab. + */ + offset_out[0] = 3; + offset_out[1] = 0; + offset_out[2] = 0; + count_out[0] = NX_SUB; + count_out[1] = NY_SUB; + count_out[2] = 1; + status = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, offset_out, NULL, + count_out, NULL); + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, dataspace, + H5P_DEFAULT, data_out); + printf ("Data:\n "); + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); + printf("\n "); + } + printf("\n"); + /* + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 3 4 5 6 0 0 0 + * 4 5 6 7 0 0 0 + * 5 6 7 8 0 0 0 + * 0 0 0 0 0 0 0 + */ + + /* + * Close and release resources. + */ + H5Dclose (dataset); + H5Sclose (dataspace); + H5Sclose (memspace); + H5Fclose (file); + +} diff --git a/doc/html/Tutor/examples/h5_iterate.c b/doc/html/Tutor/examples/h5_iterate.c new file mode 100644 index 0000000..db58183 --- /dev/null +++ b/doc/html/Tutor/examples/h5_iterate.c @@ -0,0 +1,111 @@ +#include <hdf5.h> + +#define FILE "iterate.h5" +#define FALSE 0 + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +herr_t file_info(hid_t loc_id, const char *name, void *opdata); + /* Operator function */ +int +main(void) { + hid_t file; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims[] = {SPACE1_DIM1}; + herr_t ret; /* Generic return value */ + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + + /* Create file */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid = H5Screate_simple(SPACE1_RANK, dims, NULL); + + /* Create a group */ + group=H5Gcreate(file,"Group1",-1); + + /* Close a group */ + ret = H5Gclose(group); + + /* Create a dataset */ + dataset=H5Dcreate(file,"Dataset1",H5T_STD_U32LE,sid,H5P_DEFAULT); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create a datatype */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + + /* Insert fields */ + ret=H5Tinsert (tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + + ret=H5Tinsert (tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + + ret=H5Tinsert (tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + + /* Save datatype for later */ + ret=H5Tcommit (file, "Datatype1", tid); + + /* Close datatype */ + ret = H5Tclose(tid); + + /* Iterate through the file to see members of the root group */ + + printf(" Objects in the root group are:\n"); + printf("\n"); + + H5Giterate(file, "/", NULL, file_info, NULL); + + /* Close file */ + ret = H5Fclose(file); + + return 0; +} + +/* + * Operator function. + */ +herr_t file_info(hid_t loc_id, const char *name, void *opdata) +{ + H5G_stat_t statbuf; + + /* + * Get type of the object and display its name and type. + * The name of the object is passed to this function by + * the Library. Some magic :-) + */ + H5Gget_objinfo(loc_id, name, FALSE, &statbuf); + switch (statbuf.type) { + case H5G_GROUP: + printf(" Object with name %s is a group \n", name); + break; + case H5G_DATASET: + printf(" Object with name %s is a dataset \n", name); + break; + case H5G_TYPE: + printf(" Object with name %s is a named datatype \n", name); + break; + default: + printf(" Unable to identify an object "); + } + return 0; + } + + + + + + + diff --git a/doc/html/Tutor/examples/h5_mount.c b/doc/html/Tutor/examples/h5_mount.c new file mode 100644 index 0000000..452ad6e --- /dev/null +++ b/doc/html/Tutor/examples/h5_mount.c @@ -0,0 +1,119 @@ +/* + * This program shows the concept of "mounting files". + * Program creates one file with group G in it, and another + * file with dataset D. Then second file is mounted in the first one + * under the "mounting point" G. Dataset D is accessed in the first file + * under name /G/D and data is printed out. + */ + +#include<hdf5.h> + +#define FILE1 "mount1.h5" +#define FILE2 "mount2.h5" + +#define RANK 2 +#define NX 4 +#define NY 5 + +int main(void) +{ + + hid_t fid1, fid2, gid; /* Files and group identifiers */ + hid_t did, tid, sid; /* Dataset and datatype identifiers */ + + herr_t status; + hsize_t dims[] = {NX,NY}; /* Dataset dimensions */ + + int i, j; + int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */ + + /* + * Initialization of buffer matrix "bm" + */ + for(i =0; i<NX; i++) { + for(j = 0; j<NY; j++) + bm[i][j] = i + j; + } + + /* + * Create first file and a group in it. + */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate(fid1, "/G", 0); + + /* + * Close group and file + */ + H5Gclose(gid); + H5Fclose(fid1); + + /* + * Create second file and dataset "D" in it. + */ + fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + dims[0] = NX; + dims[1] = NY; + sid = H5Screate_simple(RANK, dims, NULL); + did = H5Dcreate(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT); + + /* + * Write data to the dataset. + */ + status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm); + + /* + * Close all identifiers. + */ + H5Sclose(sid); + H5Dclose(did); + H5Fclose(fid2); + + /* + * Reopen both files + */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT); + + /* + * Mount second file under G in the first file. + */ + H5Fmount(fid1, "/G", fid2, H5P_DEFAULT); + + /* + * Access dataset D in the first file under /G/D name. + */ + did = H5Dopen(fid1,"/G/D"); + tid = H5Dget_type(did); + status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out); + + /* + * Print out the data. + */ + for(i=0; i<NX; i++){ + for(j=0; j<NY; j++) + printf(" %d", bm_out[i][j]); + printf("\n"); + } + + /* + * Close all identifers + */ + H5Tclose(tid); + H5Dclose(did); + + /* + * Unmounting second file + */ + H5Funmount(fid1, "/G"); + + /* + * Close both files + */ + H5Fclose(fid1); + H5Fclose(fid2); + + return 0; +} + + + diff --git a/doc/html/Tutor/examples/h5_rdwt.c b/doc/html/Tutor/examples/h5_rdwt.c new file mode 100644 index 0000000..e651a29 --- /dev/null +++ b/doc/html/Tutor/examples/h5_rdwt.c @@ -0,0 +1,37 @@ +/* + * Writing and reading an existing dataset. + */ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id; /* identifiers */ + herr_t status; + int i, j, dset_data[4][6]; + + /* Initialize the dataset. */ + for (i = 0; i < 4; i++) + for (j = 0; j < 6; j++) + dset_data[i][j] = i * 6 + j + 1; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open an existing dataset. */ + dataset_id = H5Dopen(file_id, "/dset"); + + /* Write the dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset_data); + + status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset_data); + + /* Close the dataset. */ + status = H5Dclose(dataset_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} diff --git a/doc/html/Tutor/examples/h5_read.c b/doc/html/Tutor/examples/h5_read.c new file mode 100644 index 0000000..31cb882 --- /dev/null +++ b/doc/html/Tutor/examples/h5_read.c @@ -0,0 +1,136 @@ +/* + * This example reads hyperslab from the SDS.h5 file + * created by h5_write.c program into two-dimensional + * plane of the three-dimensional array. + * Information about dataset in the SDS.h5 file is obtained. + */ + +#include "hdf5.h" + +#define FILE "SDS.h5" +#define DATASETNAME "IntArray" +#define NX_SUB 3 /* hyperslab dimensions */ +#define NY_SUB 4 +#define NX 7 /* output buffer dimensions */ +#define NY 7 +#define NZ 3 +#define RANK 2 +#define RANK_OUT 3 + +int +main (void) +{ + hid_t file, dataset; /* handles */ + hid_t datatype, dataspace; + hid_t memspace; + H5T_class_t class; /* data type class */ + H5T_order_t order; /* data order */ + size_t size; /* + * size of the data element + * stored in file + */ + hsize_t dimsm[3]; /* memory space dimensions */ + hsize_t dims_out[2]; /* dataset dimensions */ + herr_t status; + + int data_out[NX][NY][NZ ]; /* output buffer */ + + hsize_t count[2]; /* size of the hyperslab in the file */ + hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t count_out[3]; /* size of the hyperslab in memory */ + hssize_t offset_out[3]; /* hyperslab offset in memory */ + int i, j, k, status_n, rank; + + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; + } + } + + /* + * Open the file and the dataset. + */ + file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen(file, DATASETNAME); + + /* + * Get datatype and dataspace handles and then query + * dataset class, order, size, rank and dimensions. + */ + datatype = H5Dget_type(dataset); /* datatype handle */ + class = H5Tget_class(datatype); + if (class == H5T_INTEGER) printf("Data set has INTEGER type \n"); + order = H5Tget_order(datatype); + if (order == H5T_ORDER_LE) printf("Little endian order \n"); + + size = H5Tget_size(datatype); + printf(" Data size is %d \n", size); + + dataspace = H5Dget_space(dataset); /* dataspace handle */ + rank = H5Sget_simple_extent_ndims(dataspace); + status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL); + printf("rank %d, dimensions %lu x %lu \n", rank, + (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1])); + + /* + * Define hyperslab in the dataset. + */ + offset[0] = 1; + offset[1] = 2; + count[0] = NX_SUB; + count[1] = NY_SUB; + status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, + count, NULL); + + /* + * Define the memory dataspace. + */ + dimsm[0] = NX; + dimsm[1] = NY; + dimsm[2] = NZ ; + memspace = H5Screate_simple(RANK_OUT,dimsm,NULL); + + /* + * Define memory hyperslab. + */ + offset_out[0] = 3; + offset_out[1] = 0; + offset_out[2] = 0; + count_out[0] = NX_SUB; + count_out[1] = NY_SUB; + count_out[2] = 1; + status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, + count_out, NULL); + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace, + H5P_DEFAULT, data_out); + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); + printf("\n"); + } + /* + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 3 4 5 6 0 0 0 + * 4 5 6 7 0 0 0 + * 5 6 7 8 0 0 0 + * 0 0 0 0 0 0 0 + */ + + /* + * Close/release resources. + */ + H5Tclose(datatype); + H5Dclose(dataset); + H5Sclose(dataspace); + H5Sclose(memspace); + H5Fclose(file); + + return 0; +} diff --git a/doc/html/Tutor/examples/h5_ref2objr.c b/doc/html/Tutor/examples/h5_ref2objr.c new file mode 100644 index 0000000..a226778 --- /dev/null +++ b/doc/html/Tutor/examples/h5_ref2objr.c @@ -0,0 +1,93 @@ +#include <stdlib.h> +#include <hdf5.h> + +#define FILE1 "trefer1.h5" + +/* dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hobj_ref_t *rbuf; /* buffer to read from disk */ + int *tu32; /* temp. buffer read from disk */ + int i; /* counting variables */ + char read_comment[10]; + herr_t ret; /* Generic return value */ + + /* Allocate read buffers */ + rbuf = malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + tu32 = malloc(sizeof(int)*SPACE1_DIM1); + + /* Open the file */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open the dataset */ + dataset=H5Dopen(fid1,"/Dataset3"); + + /* Read selection from disk */ + ret=H5Dread(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + + /* Open dataset object */ + dset2 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[0]); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + + ret=H5Sget_simple_extent_npoints(sid1); + + /* Read from disk */ + ret=H5Dread(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tu32); + printf("Dataset data : \n"); + for (i=0; i < SPACE1_DIM1 ; i++) printf (" %d ", tu32[i]); + printf("\n"); + printf("\n"); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + + /* Open group object */ + group = H5Rdereference(dataset,H5R_OBJECT,&rbuf[2]); + + /* Get group's comment */ + ret=H5Gget_comment(group,".",10,read_comment); + printf("Group comment is %s \n", read_comment); + printf(" \n"); + /* Close group */ + ret = H5Gclose(group); + + /* Open datatype object */ + tid1 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[3]); + + /* Verify correct datatype */ + { + H5T_class_t tclass; + + tclass= H5Tget_class(tid1); + if ((tclass == H5T_COMPOUND)) + printf ("Number of compound datatype members is %d \n", H5Tget_nmembers(tid1)); + printf(" \n"); + } + + /* Close datatype */ + ret = H5Tclose(tid1); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Close file */ + ret = H5Fclose(fid1); + + /* Free memory buffers */ + free(rbuf); + free(tu32); + return 0; +} diff --git a/doc/html/Tutor/examples/h5_ref2objw.c b/doc/html/Tutor/examples/h5_ref2objw.c new file mode 100644 index 0000000..d499f8e --- /dev/null +++ b/doc/html/Tutor/examples/h5_ref2objw.c @@ -0,0 +1,120 @@ + +#include <hdf5.h> + +#define FILE1 "trefer1.h5" + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* 2-D dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +int +main(void) { + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hobj_ref_t *wbuf; /* buffer to write to disk */ + int *tu32; /* Temporary pointer to int data */ + int i; /* counting variables */ + const char *write_comment="Foo!"; /* Comments for group */ + herr_t ret; /* Generic return value */ + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + + /* Allocate write buffers */ + wbuf=(hobj_ref_t *)malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + tu32=malloc(sizeof(int)*SPACE1_DIM1); + + /* Create file */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + + /* Create a group */ + group=H5Gcreate(fid1,"Group1",-1); + + /* Set group's comment */ + ret=H5Gset_comment(group,".",write_comment); + + /* Create a dataset (inside Group1) */ + dataset=H5Dcreate(group,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT); + + for(i=0; i<SPACE1_DIM1; i++) + tu32[i] = i*3; + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tu32); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create another dataset (inside Group1) */ + dataset=H5Dcreate(group,"Dataset2",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + + /* Insert fields */ + ret=H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + + ret=H5Tinsert (tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + + ret=H5Tinsert (tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + + /* Save datatype for later */ + ret=H5Tcommit (group, "Datatype1", tid1); + + /* Close datatype */ + ret = H5Tclose(tid1); + + /* Close group */ + ret = H5Gclose(group); + + /* Create a dataset to store references */ + dataset=H5Dcreate(fid1,"Dataset3",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT); + + /* Create reference to dataset */ + ret = H5Rcreate(&wbuf[0],fid1,"/Group1/Dataset1",H5R_OBJECT,-1); + + /* Create reference to dataset */ + ret = H5Rcreate(&wbuf[1],fid1,"/Group1/Dataset2",H5R_OBJECT,-1); + + /* Create reference to group */ + ret = H5Rcreate(&wbuf[2],fid1,"/Group1",H5R_OBJECT,-1); + + /* Create reference to named datatype */ + ret = H5Rcreate(&wbuf[3],fid1,"/Group1/Datatype1",H5R_OBJECT,-1); + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Close file */ + ret = H5Fclose(fid1); + free(wbuf); + free(tu32); + return 0; +} diff --git a/doc/html/Tutor/examples/h5_ref2regr.c b/doc/html/Tutor/examples/h5_ref2regr.c new file mode 100644 index 0000000..9f747ae --- /dev/null +++ b/doc/html/Tutor/examples/h5_ref2regr.c @@ -0,0 +1,119 @@ +#include <stdlib.h> +#include <hdf5.h> + +#define FILE2 "trefer2.h5" +#define NPOINTS 10 + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* 2-D dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *rbuf; /* buffer to to read disk */ + int *drbuf; /* Buffer for reading numeric data from disk */ + int i, j; /* counting variables */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + + /* Allocate write & read buffers */ + rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + drbuf=calloc(sizeof(int),SPACE2_DIM1*SPACE2_DIM2); + + /* Open the file */ + fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open the dataset */ + dset1=H5Dopen(fid1,"/Dataset1"); + + /* Read selection from disk */ + ret=H5Dread(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + + /* Try to open objects */ + dset2 = H5Rdereference(dset1,H5R_DATASET_REGION,&rbuf[0]); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + + ret=H5Sget_simple_extent_npoints(sid1); + printf(" Number of elements in the dataset is : %d\n",ret); + + /* Read from disk */ + ret=H5Dread(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,drbuf); + + for(i=0; i<SPACE2_DIM1; i++) { + for (j=0; j<SPACE2_DIM2; j++) printf (" %d ", drbuf[i*SPACE2_DIM2+j]); + printf("\n"); } + + /* Get the hyperslab selection */ + sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[0]); + + /* Verify correct hyperslab selected */ + ret = H5Sget_select_npoints(sid2); + printf(" Number of elements in the hyperslab is : %d \n", ret); + ret = H5Sget_select_hyper_nblocks(sid2); + coords=malloc(ret*SPACE2_RANK*sizeof(hsize_t)*2); /* allocate space for the hyperslab blocks */ + ret = H5Sget_select_hyper_blocklist(sid2,0,ret,coords); + printf(" Hyperslab coordinates are : \n"); + printf (" ( %lu , %lu ) ( %lu , %lu ) \n", \ +(unsigned long)coords[0],(unsigned long)coords[1],(unsigned long)coords[2],(unsigned long)coords[3]); + free(coords); + ret = H5Sget_select_bounds(sid2,low,high); + + /* Close region space */ + ret = H5Sclose(sid2); + + /* Get the element selection */ + sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[1]); + + /* Verify correct elements selected */ + ret = H5Sget_select_elem_npoints(sid2); + printf(" Number of selected elements is : %d\n", ret); + + /* Allocate space for the element points */ + coords= malloc(ret*SPACE2_RANK*sizeof(hsize_t)); + ret = H5Sget_select_elem_pointlist(sid2,0,ret,coords); + printf(" Coordinates of selected elements are : \n"); + for (i=0; i<2*NPOINTS; i=i+2) + printf(" ( %lu , %lu ) \n", (unsigned long)coords[i],(unsigned long)coords[i+1]); + + free(coords); + ret = H5Sget_select_bounds(sid2,low,high); + + /* Close region space */ + ret = H5Sclose(sid2); + + /* Close first space */ + ret = H5Sclose(sid1); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + + /* Close Dataset */ + ret = H5Dclose(dset1); + + /* Close file */ + ret = H5Fclose(fid1); + + /* Free memory buffers */ + free(rbuf); + free(drbuf); + return 0; +} diff --git a/doc/html/Tutor/examples/h5_ref2regw.c b/doc/html/Tutor/examples/h5_ref2regw.c new file mode 100644 index 0000000..5f27950 --- /dev/null +++ b/doc/html/Tutor/examples/h5_ref2regw.c @@ -0,0 +1,112 @@ +#include <stdlib.h> +#include <hdf5.h> + +#define FILE2 "trefer2.h5" +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* Dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +/* Element selection information */ +#define POINT1_NPOINTS 10 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; + /* Coordinates for point selection */ + hdset_reg_ref_t *wbuf; /* buffer to write to disk */ + int *dwbuf; /* Buffer for writing numeric data to disk */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ + + + /* Allocate write & read buffers */ + wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + dwbuf=malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2); + + /* Create file */ + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); + + /* Create a dataset */ + dset2=H5Dcreate(fid1,"Dataset2",H5T_STD_U8LE,sid2,H5P_DEFAULT); + + for(i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++) + dwbuf[i]=i*3; + + /* Write selection to disk */ + ret=H5Dwrite(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf); + + /* Close Dataset */ + ret = H5Dclose(dset2); + + /* Create dataspace for the reference dataset */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + + /* Create a dataset */ + dset1=H5Dcreate(fid1,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT); + + /* Create references */ + + /* Select 6x6 hyperslab for first reference */ + start[0]=2; start[1]=2; + stride[0]=1; stride[1]=1; + count[0]=6; count[1]=6; + block[0]=1; block[1]=1; + ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); + + /* Store first dataset region */ + ret = H5Rcreate(&wbuf[0],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); + + /* Select sequence of ten points for second reference */ + coord1[0][0]=6; coord1[0][1]=9; + coord1[1][0]=2; coord1[1][1]=2; + coord1[2][0]=8; coord1[2][1]=4; + coord1[3][0]=1; coord1[3][1]=6; + coord1[4][0]=2; coord1[4][1]=8; + coord1[5][0]=3; coord1[5][1]=2; + coord1[6][0]=0; coord1[6][1]=4; + coord1[7][0]=9; coord1[7][1]=0; + coord1[8][0]=7; coord1[8][1]=1; + coord1[9][0]=3; coord1[9][1]=3; + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + + /* Store second dataset region */ + ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); + + /* Write selection to disk */ + ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); + + /* Close all objects */ + ret = H5Sclose(sid1); + ret = H5Dclose(dset1); + ret = H5Sclose(sid2); + + /* Close file */ + ret = H5Fclose(fid1); + + free(wbuf); + free(dwbuf); + return 0; +} + + diff --git a/doc/html/Tutor/examples/h5_reference.c b/doc/html/Tutor/examples/h5_reference.c new file mode 100644 index 0000000..a69afe2 --- /dev/null +++ b/doc/html/Tutor/examples/h5_reference.c @@ -0,0 +1,146 @@ + /* + * This program illustrates how references to the objects can be used. + * Program creates two datasets in the file. It also creates the third + * dataset, and references to the first two datasets are stored in it. + * Program reopens the file and reads dataset with the references. + * References are used to open first two datasets and read datatspace + * and datatype information about them. + * + */ + +#include<hdf5.h> + +#define FILE "refere.h5" + +int +main(void) { + hid_t fid; /* File, datasets, datatypes and */ + hid_t did_a, sid_a; /* dataspaces identifiers for three */ + hid_t did_b, tid_b, sid_b; /* datasets. */ + hid_t did_r, tid_r, sid_r; + herr_t status; + + hobj_ref_t *wbuf; /* buffer to write to disk */ + hobj_ref_t *rbuf; /* buffer to read from disk */ + + + hsize_t dim_r[1]; + hsize_t dim_a[1]; + hsize_t dim_b[2]; + + herr_t ret; /* return values */ + + /* + * Create a file using default properties. + */ + fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Create dataset "A" in the file. + */ + dim_a[0] = 5; + sid_a = H5Screate_simple(1, dim_a, NULL); + did_a = H5Dcreate(fid, "A", H5T_NATIVE_INT, sid_a, H5P_DEFAULT); + + /* + * Create dataset "B" in the file. + */ + dim_b[0] = 2; + dim_b[1] = 6; + sid_b = H5Screate_simple(2, dim_b, NULL); + did_b = H5Dcreate(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT); + + /* + * Create dataset "R" to store references to the datasets "A" and "B". + */ + dim_r[0] = 2; + sid_r = H5Screate_simple(1, dim_r, NULL); + tid_r = H5Tcopy(H5T_STD_REF_OBJ); + did_r = H5Dcreate(fid, "R", tid_r, sid_r, H5P_DEFAULT ); + + /* + * Allocate write and read buffers. + */ + wbuf = malloc(sizeof(hobj_ref_t)*2); + rbuf = malloc(sizeof(hobj_ref_t)*2); + + /* + * Create references to the datasets "A" and "B" + * and store them in the wbuf. + */ + H5Rcreate(&wbuf[0], fid, "A", H5R_OBJECT, -1); + H5Rcreate(&wbuf[1], fid, "B", H5R_OBJECT, -1); + + /* + * Write dataset R using default transfer properties. + */ + status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, + H5P_DEFAULT, wbuf); + + /* + * Close all objects. + */ + H5Sclose(sid_a); + H5Dclose(did_a); + + H5Sclose(sid_b); + H5Dclose(did_b); + + H5Tclose(tid_r); + H5Sclose(sid_r); + H5Dclose(did_r); + + H5Fclose(fid); + + /* + * Reopen the file. + */ + fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* + * Open and read dataset "R". + */ + did_r = H5Dopen(fid, "R"); + status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rbuf); + + /* + * Open dataset A using reference to it. + */ + did_a = H5Rdereference(did_r, H5R_OBJECT, &rbuf[0]); + + /* + * Get rank of the dataset "A" + */ + + printf("\n"); + sid_a = H5Dget_space(did_a); + ret = H5Sget_simple_extent_ndims(sid_a); + + if(ret == 1) printf("Rank of A is %d.\n", ret); + printf("\n"); + + /* + * Get datatype of the dataset "B" + */ + did_b = H5Rdereference(did_r, H5R_OBJECT, &rbuf[1]); + tid_b = H5Dget_type(did_b); + if(H5Tequal(tid_b, H5T_NATIVE_FLOAT)) + printf("Datatype of B is H5T_NATIVE_FLOAT.\n"); + printf("\n"); + + /* + * Close all objects. + */ + H5Dclose(did_a); + H5Sclose(sid_a); + H5Dclose(did_b); + H5Tclose(tid_b); + H5Fclose(fid); + + return 0; + + } + + + diff --git a/doc/html/Tutor/extend.html b/doc/html/Tutor/extend.html new file mode 100644 index 0000000..03b5972 --- /dev/null +++ b/doc/html/Tutor/extend.html @@ -0,0 +1,314 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Chunking and Extendible Datasets +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Chunking and Extendible Datasets</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#def">Creating an Extendible Dataset</A> + <LI>Programming Example +<UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> +<!-- + <LI> <A HREF="#fc">File Contents</A> + <LI> <A HREF="#ddl">Dataset Definition in DDL</A> +--> +</UL> +</UL> +<HR> +<A NAME="def"> +<H2>Creating an Extendible Dataset</H2> +An extendible dataset is one whose dimensions can grow. In HDF5, it is possible to define a dataset to have certain initial dimensions, then later +to increase the size of any of the initial dimensions. +<P> +HDF5 requires you to use chunking in order to define extendible datasets. Chunking makes it possible to extend datasets efficiently, without +having to reorganize storage excessively. +<P> +The following operations are required in order to write an extendible dataset: +<OL> + <LI>Declare the dataspace of the dataset to have unlimited dimensions for all dimensions that might eventually be extended. + <LI>Set dataset creation properties to enable chunking and create a dataset. + <LI>Extend the size of the dataset. +</OL> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +This example shows how to create a 3 x 3 extendible dataset, write to that +dataset, extend the dataset to 10x3, and write to the dataset again. +[<A HREF="examples/h5_extend.c">Download h5_extend.c</A>] +<PRE> + +/************************************************************** + * + * This example shows how to work with extendible datasets. + * In the current version of the library a dataset MUST be + * chunked in order to be extendible. + * + * This example is derived from the h5_extend_write.c and + * h5_read_chunk.c examples that are in the "Introduction + * to HDF5". + * + *************************************************************/ + +#include "hdf5.h" + +#define FILE "ext.h5" +#define DATASETNAME "ExtendibleArray" +#define RANK 2 + +int +main (void) +{ + hid_t file; /* handles */ + hid_t dataspace, dataset; + hid_t filespace; + hid_t cparms; + hid_t memspace; + + hsize_t dims[2] = { 3, 3}; /* dataset dimensions + at creation time */ + hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */ + hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */ + + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t size[2]; + hssize_t offset[2]; + hsize_t i,j; + herr_t status, status_n; + int data1[3][3] = { {1, 1, 1}, /* data to write */ + {1, 1, 1}, + {1, 1, 1} }; + + int data2[7] = { 2, 2, 2, 2, 2, 2, 2}; + + /* Variables used in reading data back */ + hsize_t chunk_dims[2] ={2, 5}; + hsize_t chunk_dimsr[2]; + hsize_t dimsr[2]; + int data_out[10][3]; + int rank, rank_chunk; + + /* Create the data space with unlimited dimensions. */ + dataspace = H5Screate_simple (RANK, dims, maxdims); + + /* Create a new file. If file exists its contents will be overwritten. */ + file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Modify dataset creation properties, i.e. enable chunking */ + cparms = H5Pcreate (H5P_DATASET_CREATE); + status = H5Pset_chunk ( cparms, RANK, chunk_dims); + + /* Create a new dataset within the file using cparms + creation properties. */ + dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, dataspace, + cparms); + + /* Extend the dataset. This call assures that dataset is 3 x 3.*/ + size[0] = 3; + size[1] = 3; + status = H5Dextend (dataset, size); + + /* Select a hyperslab */ + filespace = H5Dget_space (dataset); + offset[0] = 0; + offset[1] = 0; + status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL, + dims1, NULL); + + /* Write the data to the hyperslab */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data1); + + /* Extend the dataset. Dataset becomes 10 x 3 */ + dims[0] = dims1[0] + dims2[0]; + size[0] = dims[0]; + size[1] = dims[1]; + status = H5Dextend (dataset, size); + + /* Select a hyperslab */ + filespace = H5Dget_space (dataset); + offset[0] = 3; + offset[1] = 0; + status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL, + dims2, NULL); + + /* Define memory space */ + dataspace = H5Screate_simple (RANK, dims2, NULL); + + /* Write the data to the hyperslab */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, dataspace, filespace, + H5P_DEFAULT, data2); + + /* Close resources */ + status = H5Dclose (dataset); + status = H5Sclose (dataspace); + status = H5Sclose (filespace); + status = H5Fclose (file); + +/**************************************************************** + Read the data back + ***************************************************************/ + + file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen (file, DATASETNAME); + filespace = H5Dget_space (dataset); + rank = H5Sget_simple_extent_ndims (filespace); + status_n = H5Sget_simple_extent_dims (filespace, dimsr, NULL); + + cparms = H5Dget_create_plist (dataset); + if (H5D_CHUNKED == H5Pget_layout (cparms)) + { + rank_chunk = H5Pget_chunk (cparms, 2, chunk_dimsr); + } + + memspace = H5Screate_simple (rank,dimsr,NULL); + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, data_out); + printf("\n"); + printf("Dataset: \n"); + for (j = 0; j < dimsr[0]; j++) + { + for (i = 0; i < dimsr[1]; i++) + printf("%d ", data_out[j][i]); + printf("\n"); + } + + status = H5Pclose (cparms); + status = H5Dclose (dataset); + status = H5Sclose (filespace); + status = H5Sclose (memspace); + status = H5Fclose (file); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<P> +<UL> +<LI>The function H5Pcreate creates a new property as an instance of + a property list. The signature of this function is as follows: +<PRE> + hid_t H5Pcreate ( H5P_class_t type ) +</PRE> +<UL> +<LI>The parameter <I>type</I> is the type of property list to create.<BR> + The class types are: H5P_FILE_CREATE, H5P_FILE_ACCESS, H5P_DATASET_CREATE, + H5P_DATASET_XFER, and H5P_MOUNT +</UL> +<P> +<LI>The function H5Pset_chunk sets the size of the chunks used + to store a chunked layout dataset. + The signature of this function is as follows: +<PRE> + herr_t H5Pset_chunk ( hid_t plist, int ndims, const hsize_t * dim ) +</PRE> +<UL> +<LI>The first parameter, <I>plist</I>, is the identifier for the property + list to query. +<LI>The second parameter, <I>ndims</I>, is the number of dimensions of + each chunk. +<LI>The third parameter, <I>dim</I>, is an array containing the size of + each chunk. +</UL> +<P> +A non-negative value is returned if successful; otherwise a negative +value is returned. +<P> +<LI>The function H5Dextend extends a dataset that has an unlimited + dimension. The signature is as follows: +<PRE> + herr_t H5Dextend ( hid_t dataset_id, const hsize_t * size ) +</PRE> +<UL> +<LI>The first parameter, <I>dataset_id</I>, is the identifier of + the dataset. +<LI>The second parater, <I>size</I>, is an array containing the + new magnitude of each dimension. +</UL> +<P> +This function returns a non-negative value if successful; otherwise +it returns a negative value. +<P> +<LI>The H5Dget_create_plist function returns an identifier for a +copy of the dataset creation property list for a dataset. +<P> +<LI>The H5Pget_layout function returns the layout of the raw data for a +dataset. Valid types are H5D_COMPACT, H5D_CONTIGUOUS, and H5D_CHUNKED. +<P> +<LI>The H5Pget_chunk function retrieves the size of chunks for the +raw data of a chunked layout dataset. +The signature of this function is: +<PRE> + int H5Pget_chunk ( hid_t plist, int max_ndims, hsize_t * dims ) +</PRE> +<UL> +<LI>The first parameter, <I>plist</I>, is the identifier of the + property list to query. +<LI>The second parameter, <I>max_ndims</I>, is the size of the <I>dims</I> + array. +<LI>The third parameter, <I>dims</I>, is the array to store the chunk + dimensions +</UL> +<P> +<LI>The H5Pclose function terminates access to a property list. + The signature of this function is: +<PRE> + herr_t H5Pclose ( hid_t plist ) +</PRE> +where <I>plist</I> is the identifier of the property list to terminate +access to. +</UL> + + +<!-- +<A NAME="fc"> +<H3><U>File Contents</U></H3> +--> + + + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/fileorg.html b/doc/html/Tutor/fileorg.html new file mode 100644 index 0000000..03c2c29 --- /dev/null +++ b/doc/html/Tutor/fileorg.html @@ -0,0 +1,103 @@ +<HTML><HEAD> +<TITLE>HDF5 File Organization +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">HDF5 File Organization</FONT> +</BIG></BIG></BIG></H1> + + +<hr noshade size=1> + +<BODY> +<P> +An HDF5 file is a container for storing a variety of scientific data, and the +two primary HDF5 objects are groups and datasets. +<UL> + <LI><B>HDF5 group:</B> a grouping structure containing zero or more HDF5 + objects, together with supporting metadata. + + <LI><B>HDF5 dataset:</B> a multidimensional array of data elements, together + with supporting metadata. +</UL> +Any HDF5 group or dataset may have an associated attribute list. An HDF5 +attribute is a user-defined HDF5 structure that provides extra information +about an HDF5 object. +<P> +Working with groups and group members (datasets for example) is similar in many +ways to working with directories and files in UNIX. As with UNIX directories +and files, objects in an HDF5 file are often described by giving their full (or +absolute) path names. +<UL> + <CODE>/</CODE> signifies the root group.<BR> + <CODE>/foo</CODE> signifies a member of the root group called <I>foo</I>. +<BR> + <CODE>/foo/zoo</CODE> signifies a member of the group <I>foo</I>, which in + turn is a member of the root group. +</UL> +<P> +<!-- +In this tutorial, we consider: +<UL> +<LI>how to create a file +<LI>how to create a group +<LI>how to create/read/write datasets +<LI>how to create an attribute +<LI>how to create a grouping structure +<LI>how to create datasets in groups +</UL> +The rest of the tutorial is organized as follows: +<UL> + <LI> Section 3 describes the HDF5 APIs. + <LI> Section 4 shows how to create an HDF5 file. + <LI> Section 5 shows how to create a dataset. + <LI> Section 6 shows how to read from and write to a dataset. + <LI> Section 7 shows how to create an attribute. + <LI> Section 8 shows how to create a group. + <LI> Section 9 discusses HDF5 names and shows how to create groups using absolute and relative names. + <LI> Section 10 shows how to create datasets in groups. +</UL> + +Each section contains step by step instructions and an example. After the +example, an HDF5 tool is used to examine the file contents. A formal definition +of HDF5 objects in Backus-Naur Form is given last. + +The tutorial ends with a glossary and references. +--> +<P> + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: July 30, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/glossary.html b/doc/html/Tutor/glossary.html new file mode 100644 index 0000000..84a938d --- /dev/null +++ b/doc/html/Tutor/glossary.html @@ -0,0 +1,234 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Glossary +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Glossary</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<DL> +<DT><B>ATTRIBUTE</B> +<DD>An HDF5 attribute is a small dataset that can be used to describe + the nature and/or the intended usage of the object it is attached + to. + +<P> +<DT><B>BOOT BLOCK</B> +<DD>HDF5 files are composed of a "boot block" describing information required to portably access files on multiple platforms, followed by information +about the groups in a file and the datasets in the file. The boot block contains information about the size of offsets and lengths of objects, the +number of entries in symbol tables (used to store groups) and additional version information for the file. +<P> +<DT><B>DATASET</B> +<DD>An HDF5 dataset is a multi-dimensional array of data elements, + together with supporting metadata. + +<P> +<DT><B>DATASPACE</B> +<DD>An HDF5 dataspace is an object that describes the dimensionality + of the data array. A dataspace is either a regular N-dimensional + array of data points, called a simple dataspace, or a more + general collection of data points organized in another + manner, called a complex dataspace. + +<P> +<DT><B>DATA TYPE</B> +<DD>An HDF5 Data Type is an object that describes the type of the + element in an HDF5 multi-dimensional array. There are two + categories of datatypes: atomic and compound data types. An + atomic type is a type which cannot be decomposed into smaller + units at the API level. A compound is a collection of one or + more atomic types or small arrays of such types. + +<P> +<DT><B>DATASET CREATION PROPERTY LIST</B> +<DD> The Dataset Creation Property List contains information on how + raw data is organized on disk and how the raw data is compressed. + The dataset API partitions these terms by layout, compression, + and external storage: +<UL> +<B> Layout:</B> +<UL> +<LI> H5D_COMPACT: Data is small and can be stored in object header (not + implemented yet). This eliminates disk seek/read requests. +<LI> H5D_CONTIGUOUS: (<B>default</B>) The data is large, non-extendible, + non-compressible, non-sparse, and can be stored + externally. +<LI> H5D_CHUNKED: The data is large and can be extended in any dimension. + It is partitioned into chunks so each chunk is the same + logical size. +</UL> +<B>Compression:</B> (gzip compression)<BR> +<B>External Storage Properties:</B> The data must be contiguous to be stored + externally. It allows you to store the data + in one or more non-HDF5 files. + +</UL> + +<P> +<DT><B>DATA TRANSFER PROPERTY LIST</B> +<DD> The data transfer property list is used to control various aspects + of the I/O, such as caching hints or collective I/O information. +<P> +<DT><B>DDL</B> +<DD>DDL is a Data Description Language that describes HDF5 objects + in Backus-Naur Form. + +<P> + +<DT><B>FILE ACCESS MODES</B> +<DD>The file access modes determine whether an existing file will be +overwritten. All newly created files are opened for both reading and +writing. Possible values are: +<PRE> + H5F_ACC_RDWR: Allow read and write access to file. + H5F_ACC_RDONLY: Allow read-only access to file. + H5F_ACC_TRUNC: Truncate file, if it already exists, erasing all data + previously stored in the file. + H5F_ACC_EXCL: Fail if file already exists. + H5F_ACC_DEBUG: Print debug information. + H5P_DEFAULT: Apply default file access and creation properties. +</PRE> +<P> +<DT><B>FILE ACCESS PROPERTY LIST</B> + <DD> File access property lists are used to control different methods + of performing I/O on files: +<UL> +<B>Unbuffered I/O:</B> Local permanent files can be accessed with the functions + described in Section 2 of the Posix manual, namely open(), lseek(), read(), + write(), and close(). <BR> +<B>Buffered I/O:</B> Local permanent files can be accessed with the functions + declared in the stdio.h header file, namely fopen(), fseek(), fread(), + fwrite(), and fclose().<BR> +<B>Memory I/O:</B> Local temporary files can be created and accessed directly from + memory without ever creating permanent storage. The library uses malloc() + and free() to create storage space for the file<BR> +<B>Parallel Files using MPI I/O:</B> This driver allows parallel access to a file + through the MPI I/O library. The parameters which can be modified are the + MPI communicator, the info object, and the access mode. The communicator + and info object are saved and then passed to MPI_File_open() during file + creation or open. The access_mode controls the kind of parallel access the + application intends.<BR> +<B>Data Alignment:</B> Sometimes file access is faster if certain things are aligned + on file blocks. This can be controlled by setting alignment properties of + a file access property list with the H5Pset_alignment() function. +</UL> +<P> +<DT><B>FILE CREATION PROPERTY LIST</B> +<DD> The file creation property list is used to control the file + metadata. The parameters that can be modified are: +<UL> + <B>User-Block Size:</B> The "user-block" is a fixed length block of data located + at the beginning of the file which is ignored by the HDF5 library and may + be used to store any data information found to be useful to applications. +<BR> +<B> Offset and Length Sizes:</B> The number of bytes used to store the offset and + length of objects in the HDF5 file can be controlled with this parameter. + Symbol Table Parameters: The size of symbol table B-trees can be controlled + by setting the 1/2 rank and 1/2 node size parameters of the B-tree. +<BR> +<B> Indexed Storage Parameters:</B> The size of indexed storage B-trees can be + controlled by setting the 1/2 rank and 1/2 node size parameters of the + B-tree. +</UL> +<P> + +<DT><B>GROUP</B> +<DD>A Group is a structure containing zero or more HDF5 objects, + together with supporting metadata. The two primary HDF5 objects + are datasets and groups. +<P> + +<DT><B>HDF5</B> +<DD>HDF5 is an abbreviation for Hierarchical Data Format Version 5. + This file format is intended to make it easy to write and read + scientific data +<P> +<UL> + <LI> by including the information needed to understand the data + within the file +<P> + <LI> by providing a library of C, FORTRAN, and other language + programs that reduce the work required to provide efficient + writing and reading - even with parallel IO +</UL> +<P> + +<DT><B>HDF5 FILE</B> +<DD>An HDF5 file is a container for storing grouped collections + of multi-dimensional arrays containing scientific data. +<P> + +<DT><B>H5DUMP</B> +<DD>h5dump is an HDF5 tool that describes the HDF5 file contents in DDL. +<P> + +<DT><B>HYPERSLAB</B> +<DD> +A hyperslab is a portion of a dataset. A hyperslab selection can be a +logically contiguous collection of points in a dataspace, or it +can be a regular pattern of points or blocks in a dataspace. +<P> +<DT><B>NAMES</B> +<DD>HDF5 object names are a slash-separated list of components. A name + which begins with a slash is an absolute name which is accessed + beginning with the root group of the file while all other relative + names are accessed beginning with the specified group. +<P> +<DT><B>PARALLEL I/O (HDF5)</B> +<DD>The parallel I/O version of HDF5 supports parallel file access using +MPI (Message Passing Interface). +<P> + +<DT><B>THREADSAFE (HDF5)</B> +<DD>A "thread-safe" version of HDF-5 (TSHDF5) is one that can be called from any thread of a multi-threaded program. Any calls to HDF +can be made in any order, and each individual HDF call will perform correctly. A calling program does not have to explicitly lock the HDF +library in order to do I/O. Applications programmers may assume that the TSHDF5 guarantees the following: +<UL> + <LI> the HDF-5 library does not create or destroy threads. + <LI> the HDF-5 library uses modest amounts of per-thread private memory. + <LI> the HDF-5 library only locks/unlocks it's own locks (no locks are passed in or returned from HDF), and the internal locking is guaranteed to be deadlock free. +</UL> +<P> +These properties mean that the TSHDF5 library will not interfere with an application's use of threads. A TSHDF5 library is the same +library as regular HDF-5 library, with additional code to synchronize access to the HDF-5 library's internal data structures. + +</DL> + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: September 1, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/img001.gif b/doc/html/Tutor/img001.gif Binary files differnew file mode 100644 index 0000000..b79c6d6 --- /dev/null +++ b/doc/html/Tutor/img001.gif diff --git a/doc/html/Tutor/img002.gif b/doc/html/Tutor/img002.gif Binary files differnew file mode 100644 index 0000000..67585ef --- /dev/null +++ b/doc/html/Tutor/img002.gif diff --git a/doc/html/Tutor/img003.gif b/doc/html/Tutor/img003.gif Binary files differnew file mode 100644 index 0000000..ac1dcf9 --- /dev/null +++ b/doc/html/Tutor/img003.gif diff --git a/doc/html/Tutor/img004.gif b/doc/html/Tutor/img004.gif Binary files differnew file mode 100644 index 0000000..d48dbab --- /dev/null +++ b/doc/html/Tutor/img004.gif diff --git a/doc/html/Tutor/img005.gif b/doc/html/Tutor/img005.gif Binary files differnew file mode 100644 index 0000000..3383dc6 --- /dev/null +++ b/doc/html/Tutor/img005.gif diff --git a/doc/html/Tutor/index.html b/doc/html/Tutor/index.html new file mode 100644 index 0000000..15cfa5b --- /dev/null +++ b/doc/html/Tutor/index.html @@ -0,0 +1,29 @@ +<html> +<head> +<title>HDF5 Tutorial</title> +</head> + + +<frameset cols="110,*" border=0> + <frame src="Contents.html" scrolling="auto" name="BUTTONS"> + <frame src="title.html" scrolling="auto" name="CONTENT"> +</frameset> + +<noframes> + <b>HDF5 Tutorial</b> + <p> + If you are reading this message, your browser is not capable of + interpreting HTML frames. A no-frames version of the tutorial + is available by viewing the file <a href="title.html">title.html</a>. + <p> + If you owuld like to upgrade to a frames-capable browser, + we suggest upgrading to the most recent version of + Nestscape Communicator, Microsoft Internet Explorer, or + an equivalent browser. + <p> + In the meantime, you can view this tutorial by starting with the + file <a href="title.html">title.html</a>. +</noframes> + + +</html> diff --git a/doc/html/Tutor/intro.html b/doc/html/Tutor/intro.html new file mode 100644 index 0000000..abf664c --- /dev/null +++ b/doc/html/Tutor/intro.html @@ -0,0 +1,81 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Introduction +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<h1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Introduction</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +Welcome to the HDF5 Tutorial provided by the HDF User Support Group. +<P> +HDF5 is a file format and library for storing scientific data. +HDF5 was designed and implemented to address the deficiencies of HDF4.x. +It has a more powerful and flexible data model, supports files larger than 2 GB, +supports parallel I/O, and is thread-safe. For a short overview presentation +of the HDF5 data model, library and tools see: +<PRE> + <A HREF="http://hdf.ncsa.uiuc.edu/HDF5/HDF5_overview/index.htm">http://hdf.ncsa.uiuc.edu/HDF5/HDF5_overview/index.htm</A> +</PRE> +This tutorial covers the basic HDF5 data objects and file structure, +the HDF5 programming model and the API functions necessary for creating and +modifying data objects. It also introduces the available HDF5 tools to access +HDF5 files. +<P> +The examples used in this tutorial, along with a Makefile to compile them +can be found in <A HREF="./examples/">./examples/</A>. You can also download +a <A HREF="http://hdf.ncsa.uiuc.edu/training/other-ex5/examples.tar">tar +file</A> with the examples and Makefile. In +order to use the Makefile you may have to edit it and update the +compiler and compiler options, as well as the path for the HDF5 +binary distribution. +<P> +Please check the <A HREF="references.html">References</A> for where to find +other examples of HDF5 Programs. +<P> +We hope that the step-by-step examples and instructions will give you a quick +start with HDF5. +<P> +Please send your comments and suggestions to hdfhelp@ncsa.uiuc.edu. + + +</BODY> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: October 8, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/iterate.html b/doc/html/Tutor/iterate.html new file mode 100644 index 0000000..4cb0475 --- /dev/null +++ b/doc/html/Tutor/iterate.html @@ -0,0 +1,303 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Iterating over Group Members +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Iterating over Group Members</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#def">How to Iterate Over Group Members</A> + <LI>Programming Example +<UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> +<!-- + <LI> <A HREF="#fc">File Contents</A> + <LI> <A HREF="#ddl">Dataset Definition in DDL</A> +--> +</UL> +</UL> +<HR> +<A NAME="def"> +<H2>How to Iterate Over Group Members</H2> +This section discusses how to find names and object types of HDF5 group +members. +<P> +The HDF5 Group interface has a function, H5Giterate, to iterate over the +group members. +<P> +Operations on each group member can be performed during the iteration process. +The operator function and its data are passed to the iterator as parameters. +There are no restrictions on what kind of operations can be performed on +group members during the iteration procedure. +<P> +The following steps are involved: +<OL> + +<LI> Write an operator function which will be used during the iteration process. + The HDF5 library defines the operator function signature and return values. +<LI> Open the group to iterate through. +<LI> Use H5Giterate to iterate through the group or just a few members of + the group. +</OL> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +In this example we iterate through the members of the root group. The +operator function displays the members' names and their object types. +The object type can be a group, dataset, or named datatype. +[ <A HREF="examples/h5_iterate.c">Download h5_iterate.c</A> ] +<PRE> + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> + +#define FILE "iterate.h5" +#define FALSE 0 + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +herr_t file_info(hid_t loc_id, const char *name, void *opdata); + /* Operator function */ +int +main(void) { + hid_t file; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t dims[] = {SPACE1_DIM1}; + herr_t ret; /* Generic return value */ + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + + /* Create file */ + file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid = H5Screate_simple(SPACE1_RANK, dims, NULL); + + /* Create a group */ + group=H5Gcreate(file,"Group1",-1); + + /* Close a group */ + ret = H5Gclose(group); + + /* Create a dataset */ + dataset=H5Dcreate(file,"Dataset1",H5T_STD_U32LE,sid,H5P_DEFAULT); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create a datatype */ + tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + + /* Insert fields */ + ret=H5Tinsert (tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + + ret=H5Tinsert (tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + + ret=H5Tinsert (tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + + /* Save datatype for later */ + ret=H5Tcommit (file, "Datatype1", tid); + + /* Close datatype */ + ret = H5Tclose(tid); + + /* Iterate through the file to see members of the root group */ + + printf(" Objects in the root group are:\n"); + printf("\n"); + + H5Giterate(file, "/", NULL, file_info, NULL); + + /* Close file */ + ret = H5Fclose(file); + + return 0; +} + +/* + * Operator function. + */ +herr_t file_info(hid_t loc_id, const char *name, void *opdata) +{ + H5G_stat_t statbuf; + + /* + * Get type of the object and display its name and type. + * The name of the object is passed to this function by + * the Library. Some magic :-) + */ + H5Gget_objinfo(loc_id, name, FALSE, &statbuf); + switch (statbuf.type) { + case H5G_GROUP: + printf(" Object with name %s is a group \n", name); + break; + case H5G_DATASET: + printf(" Object with name %s is a dataset \n", name); + break; + case H5G_TYPE: + printf(" Object with name %s is a named datatype \n", name); + break; + default: + printf(" Unable to identify an object "); + } + return 0; + } + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +The output of this program is: +<PRE> + Objects in the root group are: + + Object with name Dataset1 is a dataset + Object with name Datatype1 is a named datatype + Object with name Group1 is a group ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<P> +<UL> +<LI> The operator function in this example is called <I>file_info</I>. + The signature of the operator function is as follows: +<PRE> + herr_t *(H5G_operator_t) (hid_group_id, const char* name, void *operator_data) +</PRE> +<UL> + <LI>The first parameter is a group identifier for the group being iterated + over. It is passed to the operator by the iterator function, H5Giterate. + <LI> The second parameter is the name of the current object. The name is + passed to the operator function by the HDF5 library. + <LI> The third parameter is the operator data. It is passed to and from + the operator by the iterator, H5Giterate. + + The operator function in this example just prints the name and type + of the current object and then exits. + + This information can also be used to open the object and perform + different operations or queries. For example a named datatype object's + name can be used to open the datatype and query its properties. +</UL> +<P> + The operator return value defines the behavior of the iterator. + <UL> + <LI>A zero return value causes the iterator to continue, returning + zero when all group members have been processed. + <LI>A positive value causes the iterator to immediately return that + value, indicating a short-circuit success. The iterator can be restarted + at the next group member. + <LI>A negative value causes the iterator to immediately return that value, + indicating failure. The iterator can be restarted at the next group + member. + </UL> +<P> + In this example the operator function returns 0, which causes the iterator + to continue and go through all group members. +<P> +<LI>The function H5Gget_objinfo is used to determine the type of the object. + It also returns the modification time, number of hard links, and some + other information. +<P> + The signature of this function is as follows: +<PRE> + herr_t H5Gget_objinfo(hid_t loc_id, const char * name, hbool_t follow_link, + H5G_stat_t *statbuf) +</PRE> +<UL> + <LI> The first two arguments specify the object by its location and name. + This example uses the group identifier and name relative to the group + to specify the object. + <LI> The third argument is a flag which indicates whether a + symbolic link should be followed or not. A zero value indicates + that information should be returned for the link itself, but not + about the object it points to. + The root group in this example does not have objects that are + links, so this flag is not important for our example. + <LI> The fourth argument is a buffer to return information in. + Type information is returned into the field "type" of the + H5G_stat_t data structure (statbuf.type). Possible values are: + H5G_GROUP, H5G_DATASET, H5G_TYPE, and H5G_LINK. +</UL> +<P> +<LI> The H5Giterate function has the following signature: +<PRE> + int H5Giterate(hid_t loc_id, const char *name , idx, + H5G_operator_t operator, void * operator_data) +</PRE> +<UL> + <LI> The first parameter is the group for the group being iterated over. + <LI> The second parameter is the group name. + <LI> The third parameter specifies that iteration begins with the + <I>idx</I> object in the group and the next element to be processed + is returned in the <I>idx</I> parameter. In our example NULL is + used to start at the first group member. Since no stopping point + is returned in this case, the iterator cannot be restarted if one + of the calls to its operator returns a non-zero value. + <LI> The fourth parameter is an operator function. + <LI> The fifth argument is the operator data. We used NULL since no + data was passed to and from the operator. +</UL> +</UL> + +<!-- +<A NAME="fc"> +<H3><U>File Contents</U></H3> +--> + + + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/mount.html b/doc/html/Tutor/mount.html new file mode 100644 index 0000000..9d0e494 --- /dev/null +++ b/doc/html/Tutor/mount.html @@ -0,0 +1,304 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Mounting Files +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Mounting Files</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">Mounting Files</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> +<!-- + <LI> <A HREF="#fc">File Contents</A> +--> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>Mounting Files</H2> + +HDF5 allows you to combine two or more HDF5 files in a manner similar to mounting +files in UNIX. The group structure and metadata from one file appear as though +they exist in another file. The following steps are involved: +<OL> +<LI>Open the files. + +<LI>Choose the "mount point" in the first file (parent). The "mount point" in + HDF5 is a group ( it can also be the root group ). + +<LI>Use the HDF5 API function H5Fmount to mount the second file (child) in + the first one. + +<LI>Work with the objects in the second file as if they were members of + the "mount point" group in the first file. The previous contents of + the "mount point" group are temporarily hidden. + +<LI>Unmount the second file using the H5Funmount function when the work is done. +</OL> + +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> + +In the following example we create one file with a group in it, and another +file with a dataset. Mounting is used to access the dataset from the second +file as a member of a group in the first file. The following picture +illustrates this concept. +<PRE> + + 'FILE1' 'FILE2' + +-------------------- -------------------- +! ! ! ! +! / ! ! / ! +! | ! ! | ! +! | ! ! | ! +! V ! ! V ! +! -------- ! ! ---------- ! +! ! Group ! ! ! ! Dataset! ! +! --------- ! ! ---------- ! +!------------------! !------------------! +</PRE> +After mounting the second file, 'FILE2', under the group in the file, 'FILE1', +the parent has the following structure: +<PRE> + + 'FILE1' + + -------------------- + ! ! + ! / ! + ! | ! + ! | ! + ! V ! + ! -------- ! + ! ! Group ! ! + ! --------- ! + ! | ! + ! | ! + ! V ! + ! ----------- ! + ! ! Dataset ! ! + ! !---------- ! + ! ! + !------------------! + +</PRE> +[ <A HREF="examples/h5_mount.c">Download h5_mount.c</A> ] +<PRE> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include<hdf5.h> + +#define FILE1 "mount1.h5" +#define FILE2 "mount2.h5" + +#define RANK 2 +#define NX 4 +#define NY 5 + +int main(void) +{ + + hid_t fid1, fid2, gid; /* Files and group identifiers */ + hid_t did, tid, sid; /* Dataset and datatype identifiers */ + + herr_t status; + hsize_t dims[] = {NX,NY}; /* Dataset dimensions */ + + int i, j; + int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */ + + /* + * Initialization of buffer matrix "bm" + */ + for(i =0; i < NX; i++) { + for(j = 0; j < NY; j++) + bm[i][j] = i + j; + } + + /* + * Create first file and a group in it. + */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + gid = H5Gcreate(fid1, "/G", 0); + + /* + * Close group and file + */ + H5Gclose(gid); + H5Fclose(fid1); + + /* + * Create second file and dataset "D" in it. + */ + fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + dims[0] = NX; + dims[1] = NY; + sid = H5Screate_simple(RANK, dims, NULL); + did = H5Dcreate(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT); + + /* + * Write data to the dataset. + */ + status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm); + + /* + * Close all identifiers. + */ + H5Sclose(sid); + H5Dclose(did); + H5Fclose(fid2); + + /* + * Reopen both files + */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT); + + /* + * Mount second file under G in the first file. + */ + H5Fmount(fid1, "/G", fid2, H5P_DEFAULT); + + /* + * Access dataset D in the first file under /G/D name. + */ + did = H5Dopen(fid1,"/G/D"); + tid = H5Dget_type(did); + status = H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm_out); + + /* + * Print out the data. + */ + for(i=0; i < NX; i++){ + for(j=0; j < NY; j++) + printf(" %d", bm_out[i][j]); + printf("\n"); + } + + /* + * Close all identifers + */ + H5Tclose(tid); + H5Dclose(did); + + /* + * Unmounting second file + */ + H5Funmount(fid1, "/G"); + + /* + * Close both files + */ + H5Fclose(fid1); + H5Fclose(fid2); + + return 0; +} +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> The first part of the program creates a group in one file and creates + and writes a dataset to another file. +<P> +<LI> Both files are reopened with the H5F_ACC_RDONLY access flag since no + objects will be modified. The child should be opened with H5F_ACC_RDWR if + the dataset is to be modified. +<P> +<LI> The second file is mounted in the first using the H5Fmount function. +<PRE> + herr_t H5Fmount(hid_t loc_id, const char *name, hid_t file_id, hid_t plist_id) +</PRE> +<UL> + <LI> The first two arguments specify the location of the "mount point" + ( a group ). In this example the "mount point" is a group "/G" in the + file specified by its handle <I>fid1</I>. Since group G is in the root + group of the first file, one can also use just "G" to identify it. +<P> + Below is a description of another scenario:<BR> + Suppose group G was a member of group D in the first file (<I>fid1</I>). + Then mounting point G can be specified in two different ways: +<P> +<UL> + <LI> <I>loc_id</I> is <I>fid1</I><BR> + <I>name</I> is "D/G" +<P> + <LI> <I>loc_id</I> is an identifier of the group "D"<BR> + <I>name</I> is just "G" +</UL> + <P> + <LI> The third argument is an identifier of the file which will be mounted. + Only one file can be mounted per "mount point". +<P> + <LI> The fourth argument is an identifier of the property list to be used. + Currently, only the default property list, H5P_DEFAULT, can be used. +</UL> +<P> +<LI> In this example we just read data from the dataset D. One can modify + data also. If the dataset is modified while the file is mounted, it becomes + modified in the original file too after the file is unmounted. +<P> +<LI> The file is unmounted with the H5Funmount function: +<PRE> + herr_t H5Funmount(hid_t loc_id, const char *name) +</PRE> + Arguments to this function specify the location of the "mount point". + In our example <I>loc_id</I> is an identifier of the first file, and + <I>name</I> is the name of group G, "/G". One could also use "G" + instead of "/G" since G is a member of the root group in the file + <I>fid1</I>. Notice that H5Funmount does not close files. They are closed + with the respective calls to the H5Fclose function. Closing the parent + automatically unmounts the child. +<P> +<LI>The h5dump utility cannot display files in memory, therefore no output + of FILE1 after FILE2 was mounted is provided. +</UL> +</UL> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/questions.html b/doc/html/Tutor/questions.html new file mode 100644 index 0000000..26153f3 --- /dev/null +++ b/doc/html/Tutor/questions.html @@ -0,0 +1,142 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Introductory Topics Questions +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Introductory Topics Questions</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> +<PRE> + + +Section 2: HDF File Organization +================================ + +1. Name and describe the two primary objects that can be stored in an HDF5 + file: + +2. What is an attribute? + +3. Give the path name for an object called "harry" that is a member of a + group called "dick," which in turn is a member of the root group. + + +Section 3: The HDF5 API +======================= + +Describe the purpose of each of the following HDF5 APIs: + +H5A, H5D, H5E, F5F, H5G, H5T, H5Z + + + +Section 4: Creating an HDF File +=============================== + +1. What two HDF5 routines must be called in order to create an HDF5 file? + +2. What include file must be included in any file that uses the HDF5 library. + +3. An HDF5 file is never completely empty because as soon as an HDF5 file + is created, it automatically contains a certain primary object. What is + that object? + + + +Section 5: Creating a Dataset +============================= + +1. Name and describe two major datatype categories. + +2. List the HDF5 atomic datatypes. Give an example of a predefined datatype. + +3. What does the dataspace describe? What are the major characteristics of the + simple dataspace? + +4. What information needs to be passed to the H5Dcreate function, i.e. + what information is needed to describe a dataset at creation time? + + +Section 6: Reading from/Writing to a Dataset +============================================ + +1. What are six pieces of information which need to be specified for + reading and writing a dataset? + +2. Why are both the memory dataspace and file dataspace needed for + read/write operations, but only the memory datatype is specified for the + datatype? + +3. What does the line DATASPACE { SIMPLE (4 , 6 ) / ( 4 , 6 ) } in Fig 6.1 + means? + + +Section 7: Creating an Attribute +================================ + +1. What is an attribute? + +2. Can partial I/O operations be performed on attributes? + + +Section 8: Creating a Group +=========================== + +What are the two primary objects that can be included in +a group? + + +Section 9: Creating Groups using Absolute/Relative Names +======================================================== + +1. Group names can be specified in two "ways". What are these + two types of group names that you can specify? + +2. You have a dataset named "moo" in the group "boo", which is + in the group "foo", which in turn, is in the root group. How would + you specify an absolute name to access this dataset? + + +Section 10: Creating Datasets in Groups +======================================= + +Describe a way to access the dataset "moo" described in the previous section +(Section 9, question 2), using a relative and absolute pathname. + +</PRE> +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 2, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/rdwt.html b/doc/html/Tutor/rdwt.html new file mode 100644 index 0000000..1eb1a84 --- /dev/null +++ b/doc/html/Tutor/rdwt.html @@ -0,0 +1,259 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Reading to/Writing from a Dataset +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Reading to/Writing from a Dataset</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#rdwr">Reading to/Writing from a Dataset</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description </A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + </UL> + </UL> +<HR> +<A NAME="rdwr"> +<H2>Reading to/Writing from a Dataset</h2> +<P> +During a dataset I/O operation, the library transfers raw data between memory +and the file. The memory can have a data type different than the file data type +and can also be a different size (memory is a subset of the dataset elements, +or vice versa). Therefore, to perform read or write operations, the application +program must specify: +<UL> + <LI> The dataset + + <LI> The dataset's data type in memory + + <LI> The dataset's dataspace in memory + + <LI> The dataset's dataspace in the file + + <LI> The transfer properties (The data transfer properties control various + aspects of the I/O operations like the number of processes participating + in a collective I/O request or hints to the library to control caching of + raw data. In this tutorial, we use the default transfer properties.) + + <LI> The data buffer +</UL> + + +<P> +The steps to read to/write from a dataset are +as follows: +<OL> + <LI> Obtain the dataset identifier. + <LI> Specify the memory data type. + <LI> Specify the memory dataspace. + <LI> Specify the file dataspace. + <LI> Specify the transfer properties. + <LI> Perform the desired operation on the dataset. + <LI> Close the dataset. + <LI> Close the dataspace/data type, and property list if necessary. +</OL> + +To read to/write from a dataset, the calling program must contain the following call: +<PRE> + H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, + xfer_plist_id, buf ); +</PRE> + or +<PRE> + H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, + xfer_plist_id, buf); +</PRE> + + +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +The following example shows how to read and write an existing dataset. +It opens the file created in the previous example, obtains the dataset +identifier, +<I>/dset</I>, writes the dataset to the file, then reads the dataset back from +memory. It then closes the dataset and file. <BR> +[ <A HREF="examples/h5_rdwt.c">Download h5_rdwt.c</A> ] + +<PRE> + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> +#define FILE "dset.h5" + +main() { + + hid_t file_id, dataset_id; /* identifiers */ + herr_t status; + int i, j, dset_data[4][6]; + + /* Initialize the dataset. */ + for (i = 0; i < 4; i++) + for (j = 0; j < 6; j++) + dset_data[i][j] = i * 6 + j + 1; + + /* Open an existing file. */ + file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open an existing dataset. */ + + dataset_id = H5Dopen(file_id, "/dset"); + + /* Write the dataset. */ + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset_data); + + status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + dset_data); + + /* Close the dataset. */ + status = H5Dclose(dataset_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI> H5Fopen opens an existing file and returns a file identifier. +<PRE> + hid_t H5Fopen (const char *name, unsigned flags, hid_t access_id) +</PRE> +<UL> + <LI> The first argument is the file name. + + <LI> The second argument is the file access mode. H5F_ACC_RDWR allows a file + to be read from and written to. + + <LI> The third parameter is the identifier for the file access property list. + H5P_DEFAULT specifies the default file access property list. +</UL> +<P> +<LI> H5Dopen opens an existing dataset with the name specified by the second + argument at the location specified by the first parameter, and returns an + identifier. +<PRE> + hid_t H5Dopen (hid_t loc_id, const char *name) +</PRE> +<P> +<LI> H5Dwrite writes raw data from an application buffer to the specified + dataset, converting from the data type and data space of the dataset in + memory to the data type and data space of the dataset in the file. +<PRE> + herr_t H5Dwrite (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_plist_id, const void * buf) +</PRE> +<UL> + <LI> The first parameter is the identifier of the dataset. + + <LI> The second parameter is the identifier of the dataset's datatype in + memory. H5T_NATIVE_INT is an integer data type for the machine on which + the library was compiled. + + <LI> The third parameter is the identifier of the dataset's dataspace in + memory. H5S_ALL indicates that the dataset's dataspace in memory is the + same as that in the file. + + <LI> The fourth parameter is the identifier of the dataset's dataspace in the + file. H5S_ALL indicates that the entire dataspace of the dataset in the + file is referenced. + + <LI> The fifth parameter is the identifier of the data transfer propery list. + H5P_DEFAULT indicates that the default data transfer property list is used. + + <LI> The last parameter is the data buffer. +</UL> +<P> +<LI> H5Dread reads raw data from the specified dataset to an application buffer, + converting from the file datatype and dataspace to the memory datatype and + dataspace. +<PRE> + herr_t H5Dread (hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_plist_id, void * buf) +</PRE> +<UL> + <LI> The first parameter is the identifier of the dataset read from. + + <LI> The second parameter is the identifier of the dataset's memory datatype. + + <LI> The third parameter is the identifier of the dataset's memory dataspace. + + <LI> The fourth parameter is the identifier of the dataset's file dataspace. + + <LI> The fifth parameter is the identifier of the data transfer propery list. + + <LI> The last parameter is the data buffer. +</UL> +</OL> + +<A NAME="fc"> +<H3><U>File Contents</U></H3> +Figure 6.1 shows the contents of 'dset.h5'. +<P> + <B>Fig. 6.1</B> <I>'dset.h5' in DDL</I> +<PRE> + HDF5 "dset.h5" { + GROUP "/" { + DATASET "dset" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 4, 6 ) / ( 4, 6 ) } + DATA { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24 + } + } + } + } +</PRE> + + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/references.html b/doc/html/Tutor/references.html new file mode 100644 index 0000000..ca73587 --- /dev/null +++ b/doc/html/Tutor/references.html @@ -0,0 +1,65 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - References +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">References</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<UL> + <LI><B>HDF Home Page:</B> + <A HREF="http://hdf.ncsa.uiuc.edu/">http://hdf.ncsa.uiuc.edu/</A> +<P> + <LI><B>HDF5 Home Page and Documentation:</B> + <A HREF="http://hdf.ncsa.uiuc.edu/HDF5/">http://hdf.ncsa.uiuc.edu/HDF5/</A> +<P> + <LI><B>HDF5 DDL:</B> + <A HREF="http://hdf.ncsa.uiuc.edu/HDF5/doc/ddl.html">http://hdf.ncsa.uiuc.edu/HDF5/doc/ddl.html</A> +<P> + <LI><B>Introduction to HDF5:</B> + <A HREF="http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html">http://hdf.ncsa.uiuc.edu/HDF5/doc/H5.intro.html</A> <BR> +Overview of HDF5 with example programs. +<P> + <LI><B>Other Miscellaneous HDF5 Example Programs:</B> + <A HREF="http://hdf.ncsa.uiuc.edu/training/other-ex5/">http://hdf.ncsa.uiuc.edu/training/other-ex5/</A> +</UL> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: September 28, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/reftoobj.html b/doc/html/Tutor/reftoobj.html new file mode 100644 index 0000000..43a6375 --- /dev/null +++ b/doc/html/Tutor/reftoobj.html @@ -0,0 +1,478 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - References to Objects +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<h1> +<BIG><BIG><BIG><FONT COLOR="#c101cd"> References to Objects</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#def">References to Objects</A> + <LI> <A HREF="#def1">Creating and Storing References to Objects</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc1">Description</A> + <LI> <A HREF="#rem1">Remarks</A> + <LI> <A HREF="#fc1">File Contents</A> + </UL> + <LI> <A HREF="#def2">Reading References and Accessing Objects Using + References</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc2">Description</A> + <LI> <A HREF="#rem2">Remarks</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>References to Objects</H2> +In HDF5, objects (i.e. groups, datasets, and named data types) are usually +accessed by name. This access method was discussed in previous sections. +There is another way to access stored objects - by reference. +<P> +An object reference is based on the relative file address of the object header +in the file and is constant for the life of the object. Once a reference to +an object is created and stored in a dataset in the file, it can be used +to dereference the object it points to. References are handy for creating +a file index or for grouping related objects by storing references to them in +one dataset. +<P> +<A NAME="def1"> +<H2>Creating and Storing References to Objects</H2> +The following steps are involved in creating and storing file references +to objects: +<OL> +<LI> Create the objects or open them if they already exist in the file. +<P> +<LI> Create a dataset to store the objects' references. +<P> +<LI> Create and store references to the objects in a buffer. +<P> +<LI> Write a buffer with the references to the dataset. +</OL> + + +<H2> Programming Example</H2> +<A NAME="desc1"> +<H3><U>Description</U></H3> +The example below creates a group and two datasets and a named data type in the +group. References to these four objects are stored in the dataset in the root +group. [<A HREF="examples/h5_ref2objw.c">Download h5_ref2objw.c</A>] +<PRE> + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <hdf5.h> + +#define FILE1 "trefer1.h5" + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* 2-D dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +int +main(void) { + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hobj_ref_t *wbuf; /* buffer to write to disk */ + int *tu32; /* Temporary pointer to int data */ + int i; /* counting variables */ + const char *write_comment="Foo!"; /* Comments for group */ + herr_t ret; /* Generic return value */ + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + + /* Allocate write buffers */ + wbuf=(hobj_ref_t *)malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + tu32=malloc(sizeof(int)*SPACE1_DIM1); + + /* Create file */ + fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + + /* Create a group */ + group=H5Gcreate(fid1,"Group1",-1); + + /* Set group's comment */ + ret=H5Gset_comment(group,".",write_comment); + + /* Create a dataset (inside Group1) */ + dataset=H5Dcreate(group,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT); + + for(i=0; i < SPACE1_DIM1; i++) + tu32[i] = i*3; + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tu32); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create another dataset (inside Group1) */ + dataset=H5Dcreate(group,"Dataset2",H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Create a datatype to refer to */ + tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + + /* Insert fields */ + ret=H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT); + + ret=H5Tinsert (tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); + + ret=H5Tinsert (tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT); + + /* Save datatype for later */ + ret=H5Tcommit (group, "Datatype1", tid1); + + /* Close datatype */ + ret = H5Tclose(tid1); + + /* Close group */ + ret = H5Gclose(group); + + /* Create a dataset to store references */ + dataset=H5Dcreate(fid1,"Dataset3",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT); + + /* Create reference to dataset */ + ret = H5Rcreate(&wbuf[0],fid1,"/Group1/Dataset1",H5R_OBJECT,-1); + + /* Create reference to dataset */ + ret = H5Rcreate(&wbuf[1],fid1,"/Group1/Dataset2",H5R_OBJECT,-1); + + /* Create reference to group */ + ret = H5Rcreate(&wbuf[2],fid1,"/Group1",H5R_OBJECT,-1); + + /* Create reference to named datatype */ + ret = H5Rcreate(&wbuf[3],fid1,"/Group1/Datatype1",H5R_OBJECT,-1); + + /* Write selection to disk */ + ret=H5Dwrite(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); + + /* Close disk dataspace */ + ret = H5Sclose(sid1); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Close file */ + ret = H5Fclose(fid1); + free(wbuf); + free(tu32); + return 0; +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem1"> +<H3><U>Remarks</U></H3> + +<UL> +<LI> The following code, +<PRE> + dataset = H5Dcreate ( fid1,"Dataset3",H5T_STD_REF_OBJ,sid1,H5P_DEFAULT ); +</PRE> + creates a dataset to store references. Notice that the H5T_SDT_REF_OBJ + data type is used to specify that references to objects will be + stored. The data type H5T_STD_REF_DSETREG is used to store the dataset + region references and will be discussed later in this tutorial. +<P> +<LI>The next few calls to the H5Rcreate function create references to the +objects and store them in the buffer <I>wbuf</I>. The signature of the +H5Rcreate function is: +<PRE> + herr_t H5Rcreate ( void* buf, hid_t loc_id, const char *name, + H5R_type_t ref_type, hid_t space_id ) +</PRE> +<UL> + <LI> The first argument specifies the buffer to store the reference. + <LI> The second and third arguments specify the name of the referenced + object. In our example, the file identifier <I>fid1</I> and + absolute name of the dataset "/Group1/Dataset1" were used to + identify the dataset. One could also use the group identifier + of group "Group1" and the relative name of the dataset "Dataset1" + to create the same reference. + <LI> The fourth argument specifies the type of the reference. Our example + uses references to the objects (H5R_OBJECT). Another type of + reference, reference to the dataset region ( H5R_DATASET_REGION), + will be discussed later in this tutorial. + <LI> The fifth argument specifies the space identifier. When references + to the objects are created it should be set to -1. +</UL> +<P> +<LI>The H5Dwrite function writes a dataset with the references to the file. + Notice that the H5T_SDT_REF_OBJ data type is used to describe the + dataset's memory data type. +<P> +</UL> +<A NAME="fc1"> +<H3><U>File Contents</U></H3> +The contents of the "trefer1.h5" file created by this example are as follows: +<PRE> + Fig "trefer1.h5" +============================================================================== + +HDF5 "trefer1.h5" { +GROUP "/" { + DATASET "Dataset3" { + DATATYPE { H5T_REFERENCE } + DATASPACE { SIMPLE ( 4 ) / ( 4 ) } + DATA { + DATASET 0:1696, DATASET 0:2152, GROUP 0:1320, DATATYPE 0:2268 + } + } + GROUP "Group1" { + DATASET "Dataset1" { + DATATYPE { H5T_STD_U32LE } + DATASPACE { SIMPLE ( 4 ) / ( 4 ) } + DATA { + 0, 3, 6, 9 + } + } + DATASET "Dataset2" { + DATATYPE { H5T_STD_U8LE } + DATASPACE { SIMPLE ( 4 ) / ( 4 ) } + DATA { + 0, 0, 0, 0 + } + } + DATATYPE "Datatype1" { + H5T_STD_I32BE "a"; + H5T_STD_I32BE "b"; + H5T_IEEE_F32BE "c"; + } + } +} +} +=============================================================================== +</PRE> +Notice how the data in dataset "Dataset3" is described. The two numbers +with the colon in between represent a unique identifier of the object. These +numbers are constant for the life of the object. + + +<A NAME="def2"> +<H2>Reading References and Accessing Objects Using References</H2> + +The following steps are involved: +<OL> +<LI> Open the dataset with the references and read them. The H5T_STD_REF_OBJ + data type must be used to describe the memory data type. +<P> +<LI> Use the read reference to obtain the identifier of the object the + reference points to. +<P> +<LI> Open the dereferenced object and perform the desired operations. +<P> +<LI> Close all objects when the task is complete. +</OL> + +<H2> Programming Example</H2> +<A NAME="desc2"> +<H3><U>Description</U></H3> +The example below opens and reads dataset "Dataset3" from the file created +previously. Then the program dereferences the references to +dataset "Dataset1", the group and the named data type, and opens those objects. +The program reads and displays the dataset's data, the group's comment and +the number of members of the compound data type. +[ <A HREF="examples/h5_ref2objr.c">Download h5_ref2objr.c</A> ] + +<PRE> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <stdlib.h> +#include <hdf5.h> + +#define FILE1 "trefer1.h5" + +/* dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t group; /* Group ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hobj_ref_t *rbuf; /* buffer to read from disk */ + int *tu32; /* temp. buffer read from disk */ + int i; /* counting variables */ + char read_comment[10]; + herr_t ret; /* Generic return value */ + + /* Allocate read buffers */ + rbuf = malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + tu32 = malloc(sizeof(int)*SPACE1_DIM1); + + /* Open the file */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open the dataset */ + dataset=H5Dopen(fid1,"/Dataset3"); + + /* Read selection from disk */ + ret=H5Dread(dataset,H5T_STD_REF_OBJ,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + + /* Open dataset object */ + dset2 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[0]); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + + ret=H5Sget_simple_extent_npoints(sid1); + + /* Read from disk */ + ret=H5Dread(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,tu32); + printf("Dataset data : \n"); + for (i=0; i < SPACE1_DIM1 ; i++) printf (" %d ", tu32[i]); + printf("\n"); + printf("\n"); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + + /* Open group object */ + group = H5Rdereference(dataset,H5R_OBJECT,&rbuf[2]); + + /* Get group's comment */ + ret=H5Gget_comment(group,".",10,read_comment); + printf("Group comment is %s \n", read_comment); + printf(" \n"); + /* Close group */ + ret = H5Gclose(group); + + /* Open datatype object */ + tid1 = H5Rdereference(dataset,H5R_OBJECT,&rbuf[3]); + + /* Verify correct datatype */ + { + H5T_class_t tclass; + + tclass= H5Tget_class(tid1); + if ((tclass == H5T_COMPOUND)) + printf ("Number of compound datatype members is %d \n", H5Tget_nmembers(tid1)); + printf(" \n"); + } + + /* Close datatype */ + ret = H5Tclose(tid1); + + /* Close Dataset */ + ret = H5Dclose(dataset); + + /* Close file */ + ret = H5Fclose(fid1); + + /* Free memory buffers */ + free(rbuf); + free(tu32); + return 0; +} +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +Following is the output of this program: +<PRE> + +Dataset data : + 0 3 6 9 + +Group comment is Foo! + +Number of compound datatype members is 3 +</PRE> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +<A NAME="rem2"> +<H3><U>Remarks</U></H3> + +<UL> +<LI> The H5Dread function was used to read dataset "Dataset3" containing the + references to the objects. The H5T_STD_REF_OBJ memory data type was + used to read references to memory. +<P> +<LI> H5Rdereference obtains the object's identifier. The signature of this + function is: +<PRE> + hid_t H5Rdereference (hid_t datatset, H5R_type_t ref_type, void *ref) +</PRE> + <UL> + <LI> The first argument is an identifier of the dataset with the references. + <LI> The second argument specifies the reference type. We used + H5R_OBJECT to + specify a reference to an object. Another type is + H5R_DATASET_REGION to specify a reference to a dataset region. + This will be discussed later in this tutorial. + <LI> The third argument is a buffer to store the reference to be read. + <LI> The function returns an identifier of the object the reference + points to. In our simplified situation we know what type was + stored in the dataset. When the type of the object is unknown, then + H5Rget_object_type should be used to identify the type of object + the reference points to. + </UL> +</UL> + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/reftoreg.html b/doc/html/Tutor/reftoreg.html new file mode 100644 index 0000000..37940bf --- /dev/null +++ b/doc/html/Tutor/reftoreg.html @@ -0,0 +1,545 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - References to Dataset Regions +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + +[ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1><BIG><BIG><BIG><FONT COLOR="#c101cd"> References to Dataset Regions</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">References to Dataset Regions</A> + <LI> <A HREF="#def1">Creating and Storing References to Dataset Regions</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc1">Description</A> + <LI> <A HREF="#rem1">Remarks</A> + <LI> <A HREF="#fc1">File Contents</A> + </UL> + <LI> <A HREF="#def2">Reading References to Dataset Regions</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc2">Description</A> + <LI> <A HREF="#rem2">Remarks</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>References to Dataset Regions</H2> +Previously you learned about creating, reading, and writing +dataset selections. Here you will learn how to store dataset +selections in a file, and how to read them back using references +to the dataset regions. +<P> +A dataset region reference points to the dataset selection by storing the +relative file address of the dataset header and the global heap offset of +the referenced selection. The selection referenced is located by retrieving +the coordinates of the areas in the selection from the global heap. This +internal mechanism of storing and retrieving dataset selections is transparent +to the user. A reference to the dataset selection ( region ) is constant for +the life of the dataset. +<A NAME="def1"> +<H2>Creating and Storing References to Dataset Regions</H2> +The following steps are involved in creating and storing references to +the dataset regions: +<OL> + +<LI> Create a dataset to store the dataset regions (selections). +<P> +<LI> Create selections in the dataset(s). Dataset(s) should already exist in the + file. +<P> +<LI> Create references to the selections and store them in a buffer. +<P> +<LI> Write references to the dataset regions in the file. +<P> +<LI> Close all objects. +</OL> + +<H2> Programming Example</H2> +<A NAME="desc1"> +<H3><U>Description</U></H3> +The example below creates a dataset in the file. Then it creates a +dataset to store references to the dataset regions (selections). +The first selection is a 6 x 6 hyperslab. The second selection is a point +selection in the same dataset. +References to both selections are created and stored in the buffer, and then +written to the dataset in the file. + +[<A HREF="examples/h5_ref2regw.c">Download h5_ref2regw.c</A>] +<PRE> + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +#include <stdlib.h> +#include <hdf5.h> + +#define FILE2 "trefer2.h5" +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* Dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +/* Element selection information */ +#define POINT1_NPOINTS 10 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; + /* Coordinates for point selection */ + hdset_reg_ref_t *wbuf; /* buffer to write to disk */ + int *dwbuf; /* Buffer for writing numeric data to disk */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ + + + /* Allocate write & read buffers */ + wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + dwbuf=malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2); + + /* Create file */ + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create dataspace for datasets */ + sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); + + /* Create a dataset */ + dset2=H5Dcreate(fid1,"Dataset2",H5T_STD_U8LE,sid2,H5P_DEFAULT); + + for(i=0; i < SPACE2_DIM1*SPACE2_DIM2; i++) + dwbuf[i]=i*3; + + /* Write selection to disk */ + ret=H5Dwrite(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf); + + /* Close Dataset */ + ret = H5Dclose(dset2); + + /* Create dataspace for the reference dataset */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + + /* Create a dataset */ + dset1=H5Dcreate(fid1,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT); + + /* Create references */ + + /* Select 6x6 hyperslab for first reference */ + start[0]=2; start[1]=2; + stride[0]=1; stride[1]=1; + count[0]=6; count[1]=6; + block[0]=1; block[1]=1; + ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); + + /* Store first dataset region */ + ret = H5Rcreate(&wbuf[0],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); + + /* Select sequence of ten points for second reference */ + coord1[0][0]=6; coord1[0][1]=9; + coord1[1][0]=2; coord1[1][1]=2; + coord1[2][0]=8; coord1[2][1]=4; + coord1[3][0]=1; coord1[3][1]=6; + coord1[4][0]=2; coord1[4][1]=8; + coord1[5][0]=3; coord1[5][1]=2; + coord1[6][0]=0; coord1[6][1]=4; + coord1[7][0]=9; coord1[7][1]=0; + coord1[8][0]=7; coord1[8][1]=1; + coord1[9][0]=3; coord1[9][1]=3; + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + + /* Store second dataset region */ + ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); + + /* Write selection to disk */ + ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); + + /* Close all objects */ + ret = H5Sclose(sid1); + ret = H5Dclose(dset1); + ret = H5Sclose(sid2); + + /* Close file */ + ret = H5Fclose(fid1); + + free(wbuf); + free(dwbuf); + return 0; +} + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem1"> +<H3><U>Remarks</U></H3> +<UL> +<LI> The code, +<PRE> + dset1=H5Dcreate(fid1,"Dataset1",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT); +</PRE> + creates a dataset to store references to the dataset(s) regions(selections). + Notice that the H5T_STD_REF_DSETREG data type is used. +<P> + +<LI> This program uses hyperslab and point selections. We used the dataspace + handle <I>sid2</I> for the calls to H5Sselect_hyperslab and + H5Sselect_elements. The handle was created when dataset "Dataset2" was + created and it describes the dataset's dataspace. We did not close it when + the dataset was closed to decrease the number of function calls used + in the example. + In a real application program, one should open the dataset and determine + its dataspace using the H5Dget_space function. +<P> +<LI> H5Rcreate is used to create a dataset region reference and store it in a + buffer. The signature of the function is: +<PRE> + herr_t H5Rcreate(void *buf, hid_t loc_id, const char *name, + H5R_type_t ref_type, hid_t space_id) +</PRE> +<UL> + <LI> The first argument specifies the buffer to store the reference. + <LI> The second and third arguments specify the name of the referenced + dataset. In our example the file identifier <I>fid1</I> and the + absolute name of the dataset "/Dataset2" were used to identify the + dataset. The reference to the region of this dataset is stored in + the buffer <I>buf</I>. + + <LI> The fourth argument specifies the type of the reference. Since we are + creating references to the dataset regions, the H5R_DATASET_REGION + data type is used. + <LI> The fifth argument is a dataspace identifier of the referenced dataset. +</UL> +</UL> +<A NAME="fc1"> +<H3><U>File Contents</U></H3> +The contents of the file "trefer2.h5" created by this program are as follows: + +<PRE> +HDF5 "trefer2.h5" { +GROUP "/" { + DATASET "Dataset1" { + DATATYPE { H5T_REFERENCE } + DATASPACE { SIMPLE ( 4 ) / ( 4 ) } + DATA { + DATASET 0:744 {(2,2)-(7,7)}, DATASET 0:744 {(6,9), (2,2), (8,4), (1,6), + (2,8), (3,2), (0,4), (9,0), (7,1), (3,3)}, NULL, NULL + } + } + DATASET "Dataset2" { + DATATYPE { H5T_STD_U8LE } + DATASPACE { SIMPLE ( 10, 10 ) / ( 10, 10 ) } + DATA { + 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, + 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, + 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, + 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, + 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, + 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, + 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, + 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, + 240, 243, 246, 249, 252, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 + } + } +} +} +</PRE> +Notice how raw data of the dataset with the dataset regions is displayed. +Each element of the raw data consists of a reference to the dataset +(DATASET number1:number2) and its selected region. +If the selection is a hyperslab, the corner coordinates of the hyperslab +are displayed. +For the point selection, the coordinates of each point are displayed. +Since only two selections were stored, the third and fourth elements of the +dataset "Dataset1" are set to NULL. This was done by the buffer +inizialization in the program. + +<A NAME="def2"> +<H2>Reading References to Dataset Regions</H2> + +The following steps are involved in reading references to the dataset +regions and referenced dataset regions (selections). +<OL> +<LI> Open and read the dataset containing references to the dataset regions. + The data type H5T_STD_REF_DSETREG must be used during read operation. +<P> +<LI>Use H5Rdereference to obtain the dataset identifier from the read + dataset region reference. + <PRE> <B>OR</B> + </PRE> + Use H5Rget_region to obtain the dataspace identifier for the dataset + containing the selection from the read dataset region reference. +<P> +<LI> With the dataspace identifier, the H5S interface functions, + H5Sget_select_*, can be used to obtain information about the + selection. +<P> +<LI> Close all objects when they are no longer needed. +</OL> + +<H2> Programming Example</H2> +<A NAME="desc2"> +<H3><U>Description</U></H3> +The following example reads a dataset containing dataset region references. +It reads data from the dereferenced dataset and displays the number of +elements and raw data. Then it reads two selections: +hyperslab and point. The program queries a number of points in the +hyperslab and the coordinates and displays them. Then it queries a number of +selected points and their coordinates and displays the information.<BR> +[ <A HREF="examples/h5_ref2regr.c">Download h5_ref2regr.c</A> ] +<PRE> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +#include <stdlib.h> +#include <hdf5.h> + +#define FILE2 "trefer2.h5" +#define NPOINTS 10 + +/* 1-D dataset with fixed dimensions */ +#define SPACE1_NAME "Space1" +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 + +/* 2-D dataset with fixed dimensions */ +#define SPACE2_NAME "Space2" +#define SPACE2_RANK 2 +#define SPACE2_DIM1 10 +#define SPACE2_DIM2 10 + +int +main(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *rbuf; /* buffer to to read disk */ + int *drbuf; /* Buffer for reading numeric data from disk */ + int i, j; /* counting variables */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + + /* Allocate write & read buffers */ + rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1); + drbuf=calloc(sizeof(int),SPACE2_DIM1*SPACE2_DIM2); + + /* Open the file */ + fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + + /* Open the dataset */ + dset1=H5Dopen(fid1,"/Dataset1"); + + /* Read selection from disk */ + ret=H5Dread(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); + + /* Try to open objects */ + dset2 = H5Rdereference(dset1,H5R_DATASET_REGION,&rbuf[0]); + + /* Check information in referenced dataset */ + sid1 = H5Dget_space(dset2); + + ret=H5Sget_simple_extent_npoints(sid1); + printf(" Number of elements in the dataset is : %d\n",ret); + + /* Read from disk */ + ret=H5Dread(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,drbuf); + + for(i=0; i < SPACE2_DIM1; i++) { + for (j=0; j < SPACE2_DIM2; j++) printf (" %d ", drbuf[i*SPACE2_DIM2+j]); + printf("\n"); } + + /* Get the hyperslab selection */ + sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[0]); + + /* Verify correct hyperslab selected */ + ret = H5Sget_select_npoints(sid2); + printf(" Number of elements in the hyperslab is : %d \n", ret); + ret = H5Sget_select_hyper_nblocks(sid2); + coords=malloc(ret*SPACE2_RANK*sizeof(hsize_t)*2); /* allocate space for the hyperslab blocks */ + ret = H5Sget_select_hyper_blocklist(sid2,0,ret,coords); + printf(" Hyperslab coordinates are : \n"); + printf (" ( %lu , %lu ) ( %lu , %lu ) \n", \ +(unsigned long)coords[0],(unsigned long)coords[1],(unsigned long)coords[2],(unsigned long)coords[3]); + free(coords); + ret = H5Sget_select_bounds(sid2,low,high); + + /* Close region space */ + ret = H5Sclose(sid2); + + /* Get the element selection */ + sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[1]); + + /* Verify correct elements selected */ + ret = H5Sget_select_elem_npoints(sid2); + printf(" Number of selected elements is : %d\n", ret); + + /* Allocate space for the element points */ + coords= malloc(ret*SPACE2_RANK*sizeof(hsize_t)); + ret = H5Sget_select_elem_pointlist(sid2,0,ret,coords); + printf(" Coordinates of selected elements are : \n"); + for (i=0; i < 2*NPOINTS; i=i+2) + printf(" ( %lu , %lu ) \n", (unsigned long)coords[i],(unsigned long)coords[i+1]); + + free(coords); + ret = H5Sget_select_bounds(sid2,low,high); + + /* Close region space */ + ret = H5Sclose(sid2); + + /* Close first space */ + ret = H5Sclose(sid1); + + /* Close dereferenced Dataset */ + ret = H5Dclose(dset2); + + /* Close Dataset */ + ret = H5Dclose(dset1); + + /* Close file */ + ret = H5Fclose(fid1); + + /* Free memory buffers */ + free(rbuf); + free(drbuf); + return 0; +} +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +Output of this program is : +<PRE> + + Number of elements in the dataset is : 100 + 0 3 6 9 12 15 18 21 24 27 + 30 33 36 39 42 45 48 51 54 57 + 60 63 66 69 72 75 78 81 84 87 + 90 93 96 99 102 105 108 111 114 117 + 120 123 126 129 132 135 138 141 144 147 + 150 153 156 159 162 165 168 171 174 177 + 180 183 186 189 192 195 198 201 204 207 + 210 213 216 219 222 225 228 231 234 237 + 240 243 246 249 252 255 255 255 255 255 + 255 255 255 255 255 255 255 255 255 255 + Number of elements in the hyperslab is : 36 + Hyperslab coordinates are : + ( 2 , 2 ) ( 7 , 7 ) + Number of selected elements is : 10 + Coordinates of selected elements are : + ( 6 , 9 ) + ( 2 , 2 ) + ( 8 , 4 ) + ( 1 , 6 ) + ( 2 , 8 ) + ( 3 , 2 ) + ( 0 , 4 ) + ( 9 , 0 ) + ( 7 , 1 ) + ( 3 , 3 ) + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> +<A NAME="rem2"> +<H3><U>Remarks</U></H3> +<UL> +<LI> The dataset with the region references was read by H5Dread with + the H5T_STD_REF_DSETREG data type specified. +<P> +<LI> The read reference can be used to obtain the dataset identifier as we + did with the following call: +<PRE> + dset2 = H5Rdereference (dset1,H5R_DATASET_REGION,&rbuf[0]); +</PRE> + or to obtain spacial information ( dataspace and selection ) with the call + to H5Rget_region: +<PRE> + sid2=H5Rget_region(dset1,H5R_DATASET_REGION,&rbuf[0]); +</PRE> + The reference to the dataset region has information for both the dataset + itself and its selection. In both functions: +<UL> + <LI> The first parameter is an identifier of the dataset with the region + references. + <LI> The second parameter specifies the type of reference stored. In + this example a reference to the dataset region is stored. + <LI> The third parameter is a buffer containing the reference of the + specified type. +</UL> +<P> +<LI> This example introduces several H5Sget_select* functions used to obtain + information about selections: + +<UL> + <B>H5Sget_select_npoints:</B> returns the number of elements in the + hyperslab<BR> + <B>H5Sget_select_hyper_nblocks:</B> returns the number of blocks in + the hyperslab<BR> + <B>H5Sget_select_blocklist:</B> returns the "lower left" and "upper right" + coordinates of the blocks in the hyperslab selection<BR> + <B>H5Sget_select_bounds:</B> returns the coordinates of the "minimal" + block containing a hyperslab selection<BR> + <B>H5Sget_select_elem_npoints:</B> returns the number of points in the + element selection<BR> + <B>H5Sget_select_elem_points:</B> returns the coordinates of the element + selection +</UL> +</UL> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/select.html b/doc/html/Tutor/select.html new file mode 100644 index 0000000..76ef846 --- /dev/null +++ b/doc/html/Tutor/select.html @@ -0,0 +1,452 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Selections using H5Sselect_hyperslab +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Selections using H5Sselect_hyperslab</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI><A HREF="#def">Selecting a Portion of a Dataspace</A> + <LI>Programming Example +<UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> +<!-- + <LI> <A HREF="#fc">File Contents</A> +--> +</UL> +</UL> +<HR> +<A NAME="def"> +<H2>Selecting a Portion of a Dataspace</H2> +Hyperslabs are portions of datasets. A hyperslab selection can be a logically contiguous collection of points in a dataspace, or it +can be a regular pattern of points or blocks in a dataspace. +You can select a hyperslab to write to/read from with the function +H5Sselect_hyperslab. +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +This example creates a 5 x 6 integer array in a +file called sds.h5. It selects a 3 x 4 hyperslab from the dataset, +as follows (Dimension 0 is offset by 1 and Dimension 1 is offset by 2): +<P> +<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=172> +<TR><TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +</TR> +<TR><TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +</TR> +<TR><TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="17%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +</TR> +<TR><TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +<TD WIDTH="17%" VALIGN="TOP"> </TD> +</TR> +</TABLE> +<P> +Then it reads the hyperslab from this file into a 2-dimensional plane +(size 7 x 7) of a 3-dimensional array (size 7 x 7 x 3), as +follows (with Dimension 0 offset by 3): +<P> +<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=201> +<TR><TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> +<FONT SIZE=2><P> X</FONT></TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +<TR><TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +<TD WIDTH="14%" VALIGN="TOP"> </TD> +</TR> +</TABLE> +<P> +[ <A HREF="examples/h5_hyperslab.c">Download h5_hyperslab.c</A> ] +<PRE> + +/************************************************************ + + This example shows how to write and read a hyperslab. It + is derived from the h5_read.c and h5_write.c examples in + the "Introduction to HDF5". + + ************************************************************/ + +#include "hdf5.h" + +#define FILE "sds.h5" +#define DATASETNAME "IntArray" +#define NX_SUB 3 /* hyperslab dimensions */ +#define NY_SUB 4 +#define NX 7 /* output buffer dimensions */ +#define NY 7 +#define NZ 3 +#define RANK 2 +#define RANK_OUT 3 + +#define X 5 /* dataset dimensions */ +#define Y 6 + +int +main (void) +{ + hsize_t dimsf[2]; /* dataset dimensions */ + int data[X][Y]; /* data to write */ + + /* + * Data and output buffer initialization. + */ + hid_t file, dataset; /* handles */ + hid_t dataspace; + hid_t memspace; + hsize_t dimsm[3]; /* memory space dimensions */ + hsize_t dims_out[2]; /* dataset dimensions */ + herr_t status; + + int data_out[NX][NY][NZ ]; /* output buffer */ + + hsize_t count[2]; /* size of the hyperslab in the file */ + hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t count_out[3]; /* size of the hyperslab in memory */ + hssize_t offset_out[3]; /* hyperslab offset in memory */ + int i, j, k, status_n, rank; + + + +/********************************************************* + This writes data to the HDF5 file. + *********************************************************/ + + /* + * Data and output buffer initialization. + */ + for (j = 0; j < X; j++) { + for (i = 0; i < Y; i++) + data[j][i] = i + j; + } + /* + * 0 1 2 3 4 5 + * 1 2 3 4 5 6 + * 2 3 4 5 6 7 + * 3 4 5 6 7 8 + * 4 5 6 7 8 9 + */ + + /* + * Create a new file using H5F_ACC_TRUNC access, + * the default file creation properties, and the default file + * access properties. + */ + file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* + * Describe the size of the array and create the data space for fixed + * size dataset. + */ + dimsf[0] = X; + dimsf[1] = Y; + dataspace = H5Screate_simple (RANK, dimsf, NULL); + + /* + * Create a new dataset within the file using defined dataspace and + * default dataset creation properties. + */ + dataset = H5Dcreate (file, DATASETNAME, H5T_STD_I32BE, dataspace, + H5P_DEFAULT); + + /* + * Write the data to the dataset using default transfer properties. + */ + status = H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, data); + + /* + * Close/release resources. + */ + H5Sclose (dataspace); + H5Dclose (dataset); + H5Fclose (file); + + +/************************************************************* + + This reads the hyperslab from the sds.h5 file just + created, into a 2-dimensional plane of the 3-dimensional + array. + + ************************************************************/ + + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) { + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; + } + } + + /* + * Open the file and the dataset. + */ + file = H5Fopen (FILE, H5F_ACC_RDONLY, H5P_DEFAULT); + dataset = H5Dopen (file, DATASETNAME); + + dataspace = H5Dget_space (dataset); /* dataspace handle */ + rank = H5Sget_simple_extent_ndims (dataspace); + status_n = H5Sget_simple_extent_dims (dataspace, dims_out, NULL); + printf("\nRank: %d\nDimensions: %lu x %lu \n", rank, + (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1])); + + /* + * Define hyperslab in the dataset. + */ + offset[0] = 1; + offset[1] = 2; + count[0] = NX_SUB; + count[1] = NY_SUB; + status = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, offset, NULL, + count, NULL); + + /* + * Define the memory dataspace. + */ + dimsm[0] = NX; + dimsm[1] = NY; + dimsm[2] = NZ; + memspace = H5Screate_simple (RANK_OUT, dimsm, NULL); + + /* + * Define memory hyperslab. + */ + offset_out[0] = 3; + offset_out[1] = 0; + offset_out[2] = 0; + count_out[0] = NX_SUB; + count_out[1] = NY_SUB; + count_out[2] = 1; + status = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, offset_out, NULL, + count_out, NULL); + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + status = H5Dread (dataset, H5T_NATIVE_INT, memspace, dataspace, + H5P_DEFAULT, data_out); + printf ("Data:\n "); + for (j = 0; j < NX; j++) { + for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]); + printf("\n "); + } + printf("\n"); + /* + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 + * 3 4 5 6 0 0 0 + * 4 5 6 7 0 0 0 + * 5 6 7 8 0 0 0 + * 0 0 0 0 0 0 0 + */ + + /* + * Close and release resources. + */ + H5Dclose (dataset); + H5Sclose (dataspace); + H5Sclose (memspace); + H5Fclose (file); + +} +</PRE> +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI>H5Sselect_hyperslab selects a hyperslab region to add to the current +selected region for a specified dataspace. +<PRE> + herr_t H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op, + const hssize_t *start, const hsize_t *stride, + const hsize_t *count, const hsize_t *block ) +</PRE> +<UL> +<LI>The first parameter, <I>space_id</I>, is the dataspace identifier for the + specified dataspace. +<LI>The second parameter, <I>op</I>, can only be set to H5S_SELECT_SET + in the current release. It replaces the existing selection with the + parameters from this call. Overlapping blocks are not supported. +<LI>The <I>start</I> array determines the starting coordinates of the hyperslab to select. +<LI>The <I>stride</I> array indicates which elements along a dimension are to +be selected. +<LI>The <I>count</I> array determines how many positions to select from the + dataspace in each dimension. +<LI>The <I>block</I> array determines the size of the element block selected + by the dataspace. +</UL> +<P> +The <I>start</I>, <I>stride</I>, <I>count</I>, and <I>block</I> arrays must +be the same size as the rank of the dataspace. +<P> +<LI>This example introduces the following H5Dget_* functions: +<UL> + <B>H5Dget_space:</B> returns an identifier for a copy of the dataspace + of a dataset.<BR> + <B>H5Dget_type:</B> returns an identifier for a copy of the data type + of a dataset.<BR> +</UL> +<P> +<LI>This example introduces the following H5Sget_* functions used to +obtain information about selections: +<UL> + <B>H5Sget_simple_extent_dims:</B> returns the size and maximum sizes + of each dimension of a dataspace.<BR> + <B>H5Sget_simple_extent_ndims:</B> determines the dimensionality + (or rank) of a dataspace. <BR> +</UL> +</UL> +</UL> +</PRE> +<P> + +<!-- +<A NAME="fc"> +<H3><U>File Contents</U></H3> +--> + + + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/selectc.html b/doc/html/Tutor/selectc.html new file mode 100644 index 0000000..e01d9db --- /dev/null +++ b/doc/html/Tutor/selectc.html @@ -0,0 +1,296 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Selections using H5Sselect_elements and H5Scopy +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Selections using H5Sselect_elements and H5SCopy</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +<BODY> +<H2>Contents:</H2> +<UL> + <LI> <A HREF="#def">Selecting Independent Points and Copying a Dataspace</A> + <LI> Programming Example + <UL> + <LI> <A HREF="#desc">Description</A> + <LI> <A HREF="#rem">Remarks</A> + <LI> <A HREF="#fc">File Contents</A> + </UL> +</UL> +<HR> +<A NAME="def"> +<H2>Selecting Independent Points and Copying a Dataspace</h2> +You can select independent points to read or write to in a +dataspace by use of the H5Sselect_elements function. +<P> +The H5Scopy function allows you to make an exact copy of a dataspace, +which can help cut down on the number of function calls needed when +selecting a dataspace. +<P> +<H2> Programming Example</H2> +<A NAME="desc"> +<H3><U>Description</U></H3> +This example shows you how to use H5Sselect_elements to select individual +points in a dataset and how to use H5Scopy to make a copy of a dataspace. + +[ <A HREF="examples/h5_copy.c">Download h5_copy.c</A> ] +<PRE> +/***********************************************************************/ +/* */ +/* PROGRAM: h5_copy.c */ +/* PURPOSE: Shows how to use the H5SCOPY function. */ +/* DESCRIPTION: */ +/* This program creates two files, copy1.h5, and copy2.h5. */ +/* In copy1.h5, it creates a 3x4 dataset called 'Copy1', */ +/* and write 0's to this dataset. */ +/* In copy2.h5, it create a 3x4 dataset called 'Copy2', */ +/* and write 1's to this dataset. */ +/* It closes both files, reopens both files, selects two */ +/* points in copy1.h5 and writes values to them. Then it */ +/* does an H5Scopy from the first file to the second, and */ +/* writes the values to copy2.h5. It then closes the */ +/* files, reopens them, and prints the contents of the */ +/* two datasets. */ +/* */ +/***********************************************************************/ + +#include "hdf5.h" +#define FILE1 "copy1.h5" +#define FILE2 "copy2.h5" + +#define RANK 2 +#define DIM1 3 +#define DIM2 4 +#define NUMP 2 + +int main (void) +{ + hid_t file1, file2, dataset1, dataset2; + hid_t mid1, mid2, fid1, fid2; + hsize_t fdim[] = {DIM1, DIM2}; + hsize_t mdim[] = {DIM1, DIM2}; + hsize_t start[2], stride[2], count[2], block[2]; + int buf1[DIM1][DIM2]; + int buf2[DIM1][DIM2]; + int bufnew[DIM1][DIM2]; + int val[] = {53, 59}; + hsize_t marray[] = {2}; + hssize_t coord[NUMP][RANK]; + herr_t ret; + uint i, j; + +/***********************************************************************/ +/* */ +/* Create two files containing identical datasets. Write 0's to one */ +/* and 1's to the other. */ +/* */ +/***********************************************************************/ + + for ( i = 0; i < DIM1; i++ ) + for ( j = 0; j < DIM2; j++ ) + buf1[i][j] = 0; + + for ( i = 0; i < DIM1; i++ ) + for ( j = 0; j < DIM2; j++ ) + buf2[i][j] = 1; + + file1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + fid1 = H5Screate_simple (RANK, fdim, NULL); + fid2 = H5Screate_simple (RANK, fdim, NULL); + + dataset1 = H5Dcreate (file1, "Copy1", H5T_NATIVE_INT, fid1, H5P_DEFAULT); + dataset2 = H5Dcreate (file2, "Copy2", H5T_NATIVE_INT, fid2, H5P_DEFAULT); + + ret = H5Dwrite(dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1); + ret = H5Dwrite(dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2); + + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + + ret = H5Sclose (fid1); + ret = H5Sclose (fid2); + + ret = H5Fclose (file1); + ret = H5Fclose (file2); + +/***********************************************************************/ +/* */ +/* Open the two files. Select two points in one file, write values to */ +/* those point locations, then do H5Scopy and write the values to the */ +/* other file. Close files. */ +/* */ +/***********************************************************************/ + + file1 = H5Fopen (FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + file2 = H5Fopen (FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + dataset1 = H5Dopen (file1, "Copy1"); + dataset2 = H5Dopen (file2, "Copy2"); + fid1 = H5Dget_space (dataset1); + mid1 = H5Screate_simple(1, marray, NULL); + coord[0][0] = 0; coord[0][1] = 3; + coord[1][0] = 0; coord[1][1] = 1; + + ret = H5Sselect_elements (fid1, H5S_SELECT_SET, NUMP, (const hssize_t **)coord); + + ret = H5Dwrite (dataset1, H5T_NATIVE_INT, mid1, fid1, H5P_DEFAULT, val); + + fid2 = H5Scopy (fid1); + + ret = H5Dwrite (dataset2, H5T_NATIVE_INT, mid1, fid2, H5P_DEFAULT, val); + + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + ret = H5Sclose (fid1); + ret = H5Sclose (fid2); + ret = H5Fclose (file1); + ret = H5Fclose (file2); + ret = H5Sclose (mid1); + +/***********************************************************************/ +/* */ +/* Open both files and print the contents of the datasets. */ +/* */ +/***********************************************************************/ + + file1 = H5Fopen (FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + file2 = H5Fopen (FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + dataset1 = H5Dopen (file1, "Copy1"); + dataset2 = H5Dopen (file2, "Copy2"); + + ret = H5Dread (dataset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, bufnew); + + printf ("\nDataset 'Copy1' in file 'copy1.h5' contains: \n"); + for (i=0;i<DIM1; i++) { + for (j=0;j<DIM2;j++) printf ("%3d ", bufnew[i][j]); + printf("\n"); + } + + printf ("\nDataset 'Copy2' in file 'copy2.h5' contains: \n"); + + ret = H5Dread (dataset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, bufnew); + + for (i=0;i<DIM1; i++) { + for (j=0;j<DIM2;j++) printf ("%3d ", bufnew[i][j]); + printf("\n"); + } + ret = H5Dclose (dataset1); + ret = H5Dclose (dataset2); + ret = H5Fclose (file1); + ret = H5Fclose (file2); + +} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +</PRE> + +<A NAME="rem"> +<H3><U>Remarks</U></H3> +<UL> +<LI>H5Sselect_elements selects array elements to be included in the +selection for a dataspace: +<PRE> + herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, + size_t num_elem, const hssize_t **coord ) +</PRE> +<UL> +<LI>The <I>space_id</I> parameter is the dataspace identifier.<BR> +<LI>The <I>op</I> parameter currently can only be set to H5S_SELECT_SET and +specifies to replace the existing selection with the parameters from this +call. +<LI>The <I>coord</I> array is a two-dimensional array of size 'dataspace rank' +by the number of elements to be selected, <I>num_elem</I>.<BR> +</UL> +<P> +<LI>H5Scopy creates an exact copy of a dataspace: +<PRE> + hid_t H5Scopy(hid_t space_id ) +</PRE> +<UL> +<LI>The <I>space_id</I> parameter is the dataspace identifier to copy. +</UL> +</UL> +</UL> +<P> + +<A NAME="fc"> +<H3><U>File Contents</U></H3> + +Following is the DDL for <I>copy1.h5</I> and <I>copy2.h5</I>, as viewed with +the commands "h5dump copy1.h5" and "h5dump copy2.h5". +<P> +<B>Fig. S.1</B> <I>'copy1.h5' in DDL</I> +<PRE> +HDF5 "copy1.h5" { +GROUP "/" { + DATASET "Copy1" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 3, 4 ) / ( 3, 4 ) } + DATA { + 0, 59, 0, 53, + 0, 0, 0, 0, + 0, 0, 0, 0 + } + } +} +} +</PRE> +<B>Fig. S.2</B> <I>'copy2.h5' in DDL</I> +<PRE> +HDF5 "copy2.h5" { +GROUP "/" { + DATASET "Copy2" { + DATATYPE { H5T_STD_I32BE } + DATASPACE { SIMPLE ( 3, 4 ) / ( 3, 4 ) } + DATA { + 1, 59, 1, 53, + 1, 1, 1, 1, + 1, 1, 1, 1 + } + } +} +} + +</PRE> + + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: August 27, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/title.html b/doc/html/Tutor/title.html new file mode 100644 index 0000000..35283b7 --- /dev/null +++ b/doc/html/Tutor/title.html @@ -0,0 +1,99 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + +<h1> <A HREF="http://hdf.ncsa.uiuc.edu/whatishdf5.html"> +<img align=left border=0 src="bighdf2sp.JPG" alt="What is HDF5?"></A> +<BIG><BIG><BIG> <FONT COLOR="#c101cd">HDF5 Tutorial</FONT> +</BIG></BIG></BIG></H1> + + + +<hr noshade size=1> + +<!-- The following buttons are for use only when the Tutorial is served from the HDF web server. +<CENTER> +<FONT SIZE="3" FACE="arial,helvetica" COLOR="#c80028"> + <B>[</B> <A HREF="http://hdf.ncsa.uiuc.edu/index.html">Home</A> <B>]</B> + <B>[</B> <A HREF="http://hdf.ncsa.uiuc.edu/hdfindex.html">Index</A> <B>]</B> + <B>[</B> <A HREF="http://hdf.ncsa.uiuc.edu/products.html">Products</A> <B>]</B> + <B>[</B> <A HREF="http://hdf.ncsa.uiuc.edu/newsletters.html">Newsletters</A> <B>]</B> + <B>[</B> <A HREF="http://hdf.ncsa.uiuc.edu/docs.html">Documentation</A> <B>]</B> +</FONT> +<BR> +</CENTER> +<BR CLEAR=ALL><BR> +--> + +<H2>Contents:</H2> +<H3>Introductory Topics</H3> +<OL> +<LI><A HREF="intro.html">Introduction</A> +<LI><A HREF="fileorg.html">HDF5 File Organization</A> +<LI><A HREF="api.html">The HDF5 API</A> +<LI><A HREF="crtfile.html">Creating an HDF5 File</A> +<LI><A HREF="crtdat.html">Creating a Dataset</A> +<LI><A HREF="rdwt.html">Reading from/Writing to a Dataset</A> +<LI><A HREF="crtatt.html">Creating an Attribute</A> +<LI><A HREF="crtgrp.html">Creating a Group</A> +<LI><A HREF="crtgrpar.html">Creating Groups using Absolute/Relative +Names</A> +<LI><A HREF="crtgrpd.html">Creating Datasets in Groups</A> +</OL> +<UL> +<A HREF="questions.html">Questions</A><BR> +<A HREF="answers.html">Answers</A><BR> +</UL> +<H3>Advanced Topics</H3> +<UL> +<LI><A HREF="compound.html">Compound Data Types</A> +<LI><A HREF="select.html">Selections using H5Sselect_hyperslab</A> +<LI><A HREF="selectc.html">Selections using H5Sselect_elements and H5SCopy</A> +<LI><A HREF="reftoobj.html">References to Objects</A> +<LI><A HREF="reftoreg.html">References to Dataset Regions</A> +<LI><A HREF="extend.html">Chunking and Extendible Datasets</A> +<LI><A HREF="mount.html">Mounting Files</A> +<LI><A HREF="iterate.html">Group Iteration</A> +</UL> +<P> +<A HREF="util.html">HDF5 Utilities - h5ls/h5dump</A><BR> +<A HREF="glossary.html">Glossary</A><BR> +<A HREF="references.html">References</A><BR> +<A HREF="examples/">Example Programs from this Tutorial</A> <BR> +</OL> + + +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: October 8, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + diff --git a/doc/html/Tutor/util.html b/doc/html/Tutor/util.html new file mode 100644 index 0000000..79dbf28 --- /dev/null +++ b/doc/html/Tutor/util.html @@ -0,0 +1,89 @@ +<HTML><HEAD> +<TITLE>HDF5 Tutorial - Utilities (h5dump, h5ls) +</TITLE> +</HEAD> + +<body bgcolor="#ffffff"> + +<!-- BEGIN MAIN BODY --> + +<A HREF="http://www.ncsa.uiuc.edu/"><img border=0 +src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" +width=78 height=27 alt="NCSA"><P></A> + + [ <A HREF="title.html"><I>HDF5 Tutorial Top</I></A> ] +<H1> +<BIG><BIG><BIG><FONT COLOR="#c101cd">Utilities (h5dump, h5ls)</FONT> +</BIG></BIG></BIG></H1> + +<hr noshade size=1> + +The h5dump and h5ls utilities can be used to examine the contents of an +hdf5 file. +<P> +<A NAME="dmp"> +<H2>h5dump</H2> +<PRE> +h5dump [-h] [-bb] [-header] [-a <names>] [-d <names>] [-g <names>] + [-l <names>] [-t <names>] <file> + + -h Print information on this command. + -bb Display the content of the boot block. The default is not to display. + -header Display header only; no data is displayed. + -a <names> Display the specified attribute(s). + -d <names> Display the specified dataset(s). + -g <names> Display the specified group(s) and all the members. + -l <names> Displays the value(s) of the specified soft link(s). + -t <names> Display the specified named data type(s). + + <names> is one or more appropriate object names. +</PRE> +<A NAME="ls"> +<H2>h5ls</H2> +<PRE> +h5ls [OPTIONS] FILE [OBJECTS...] + + OPTIONS + -h, -?, --help Print a usage message and exit + -d, --dump Print the values of datasets + -f, --full Print full path names instead of base names + -l, --label Label members of compound datasets + -r, --recursive List all groups recursively, avoiding cycles + -s, --string Print 1-byte integer datasets as ASCII + -wN, --width=N Set the number of columns of output + -v, --verbose Generate more verbose output + -V, --version Print version number and exit + FILE + The file name may include a printf(3C) integer format such as + "%05d" to open a file family. + OBJECTS + The names of zero or more objects about which information should be + displayed. If a group is mentioned then information about each of its + members is displayed. If no object names are specified then + information about all of the objects in the root group is displayed. +</PRE> +<!-- BEGIN FOOTER INFO --> + +<P><hr noshade size=1> +<font face="arial,helvetica" size="-1"> + <a href="http://www.ncsa.uiuc.edu/"><img border=0 + src="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" + width=78 height=27 alt="NCSA"><br> + The National Center for Supercomputing Applications</A><br> + <a href="http://www.uiuc.edu/">University of Illinois + at Urbana-Champaign</a><br> + <br> +<!-- <A HREF="helpdesk.mail.html"> --> +<A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> +hdfhelp@ncsa.uiuc.edu</A> +<BR> <H6>Last Modified: July 30, 1999</H6><BR> +<!-- modified by Barbara Jones - bljones@ncsa.uiuc.edu --> +</FONT> +<BR> +<!-- <A HREF="mailto:hdfhelp@ncsa.uiuc.edu"> --> + +</BODY> +</HTML> + + + |