summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-09-19 19:15:54 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-09-19 19:15:54 (GMT)
commit80b371f32eb8beb66630e770db94af2f0e3827fa (patch)
treead0c507d8b450cdac0eea2b74fdde6ee91be00a7
parent4d4a88a9f3775d1c6be820208a2699ae38d586b4 (diff)
parent8cddc96f73e8f90f67792405f5142b419e9061d7 (diff)
downloadhdf5-80b371f32eb8beb66630e770db94af2f0e3827fa.zip
hdf5-80b371f32eb8beb66630e770db94af2f0e3827fa.tar.gz
hdf5-80b371f32eb8beb66630e770db94af2f0e3827fa.tar.bz2
Merge pull request #1926 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit '8cddc96f73e8f90f67792405f5142b419e9061d7': Change unused variable to generic form Whitespace cleanup Add missing HD prefix HDFFV-10740 - skip copying dirs in for loops Correct HDF5 options to tristate values. HDFFV-10905 fix test scripts for no zlib HDFFV-10903 - fix VFD constants in JNI
-rw-r--r--c++/examples/chunks.cpp338
-rw-r--r--c++/examples/compound.cpp16
-rw-r--r--c++/examples/create.cpp12
-rw-r--r--c++/examples/extend_ds.cpp24
-rw-r--r--c++/examples/h5group.cpp288
-rw-r--r--c++/examples/h5tutr_cmprss.cpp196
-rw-r--r--c++/examples/h5tutr_crtatt.cpp58
-rw-r--r--c++/examples/h5tutr_crtdat.cpp55
-rw-r--r--c++/examples/h5tutr_crtgrp.cpp34
-rw-r--r--c++/examples/h5tutr_crtgrpar.cpp54
-rw-r--r--c++/examples/h5tutr_crtgrpd.cpp136
-rw-r--r--c++/examples/h5tutr_extend.cpp218
-rw-r--r--c++/examples/h5tutr_rdwt.cpp48
-rw-r--r--c++/examples/h5tutr_subset.cpp192
-rw-r--r--c++/examples/readdata.cpp36
-rw-r--r--c++/examples/writedata.cpp518
-rw-r--r--config/cmake/HDFCompilerFlags.cmake16
-rw-r--r--java/CMakeLists.txt2
-rw-r--r--java/src/jni/h5Constants.c16
-rw-r--r--test/test_usecases.sh.in31
-rw-r--r--test/testflushrefresh.sh.in25
-rw-r--r--test/testswmr.sh.in11
-rw-r--r--test/testvdsswmr.sh.in13
-rw-r--r--tools/test/h5copy/testh5copy.sh.in9
-rw-r--r--tools/test/h5repack/h5repack.sh.in9
-rw-r--r--tools/test/perform/sio_perf.c2
26 files changed, 1203 insertions, 1154 deletions
diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp
index 142e70f..03e2855 100644
--- a/c++/examples/chunks.cpp
+++ b/c++/examples/chunks.cpp
@@ -37,194 +37,194 @@ const int RANKC = 1;
int main (void)
{
- hsize_t i, j;
+ hsize_t i, j;
// Try block to detect exceptions raised by any of the calls inside it
try
{
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Open the file and the dataset.
- */
- H5File file( FILE_NAME, H5F_ACC_RDONLY );
- DataSet dataset = file.openDataSet( DATASET_NAME );
-
- /*
- * Get filespace for rank and dimension
- */
- DataSpace filespace = dataset.getSpace();
-
- /*
- * Get number of dimensions in the file dataspace
- */
- int rank = filespace.getSimpleExtentNdims();
-
- /*
- * Get and print the dimension sizes of the file dataspace
- */
- hsize_t dims[2]; // dataset dimensions
- rank = filespace.getSimpleExtentDims( dims );
- cout << "dataset rank = " << rank << ", dimensions "
- << (unsigned long)(dims[0]) << " x "
- << (unsigned long)(dims[1]) << endl;
-
- /*
- * Define the memory space to read dataset.
- */
- DataSpace mspace1(RANK, dims);
-
- /*
- * Read dataset back and display.
- */
- int data_out[NX][NY]; // buffer for dataset to be read
- dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace );
-
- cout << "\n";
- cout << "Dataset: \n";
- for (j = 0; j < dims[0]; j++)
- {
- for (i = 0; i < dims[1]; i++)
- cout << data_out[j][i] << " ";
- cout << endl;
- }
-
- /*
- * dataset rank 2, dimensions 10 x 5
- * chunk rank 2, dimensions 2 x 5
-
- * Dataset:
- * 1 1 1 3 3
- * 1 1 1 3 3
- * 1 1 1 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- */
-
- /*
- * Read the third column from the dataset.
- * First define memory dataspace, then define hyperslab
- * and read it into column array.
- */
- hsize_t col_dims[1];
- col_dims[0] = 10;
- DataSpace mspace2( RANKC, col_dims );
-
- /*
- * Define the column (hyperslab) to read.
- */
- hsize_t offset[2] = { 0, 2 };
- hsize_t count[2] = { 10, 1 };
- int column[10]; // buffer for column to be read
-
- /*
- * Define hyperslab and read.
- */
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
- dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
-
- cout << endl;
- cout << "Third column: " << endl;
- for (i = 0; i < 10; i++)
- cout << column[i] << endl;
-
- /*
- * Third column:
- * 1
- * 1
- * 1
- * 0
- * 0
- * 0
- * 0
- * 0
- * 0
- * 0
- */
-
- /*
- * Get creation properties list.
- */
- DSetCreatPropList cparms = dataset.getCreatePlist();
-
- /*
- * Check if dataset is chunked.
- */
- hsize_t chunk_dims[2];
- int rank_chunk;
- if( H5D_CHUNKED == cparms.getLayout() )
- {
- /*
- * Get chunking information: rank and dimensions
- */
- rank_chunk = cparms.getChunk( 2, chunk_dims);
- cout << "chunk rank " << rank_chunk << "dimensions "
- << (unsigned long)(chunk_dims[0]) << " x "
- << (unsigned long)(chunk_dims[1]) << endl;
-
- /*
- * Define the memory space to read a chunk.
- */
- DataSpace mspace3( rank_chunk, chunk_dims );
-
- /*
- * Define chunk in the file (hyperslab) to read.
- */
- offset[0] = 2;
- offset[1] = 0;
- count[0] = chunk_dims[0];
- count[1] = chunk_dims[1];
- filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
-
- /*
- * Read chunk back and display.
- */
- int chunk_out[2][5]; // buffer for chunk to be read
- dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
- cout << endl;
- cout << "Chunk:" << endl;
- for (j = 0; j < chunk_dims[0]; j++)
- {
- for (i = 0; i < chunk_dims[1]; i++)
- cout << chunk_out[j][i] << " ";
- cout << endl;
- }
- /*
- * Chunk:
- * 1 1 1 0 0
- * 2 0 0 0 0
- */
- }
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Open the file and the dataset.
+ */
+ H5File file( FILE_NAME, H5F_ACC_RDONLY );
+ DataSet dataset = file.openDataSet( DATASET_NAME );
+
+ /*
+ * Get filespace for rank and dimension
+ */
+ DataSpace filespace = dataset.getSpace();
+
+ /*
+ * Get number of dimensions in the file dataspace
+ */
+ int rank = filespace.getSimpleExtentNdims();
+
+ /*
+ * Get and print the dimension sizes of the file dataspace
+ */
+ hsize_t dims[2]; // dataset dimensions
+ rank = filespace.getSimpleExtentDims( dims );
+ cout << "dataset rank = " << rank << ", dimensions "
+ << (unsigned long)(dims[0]) << " x "
+ << (unsigned long)(dims[1]) << endl;
+
+ /*
+ * Define the memory space to read dataset.
+ */
+ DataSpace mspace1(RANK, dims);
+
+ /*
+ * Read dataset back and display.
+ */
+ int data_out[NX][NY]; // buffer for dataset to be read
+ dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace );
+
+ cout << "\n";
+ cout << "Dataset: \n";
+ for (j = 0; j < dims[0]; j++)
+ {
+ for (i = 0; i < dims[1]; i++)
+ cout << data_out[j][i] << " ";
+ cout << endl;
+ }
+
+ /*
+ * dataset rank 2, dimensions 10 x 5
+ * chunk rank 2, dimensions 2 x 5
+
+ * Dataset:
+ * 1 1 1 3 3
+ * 1 1 1 3 3
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ */
+
+ /*
+ * Read the third column from the dataset.
+ * First define memory dataspace, then define hyperslab
+ * and read it into column array.
+ */
+ hsize_t col_dims[1];
+ col_dims[0] = 10;
+ DataSpace mspace2( RANKC, col_dims );
+
+ /*
+ * Define the column (hyperslab) to read.
+ */
+ hsize_t offset[2] = { 0, 2 };
+ hsize_t count[2] = { 10, 1 };
+ int column[10]; // buffer for column to be read
+
+ /*
+ * Define hyperslab and read.
+ */
+ filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
+ dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
+
+ cout << endl;
+ cout << "Third column: " << endl;
+ for (i = 0; i < 10; i++)
+ cout << column[i] << endl;
+
+ /*
+ * Third column:
+ * 1
+ * 1
+ * 1
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ */
+
+ /*
+ * Get creation properties list.
+ */
+ DSetCreatPropList cparms = dataset.getCreatePlist();
+
+ /*
+ * Check if dataset is chunked.
+ */
+ hsize_t chunk_dims[2];
+ int rank_chunk;
+ if( H5D_CHUNKED == cparms.getLayout() )
+ {
+ /*
+ * Get chunking information: rank and dimensions
+ */
+ rank_chunk = cparms.getChunk( 2, chunk_dims);
+ cout << "chunk rank " << rank_chunk << "dimensions "
+ << (unsigned long)(chunk_dims[0]) << " x "
+ << (unsigned long)(chunk_dims[1]) << endl;
+
+ /*
+ * Define the memory space to read a chunk.
+ */
+ DataSpace mspace3( rank_chunk, chunk_dims );
+
+ /*
+ * Define chunk in the file (hyperslab) to read.
+ */
+ offset[0] = 2;
+ offset[1] = 0;
+ count[0] = chunk_dims[0];
+ count[1] = chunk_dims[1];
+ filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
+
+ /*
+ * Read chunk back and display.
+ */
+ int chunk_out[2][5]; // buffer for chunk to be read
+ dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
+ cout << endl;
+ cout << "Chunk:" << endl;
+ for (j = 0; j < chunk_dims[0]; j++)
+ {
+ for (i = 0; i < chunk_dims[1]; i++)
+ cout << chunk_out[j][i] << " ";
+ cout << endl;
+ }
+ /*
+ * Chunk:
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ */
+ }
} // end of try block
// catch failure caused by the H5File operations
catch( FileIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
}
diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp
index 192a1cf..4b116e0 100644
--- a/c++/examples/compound.cpp
+++ b/c++/examples/compound.cpp
@@ -41,15 +41,15 @@ int main(void)
{
/* First structure and dataset*/
typedef struct s1_t {
- int a;
- float b;
- double c;
+ int a;
+ float b;
+ double c;
} s1_t;
/* Second structure (subset of s1_t) and dataset*/
typedef struct s2_t {
- double c;
- int a;
+ double c;
+ int a;
} s2_t;
// Try block to detect exceptions raised by any of the calls inside it
@@ -135,12 +135,12 @@ int main(void)
*/
cout << endl << "Field c : " << endl;
for( i = 0; i < LENGTH; i++)
- cout << s2[i].c << " ";
+ cout << s2[i].c << " ";
cout << endl;
cout << endl << "Field a : " << endl;
for( i = 0; i < LENGTH; i++)
- cout << s2[i].a << " ";
+ cout << s2[i].a << " ";
cout << endl;
/*
@@ -161,7 +161,7 @@ int main(void)
*/
cout << endl << "Field b : " << endl;
for( i = 0; i < LENGTH; i++)
- cout << s3[i] << " ";
+ cout << s3[i] << " ";
cout << endl;
/*
diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp
index 890fb03..06b981b 100644
--- a/c++/examples/create.cpp
+++ b/c++/examples/create.cpp
@@ -25,11 +25,11 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "SDS.h5" );
-const H5std_string DATASET_NAME( "IntArray" );
-const int NX = 5; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
+const H5std_string FILE_NAME( "SDS.h5" );
+const H5std_string DATASET_NAME( "IntArray" );
+const int NX = 5; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
int main (void)
{
@@ -41,7 +41,7 @@ int main (void)
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
- data[j][i] = i + j;
+ data[j][i] = i + j;
}
/*
* 0 1 2 3 4 5
diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp
index 271100e..9e005c6 100644
--- a/c++/examples/extend_ds.cpp
+++ b/c++/examples/extend_ds.cpp
@@ -105,8 +105,8 @@ int main (void)
* Write the data to the hyperslab.
*/
int data1[3][3] = { {1, 1, 1}, /* data to write */
- {1, 1, 1},
- {1, 1, 1} };
+ {1, 1, 1},
+ {1, 1, 1} };
dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 );
/*
@@ -179,16 +179,16 @@ int main (void)
/*
* Resulting dataset
*
- * 1 1 1 3 3
- * 1 1 1 3 3
- * 1 1 1 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
- * 2 0 0 0 0
+ * 1 1 1 3 3
+ * 1 1 1 3 3
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
*/
/*
* Display the result.
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp
index a8c9953..fab54cd 100644
--- a/c++/examples/h5group.cpp
+++ b/c++/examples/h5group.cpp
@@ -33,7 +33,7 @@ using std::endl;
using namespace H5;
const H5std_string FILE_NAME( "Group.h5" );
-const int RANK = 2;
+const int RANK = 2;
// Operator function
extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo,
@@ -48,169 +48,169 @@ int main(void)
// Try block to detect exceptions raised by any of the calls inside it
try
{
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create the named file, truncating the existing one if any,
- * using default create and access property lists.
- */
- H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Create a group in the file
- */
- Group* group = new Group( file->createGroup( "/Data" ));
-
- /*
- * Create dataset "Compressed Data" in the group using absolute
- * name. Dataset creation property list is modified to use
- * GZIP compression with the compression effort set to 6.
- * Note that compression can be used only when dataset is chunked.
- */
- dims[0] = 1000;
- dims[1] = 20;
- cdims[0] = 20;
- cdims[1] = 20;
- DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
- DSetCreatPropList ds_creatplist; // create dataset creation prop list
- ds_creatplist.setChunk( 2, cdims ); // then modify it for compression
- ds_creatplist.setDeflate( 6 );
-
- /*
- * Create the first dataset.
- */
- DataSet* dataset = new DataSet(file->createDataSet(
- "/Data/Compressed_Data", PredType::NATIVE_INT,
- *dataspace, ds_creatplist ));
-
- /*
- * Close the first dataset.
- */
- delete dataset;
- delete dataspace;
-
- /*
- * Create the second dataset.
- */
- dims[0] = 500;
- dims[1] = 20;
- dataspace = new DataSpace(RANK, dims); // create second dspace
- dataset = new DataSet(file->createDataSet("/Data/Float_Data",
- PredType::NATIVE_FLOAT, *dataspace));
-
- delete dataset;
- delete dataspace;
- delete group;
- delete file;
-
- /*
- * Now reopen the file and group in the file.
- */
- file = new H5File(FILE_NAME, H5F_ACC_RDWR);
- group = new Group(file->openGroup("Data"));
-
- /*
- * Access "Compressed_Data" dataset in the group.
- */
- try { // to determine if the dataset exists in the group
- dataset = new DataSet( group->openDataSet( "Compressed_Data" ));
- }
- catch( GroupIException not_found_error ) {
- cout << " Dataset is not found." << endl;
- }
- cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
-
- /*
- * Close the dataset.
- */
- delete dataset;
-
- /*
- * Create hard link to the Data group.
- */
- file->link( H5L_TYPE_HARD, "Data", "Data_new" );
-
- /*
- * We can access "Compressed_Data" dataset using created
- * hard link "Data_new".
- */
- try { // to determine if the dataset exists in the file
- dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" ));
- }
- catch( FileIException not_found_error )
- {
- cout << " Dataset is not found." << endl;
- }
- cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
-
- /*
- * Close the dataset.
- */
- delete dataset;
-
- /*
- * Use iterator to see the names of the objects in the file
- * root directory.
- */
- cout << endl << "Iterating over elements in the file" << endl;
- herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
- cout << endl;
-
- /*
- * Unlink name "Data" and use iterator to see the names
- * of the objects in the file root direvtory.
- */
- cout << "Unlinking..." << endl;
- try { // attempt to unlink the dataset
- file->unlink( "Data" );
- }
- catch( FileIException unlink_error )
- {
- cout << " unlink failed." << endl;
- }
- cout << "\"Data\" is unlinked" << endl;
-
- cout << endl << "Iterating over elements in the file again" << endl;
- idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
- cout << endl;
-
- /*
- * Close the group and file.
- */
- delete group;
- delete file;
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create the named file, truncating the existing one if any,
+ * using default create and access property lists.
+ */
+ H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+
+ /*
+ * Create a group in the file
+ */
+ Group* group = new Group( file->createGroup( "/Data" ));
+
+ /*
+ * Create dataset "Compressed Data" in the group using absolute
+ * name. Dataset creation property list is modified to use
+ * GZIP compression with the compression effort set to 6.
+ * Note that compression can be used only when dataset is chunked.
+ */
+ dims[0] = 1000;
+ dims[1] = 20;
+ cdims[0] = 20;
+ cdims[1] = 20;
+ DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk( 2, cdims ); // then modify it for compression
+ ds_creatplist.setDeflate( 6 );
+
+ /*
+ * Create the first dataset.
+ */
+ DataSet* dataset = new DataSet(file->createDataSet(
+ "/Data/Compressed_Data", PredType::NATIVE_INT,
+ *dataspace, ds_creatplist ));
+
+ /*
+ * Close the first dataset.
+ */
+ delete dataset;
+ delete dataspace;
+
+ /*
+ * Create the second dataset.
+ */
+ dims[0] = 500;
+ dims[1] = 20;
+ dataspace = new DataSpace(RANK, dims); // create second dspace
+ dataset = new DataSet(file->createDataSet("/Data/Float_Data",
+ PredType::NATIVE_FLOAT, *dataspace));
+
+ delete dataset;
+ delete dataspace;
+ delete group;
+ delete file;
+
+ /*
+ * Now reopen the file and group in the file.
+ */
+ file = new H5File(FILE_NAME, H5F_ACC_RDWR);
+ group = new Group(file->openGroup("Data"));
+
+ /*
+ * Access "Compressed_Data" dataset in the group.
+ */
+ try { // to determine if the dataset exists in the group
+ dataset = new DataSet( group->openDataSet( "Compressed_Data" ));
+ }
+ catch( GroupIException not_found_error ) {
+ cout << " Dataset is not found." << endl;
+ }
+ cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
+
+ /*
+ * Close the dataset.
+ */
+ delete dataset;
+
+ /*
+ * Create hard link to the Data group.
+ */
+ file->link( H5L_TYPE_HARD, "Data", "Data_new" );
+
+ /*
+ * We can access "Compressed_Data" dataset using created
+ * hard link "Data_new".
+ */
+ try { // to determine if the dataset exists in the file
+ dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" ));
+ }
+ catch( FileIException not_found_error )
+ {
+ cout << " Dataset is not found." << endl;
+ }
+ cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
+
+ /*
+ * Close the dataset.
+ */
+ delete dataset;
+
+ /*
+ * Use iterator to see the names of the objects in the file
+ * root directory.
+ */
+ cout << endl << "Iterating over elements in the file" << endl;
+ herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
+ cout << endl;
+
+ /*
+ * Unlink name "Data" and use iterator to see the names
+ * of the objects in the file root direvtory.
+ */
+ cout << "Unlinking..." << endl;
+ try { // attempt to unlink the dataset
+ file->unlink( "Data" );
+ }
+ catch( FileIException unlink_error )
+ {
+ cout << " unlink failed." << endl;
+ }
+ cout << "\"Data\" is unlinked" << endl;
+
+ cout << endl << "Iterating over elements in the file again" << endl;
+ idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
+ cout << endl;
+
+ /*
+ * Close the group and file.
+ */
+ delete group;
+ delete file;
} // end of try block
// catch failure caused by the H5File operations
catch( FileIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the Attribute operations
catch( AttributeIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
}
diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp
index 9b1d2bc..9531bdd 100644
--- a/c++/examples/h5tutr_cmprss.cpp
+++ b/c++/examples/h5tutr_cmprss.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -24,130 +24,130 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_cmprss.h5");
-const H5std_string DATASET_NAME("Compressed_Data");
-const int DIM0 = 100;
-const int DIM1 = 20;
+const H5std_string FILE_NAME("h5tutr_cmprss.h5");
+const H5std_string DATASET_NAME("Compressed_Data");
+const int DIM0 = 100;
+const int DIM1 = 20;
int main (void)
{
- hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions
- hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions
+ hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions
+ hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions
int i,j, buf[DIM0][DIM1];
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Create a new file using the default property lists.
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
+ // Create a new file using the default property lists.
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
- // Create the data space for the dataset.
- DataSpace *dataspace = new DataSpace(2, dims);
+ // Create the data space for the dataset.
+ DataSpace *dataspace = new DataSpace(2, dims);
- // Modify dataset creation property to enable chunking
- DSetCreatPropList *plist = new DSetCreatPropList;
- plist->setChunk(2, chunk_dims);
+ // Modify dataset creation property to enable chunking
+ DSetCreatPropList *plist = new DSetCreatPropList;
+ plist->setChunk(2, chunk_dims);
- // Set ZLIB (DEFLATE) Compression using level 6.
- // To use SZIP compression comment out this line.
- plist->setDeflate(6);
+ // Set ZLIB (DEFLATE) Compression using level 6.
+ // To use SZIP compression comment out this line.
+ plist->setDeflate(6);
- // Uncomment these lines to set SZIP Compression
- // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
- // unsigned szip_pixels_per_block = 16;
- // plist->setSzip(szip_options_mask, szip_pixels_per_block);
+ // Uncomment these lines to set SZIP Compression
+ // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
+ // unsigned szip_pixels_per_block = 16;
+ // plist->setSzip(szip_options_mask, szip_pixels_per_block);
- // Create the dataset.
- DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, *dataspace, *plist) );
-
- for (i = 0; i< DIM0; i++)
- for (j=0; j<DIM1; j++)
- buf[i][j] = i+j;
-
- // Write data to dataset.
- dataset->write(buf, PredType::NATIVE_INT);
-
- // Close objects and file. Either approach will close the HDF5 item.
- delete dataspace;
- delete dataset;
- delete plist;
- file.close();
-
- // -----------------------------------------------
- // Re-open the file and dataset, retrieve filter
- // information for dataset and read the data back.
- // -----------------------------------------------
-
- int rbuf[DIM0][DIM1];
- int numfilt;
- size_t nelmts={1}, namelen={1};
- unsigned flags, filter_info, cd_values[1], idx;
- char name[1];
- H5Z_filter_t filter_type;
-
- // Open the file and the dataset in the file.
- file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASET_NAME));
-
- // Get the create property list of the dataset.
- plist = new DSetCreatPropList(dataset->getCreatePlist ());
-
- // Get the number of filters associated with the dataset.
- numfilt = plist->getNfilters();
- cout << "Number of filters associated with dataset: " << numfilt << endl;
-
- for (idx=0; idx < numfilt; idx++) {
- nelmts = 0;
-
- filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info);
-
- cout << "Filter Type: ";
-
- switch (filter_type) {
- case H5Z_FILTER_DEFLATE:
- cout << "H5Z_FILTER_DEFLATE" << endl;
- break;
- case H5Z_FILTER_SZIP:
- cout << "H5Z_FILTER_SZIP" << endl;
- break;
- default:
- cout << "Other filter type included." << endl;
- }
- }
-
- // Read data.
- dataset->read(rbuf, PredType::NATIVE_INT);
-
- delete plist;
- delete dataset;
- file.close(); // can be skipped
+ // Create the dataset.
+ DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
+ PredType::STD_I32BE, *dataspace, *plist) );
+
+ for (i = 0; i< DIM0; i++)
+ for (j=0; j<DIM1; j++)
+ buf[i][j] = i+j;
+
+ // Write data to dataset.
+ dataset->write(buf, PredType::NATIVE_INT);
+
+ // Close objects and file. Either approach will close the HDF5 item.
+ delete dataspace;
+ delete dataset;
+ delete plist;
+ file.close();
+
+ // -----------------------------------------------
+ // Re-open the file and dataset, retrieve filter
+ // information for dataset and read the data back.
+ // -----------------------------------------------
+
+ int rbuf[DIM0][DIM1];
+ int numfilt;
+ size_t nelmts={1}, namelen={1};
+ unsigned flags, filter_info, cd_values[1], idx;
+ char name[1];
+ H5Z_filter_t filter_type;
+
+ // Open the file and the dataset in the file.
+ file.openFile(FILE_NAME, H5F_ACC_RDONLY);
+ dataset = new DataSet(file.openDataSet( DATASET_NAME));
+
+ // Get the create property list of the dataset.
+ plist = new DSetCreatPropList(dataset->getCreatePlist ());
+
+ // Get the number of filters associated with the dataset.
+ numfilt = plist->getNfilters();
+ cout << "Number of filters associated with dataset: " << numfilt << endl;
+
+ for (idx=0; idx < numfilt; idx++) {
+ nelmts = 0;
+
+ filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info);
+
+ cout << "Filter Type: ";
+
+ switch (filter_type) {
+ case H5Z_FILTER_DEFLATE:
+ cout << "H5Z_FILTER_DEFLATE" << endl;
+ break;
+ case H5Z_FILTER_SZIP:
+ cout << "H5Z_FILTER_SZIP" << endl;
+ break;
+ default:
+ cout << "Other filter type included." << endl;
+ }
+ }
+
+ // Read data.
+ dataset->read(rbuf, PredType::NATIVE_INT);
+
+ delete plist;
+ delete dataset;
+ file.close(); // can be skipped
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch(DataSpaceIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp
index f865501..fcf6c27 100644
--- a/c++/examples/h5tutr_crtatt.cpp
+++ b/c++/examples/h5tutr_crtatt.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -21,11 +21,11 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME( "h5tutr_dset.h5" );
-const H5std_string DATASET_NAME( "dset" );
-const H5std_string ATTR_NAME( "Units" );
+const H5std_string FILE_NAME( "h5tutr_dset.h5" );
+const H5std_string DATASET_NAME( "dset" );
+const H5std_string ATTR_NAME( "Units" );
-const int DIM1 = 2;
+const int DIM1 = 2;
int main (void)
{
@@ -36,52 +36,52 @@ int main (void)
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Open an existing file and dataset.
- H5File file( FILE_NAME, H5F_ACC_RDWR );
- DataSet dataset = file.openDataSet( DATASET_NAME );
+ // Open an existing file and dataset.
+ H5File file( FILE_NAME, H5F_ACC_RDWR );
+ DataSet dataset = file.openDataSet( DATASET_NAME );
- // Create the data space for the attribute.
- DataSpace attr_dataspace = DataSpace (1, dims );
+ // Create the data space for the attribute.
+ DataSpace attr_dataspace = DataSpace (1, dims );
- // Create a dataset attribute.
- Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
- attr_dataspace);
+ // Create a dataset attribute.
+ Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
+ attr_dataspace);
- // Write the attribute data.
- attribute.write( PredType::NATIVE_INT, attr_data);
+ // Write the attribute data.
+ attribute.write( PredType::NATIVE_INT, attr_data);
} // end of try block
// catch failure caused by the H5File operations
catch( DataSpaceIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the H5File operations
catch( AttributeIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the H5File operations
catch( FileIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp
index 7cd49f8..985f6ac 100644
--- a/c++/examples/h5tutr_crtdat.cpp
+++ b/c++/examples/h5tutr_crtdat.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -18,57 +18,58 @@
#include <iostream>
#include <string>
+
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int NX = 4; // dataset dimensions
-const int NY = 6;
-const int RANK = 2;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int NX = 4; // dataset dimensions
+const int NY = 6;
+const int RANK = 2;
int main (void)
{
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Create a new file using the default property lists.
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
+ // Create a new file using the default property lists.
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
- // Create the data space for the dataset.
- hsize_t dims[2]; // dataset dimensions
- dims[0] = NX;
- dims[1] = NY;
- DataSpace dataspace(RANK, dims);
+ // Create the data space for the dataset.
+ hsize_t dims[2]; // dataset dimensions
+ dims[0] = NX;
+ dims[1] = NY;
+ DataSpace dataspace(RANK, dims);
- // Create the dataset.
- DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
+ // Create the dataset.
+ DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch(DataSpaceIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp
index 4bdb02c..e35cb46 100644
--- a/c++/examples/h5tutr_crtgrp.cpp
+++ b/c++/examples/h5tutr_crtgrp.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -31,31 +31,31 @@ int main(void)
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Create a new file using default property lists.
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
-
- // Create a group named "/MygGroup" in the file
- Group group(file.createGroup("/MyGroup"));
+ // Create a new file using default property lists.
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ // Create a group named "/MygGroup" in the file
+ Group group(file.createGroup("/MyGroup"));
- // File and group will be closed as their instances go out of scope.
+ // File and group will be closed as their instances go out of scope.
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the Group operations
catch(GroupIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp
index 3e175d6..76ec9e5 100644
--- a/c++/examples/h5tutr_crtgrpar.cpp
+++ b/c++/examples/h5tutr_crtgrpar.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -33,50 +33,50 @@ int main(void)
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately.
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately.
- Exception::dontPrint();
+ Exception::dontPrint();
- // Create a new file using default properties.
+ // Create a new file using default properties.
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
- // Create group "MyGroup" in the root group using an absolute name.
-
- Group group1(file.createGroup( "/MyGroup"));
+ // Create group "MyGroup" in the root group using an absolute name.
+
+ Group group1(file.createGroup( "/MyGroup"));
- // Create group "Group_A" in group "MyGroup" using an
- // absolute name.
+ // Create group "Group_A" in group "MyGroup" using an
+ // absolute name.
- Group group2(file.createGroup("/MyGroup/Group_A"));
+ Group group2(file.createGroup("/MyGroup/Group_A"));
- // Create group "Group_B" in group "MyGroup" using a
- // relative name.
+ // Create group "Group_B" in group "MyGroup" using a
+ // relative name.
- Group group3(group1.createGroup ("Group_B"));
+ Group group3(group1.createGroup ("Group_B"));
- // Close the groups and file.
+ // Close the groups and file.
- group1.close();
- group2.close();
- group3.close();
- file.close();
+ group1.close();
+ group2.close();
+ group3.close();
+ file.close();
} // end of try block
// catch failure caused by the File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the Group operations
catch(GroupIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp
index 318ab1c..e3bb1b1 100644
--- a/c++/examples/h5tutr_crtgrpd.cpp
+++ b/c++/examples/h5tutr_crtgrpd.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -27,11 +27,11 @@ using namespace H5;
const H5std_string FILE_NAME("h5tutr_groups.h5");
const H5std_string DATASET_NAME1("/MyGroup/dset1");
const H5std_string DATASET_NAME2("dset2");
-const int RANK = 2;
-const int D1DIM1 = 3;
-const int D1DIM2 = 3;
-const int D2DIM1 = 2;
-const int D2DIM2 = 10;
+const int RANK = 2;
+const int D1DIM1 = 3;
+const int D1DIM2 = 3;
+const int D2DIM1 = 2;
+const int D2DIM2 = 10;
int main(void)
{
@@ -41,93 +41,93 @@ int main(void)
// Try block to catch exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Initialize the first dataset.
- for (i = 0; i < D1DIM1; i++)
- for (j = 0; j < D1DIM2; j++)
- dset1_data[i][j] = j + 1;
+ // Initialize the first dataset.
+ for (i = 0; i < D1DIM1; i++)
+ for (j = 0; j < D1DIM2; j++)
+ dset1_data[i][j] = j + 1;
- // Initialize the second dataset.
- for (i = 0; i < D2DIM1; i++)
- for (j = 0; j < D2DIM2; j++)
- dset2_data[i][j] = j + 1;
+ // Initialize the second dataset.
+ for (i = 0; i < D2DIM1; i++)
+ for (j = 0; j < D2DIM2; j++)
+ dset2_data[i][j] = j + 1;
- // Open an existing file and dataset.
- H5File file(FILE_NAME, H5F_ACC_RDWR);
+ // Open an existing file and dataset.
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
// Create the data space for the first dataset. Note the use of
// pointer for the instance 'dataspace'. It can be deleted and
// used again later for another data space. An HDF5 identifier is
// closed by the destructor or the method 'close()'.
- hsize_t dims[RANK]; // dataset dimensions
- dims[0] = D1DIM1;
- dims[1] = D1DIM2;
- DataSpace *dataspace = new DataSpace (RANK, dims);
-
- // Create the dataset in group "MyGroup". Same note as for the
- // dataspace above.
- DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
- PredType::STD_I32BE, *dataspace));
-
- // Write the data to the dataset using default memory space, file
- // space, and transfer properties.
- dataset->write(dset1_data, PredType::NATIVE_INT);
-
- // Close the current dataset and data space.
- delete dataset;
- delete dataspace;
-
- // Create the data space for the second dataset.
- dims[0] = D2DIM1;
- dims[1] = D2DIM2;
- dataspace = new DataSpace (RANK, dims);
-
- // Create group "Group_A" in group "MyGroup".
- Group group(file.openGroup("/MyGroup/Group_A"));
-
- // Create the second dataset in group "Group_A".
- dataset = new DataSet (group.createDataSet(DATASET_NAME2,
- PredType::STD_I32BE, *dataspace));
-
- // Write the data to the dataset using default memory space, file
- // space, and transfer properties.
- dataset->write(dset2_data, PredType::NATIVE_INT);
-
- // Close all objects.
- delete dataspace;
- delete dataset;
- group.close();
+ hsize_t dims[RANK]; // dataset dimensions
+ dims[0] = D1DIM1;
+ dims[1] = D1DIM2;
+ DataSpace *dataspace = new DataSpace (RANK, dims);
+
+ // Create the dataset in group "MyGroup". Same note as for the
+ // dataspace above.
+ DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
+ PredType::STD_I32BE, *dataspace));
+
+ // Write the data to the dataset using default memory space, file
+ // space, and transfer properties.
+ dataset->write(dset1_data, PredType::NATIVE_INT);
+
+ // Close the current dataset and data space.
+ delete dataset;
+ delete dataspace;
+
+ // Create the data space for the second dataset.
+ dims[0] = D2DIM1;
+ dims[1] = D2DIM2;
+ dataspace = new DataSpace (RANK, dims);
+
+ // Create group "Group_A" in group "MyGroup".
+ Group group(file.openGroup("/MyGroup/Group_A"));
+
+ // Create the second dataset in group "Group_A".
+ dataset = new DataSet (group.createDataSet(DATASET_NAME2,
+ PredType::STD_I32BE, *dataspace));
+
+ // Write the data to the dataset using default memory space, file
+ // space, and transfer properties.
+ dataset->write(dset2_data, PredType::NATIVE_INT);
+
+ // Close all objects.
+ delete dataspace;
+ delete dataset;
+ group.close();
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch(DataSpaceIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the Group operations
catch(GroupIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index 8c1bc03..b6927ea 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -24,17 +24,17 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_extend.h5");
-const H5std_string DATASETNAME("ExtendibleArray");
+const H5std_string FILE_NAME("h5tutr_extend.h5");
+const H5std_string DATASETNAME("ExtendibleArray");
int main (void)
{
- hsize_t dims[2] = {3,3}; // dataset dimensions at creation
+ hsize_t dims[2] = {3,3}; // dataset dimensions at creation
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] ={2, 5};
- int data[3][3] = { {1, 1, 1}, // data to write
- {1, 1, 1},
- {1, 1, 1} };
+ int data[3][3] = { {1, 1, 1}, // data to write
+ {1, 1, 1},
+ {1, 1, 1} };
// Variables used in extending and writing to the extended portion of dataset
@@ -42,127 +42,127 @@ int main (void)
hsize_t offset[2];
hsize_t dimsext[2] = {7, 3}; // extend dimensions
int dataext[7][3] = { {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4},
- {2, 3, 4} };
+ {2, 3, 4},
+ {2, 3, 4},
+ {2, 3, 4},
+ {2, 3, 4},
+ {2, 3, 4},
+ {2, 3, 4} };
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
-
- // Create a new file using the default property lists.
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
-
- // Create the data space for the dataset. Note the use of pointer
- // for the instance 'dataspace'. It can be deleted and used again
- // later for another dataspace. An HDF5 identifier can be closed
- // by the destructor or the method 'close()'.
- DataSpace *dataspace = new DataSpace (2, dims, maxdims);
-
- // Modify dataset creation property to enable chunking
- DSetCreatPropList prop;
- prop.setChunk(2, chunk_dims);
-
- // Create the chunked dataset. Note the use of pointer.
- DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
- PredType::STD_I32BE, *dataspace, prop) );
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
+
+ // Create a new file using the default property lists.
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
+
+ // Create the data space for the dataset. Note the use of pointer
+ // for the instance 'dataspace'. It can be deleted and used again
+ // later for another dataspace. An HDF5 identifier can be closed
+ // by the destructor or the method 'close()'.
+ DataSpace *dataspace = new DataSpace (2, dims, maxdims);
+
+ // Modify dataset creation property to enable chunking
+ DSetCreatPropList prop;
+ prop.setChunk(2, chunk_dims);
+
+ // Create the chunked dataset. Note the use of pointer.
+ DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
+ PredType::STD_I32BE, *dataspace, prop) );
- // Write data to dataset.
- dataset->write(data, PredType::NATIVE_INT);
-
- // Extend the dataset. Dataset becomes 10 x 3.
- size[0] = dims[0] + dimsext[0];
- size[1] = dims[1];
- dataset->extend(size);
-
- // Select a hyperslab in extended portion of the dataset.
- DataSpace *filespace = new DataSpace(dataset->getSpace ());
- offset[0] = 3;
- offset[1] = 0;
- filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset);
-
- // Define memory space.
- DataSpace *memspace = new DataSpace(2, dimsext, NULL);
-
- // Write data to the extended portion of the dataset.
- dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace);
-
- // Close all objects and file.
- prop.close();
- delete filespace;
- delete memspace;
- delete dataspace;
- delete dataset;
- file.close();
-
- // ---------------------------------------
- // Re-open the file and read the data back
- // ---------------------------------------
-
- int rdata[10][3];
- int i,j, rank, rank_chunk;
- hsize_t chunk_dimsr[2], dimsr[2];
-
- // Open the file and dataset.
- file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASETNAME));
-
- // Get the dataset's dataspace and creation property list.
- filespace = new DataSpace(dataset->getSpace());
- prop = dataset->getCreatePlist();
-
- // Get information to obtain memory dataspace.
- rank = filespace->getSimpleExtentNdims();
- herr_t status_n = filespace->getSimpleExtentDims(dimsr);
-
- if (H5D_CHUNKED == prop.getLayout())
- rank_chunk = prop.getChunk(rank, chunk_dimsr);
- cout << "rank chunk = " << rank_chunk << endl;;
-
- memspace = new DataSpace(rank, dimsr, NULL);
- dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
+ // Write data to dataset.
+ dataset->write(data, PredType::NATIVE_INT);
+
+ // Extend the dataset. Dataset becomes 10 x 3.
+ size[0] = dims[0] + dimsext[0];
+ size[1] = dims[1];
+ dataset->extend(size);
+
+ // Select a hyperslab in extended portion of the dataset.
+ DataSpace *filespace = new DataSpace(dataset->getSpace ());
+ offset[0] = 3;
+ offset[1] = 0;
+ filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset);
+
+ // Define memory space.
+ DataSpace *memspace = new DataSpace(2, dimsext, NULL);
+
+ // Write data to the extended portion of the dataset.
+ dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace);
+
+ // Close all objects and file.
+ prop.close();
+ delete filespace;
+ delete memspace;
+ delete dataspace;
+ delete dataset;
+ file.close();
+
+ // ---------------------------------------
+ // Re-open the file and read the data back
+ // ---------------------------------------
+
+ int rdata[10][3];
+ int i,j, rank, rank_chunk;
+ hsize_t chunk_dimsr[2], dimsr[2];
+
+ // Open the file and dataset.
+ file.openFile(FILE_NAME, H5F_ACC_RDONLY);
+ dataset = new DataSet(file.openDataSet( DATASETNAME));
+
+ // Get the dataset's dataspace and creation property list.
+ filespace = new DataSpace(dataset->getSpace());
+ prop = dataset->getCreatePlist();
+
+ // Get information to obtain memory dataspace.
+ rank = filespace->getSimpleExtentNdims();
+ herr_t status_n = filespace->getSimpleExtentDims(dimsr);
+
+ if (H5D_CHUNKED == prop.getLayout())
+ rank_chunk = prop.getChunk(rank, chunk_dimsr);
+ cout << "rank chunk = " << rank_chunk << endl;;
+
+ memspace = new DataSpace(rank, dimsr, NULL);
+ dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
- cout << endl;
- for (j = 0; j < dimsr[0]; j++) {
- for (i = 0; i < dimsr[1]; i++)
- cout << " " << rdata[j][i];
- cout << endl;
- }
-
- // Close all objects and file.
- prop.close();
- delete filespace;
- delete memspace;
- delete dataset;
- file.close();
+ cout << endl;
+ for (j = 0; j < dimsr[0]; j++) {
+ for (i = 0; i < dimsr[1]; i++)
+ cout << " " << rdata[j][i];
+ cout << endl;
+ }
+
+ // Close all objects and file.
+ prop.close();
+ delete filespace;
+ delete memspace;
+ delete dataset;
+ file.close();
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch(DataSpaceIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp
index 4c9d49e..f17e6a5 100644
--- a/c++/examples/h5tutr_rdwt.cpp
+++ b/c++/examples/h5tutr_rdwt.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -21,10 +21,10 @@
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_dset.h5");
-const H5std_string DATASET_NAME("dset");
-const int DIM0 = 4; // dataset dimensions
-const int DIM1 = 6;
+const H5std_string FILE_NAME("h5tutr_dset.h5");
+const H5std_string DATASET_NAME("dset");
+const int DIM0 = 4; // dataset dimensions
+const int DIM1 = 6;
int main (void)
{
@@ -32,41 +32,41 @@ int main (void)
// Data initialization.
int i, j;
- int data[DIM0][DIM1]; // buffer for data to write
+ int data[DIM0][DIM1]; // buffer for data to write
for (j = 0; j < DIM0; j++)
- for (i = 0; i < DIM1; i++)
- data[j][i] = i * 6 + j + 1;
+ for (i = 0; i < DIM1; i++)
+ data[j][i] = i * 6 + j + 1;
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
- // Open an existing file and dataset.
- H5File file(FILE_NAME, H5F_ACC_RDWR);
- DataSet dataset = file.openDataSet(DATASET_NAME);
+ // Open an existing file and dataset.
+ H5File file(FILE_NAME, H5F_ACC_RDWR);
+ DataSet dataset = file.openDataSet(DATASET_NAME);
- // Write the data to the dataset using default memory space, file
- // space, and transfer properties.
- dataset.write(data, PredType::NATIVE_INT);
+ // Write the data to the dataset using default memory space, file
+ // space, and transfer properties.
+ dataset.write(data, PredType::NATIVE_INT);
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp
index 14a9ced..0747880 100644
--- a/c++/examples/h5tutr_subset.cpp
+++ b/c++/examples/h5tutr_subset.cpp
@@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
@@ -24,13 +24,13 @@ using std::endl;
#include "H5Cpp.h"
using namespace H5;
-const H5std_string FILE_NAME("h5tutr_subset.h5");
-const H5std_string DATASET_NAME("IntArray");
+const H5std_string FILE_NAME("h5tutr_subset.h5");
+const H5std_string DATASET_NAME("IntArray");
const int RANK = 2;
-const int DIM0_SUB = 3; // subset dimensions
+const int DIM0_SUB = 3; // subset dimensions
const int DIM1_SUB = 4;
-const int DIM0 = 8; // size of dataset
+const int DIM0 = 8; // size of dataset
const int DIM1 = 10;
int main (void)
@@ -41,134 +41,134 @@ int main (void)
// Try block to detect exceptions raised by any of the calls inside it
try
{
- // Turn off the auto-printing when failure occurs so that we can
- // handle the errors appropriately
- Exception::dontPrint();
-
- // ---------------------------------------------------
- // Create a new file using the default property lists.
- // Then create a dataset and write data to it.
- // Close the file and dataset.
- // ---------------------------------------------------
+ // Turn off the auto-printing when failure occurs so that we can
+ // handle the errors appropriately
+ Exception::dontPrint();
+
+ // ---------------------------------------------------
+ // Create a new file using the default property lists.
+ // Then create a dataset and write data to it.
+ // Close the file and dataset.
+ // ---------------------------------------------------
- H5File file(FILE_NAME, H5F_ACC_TRUNC);
+ H5File file(FILE_NAME, H5F_ACC_TRUNC);
- hsize_t dims[2];
- dims[0] = DIM0;
- dims[1] = DIM1;
- DataSpace dataspace = DataSpace (RANK, dims);
+ hsize_t dims[2];
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ DataSpace dataspace = DataSpace (RANK, dims);
- DataSet dataset(file.createDataSet( DATASET_NAME,
- PredType::STD_I32BE, dataspace) );
+ DataSet dataset(file.createDataSet( DATASET_NAME,
+ PredType::STD_I32BE, dataspace) );
- for (j = 0; j < DIM0; j++) {
- for (i = 0; i < DIM1; i++)
- if (i< (DIM1/2))
- data[j][i] = 1;
- else
- data[j][i] = 2;
- }
+ for (j = 0; j < DIM0; j++) {
+ for (i = 0; i < DIM1; i++)
+ if (i< (DIM1/2))
+ data[j][i] = 1;
+ else
+ data[j][i] = 2;
+ }
- dataset.write(data, PredType::NATIVE_INT);
+ dataset.write(data, PredType::NATIVE_INT);
- cout << endl << "Data Written to File:" << endl;
- for (j = 0; j < DIM0; j++) {
- for (i = 0; i < DIM1; i++)
- cout << " " << data[j][i];
- cout << endl;
- }
+ cout << endl << "Data Written to File:" << endl;
+ for (j = 0; j < DIM0; j++) {
+ for (i = 0; i < DIM1; i++)
+ cout << " " << data[j][i];
+ cout << endl;
+ }
- dataspace.close();
- dataset.close();
- file.close();
+ dataspace.close();
+ dataset.close();
+ file.close();
- // ---------------------------------------------------
- // Reopen the file and dataset and write a subset of
- // values to the dataset.
- // ---------------------------------------------------
+ // ---------------------------------------------------
+ // Reopen the file and dataset and write a subset of
+ // values to the dataset.
+ // ---------------------------------------------------
- hsize_t offset[2], count[2], stride[2], block[2];
- hsize_t dimsm[2];
+ hsize_t offset[2], count[2], stride[2], block[2];
+ hsize_t dimsm[2];
- file.openFile(FILE_NAME, H5F_ACC_RDWR);
- dataset = file.openDataSet(DATASET_NAME);
+ file.openFile(FILE_NAME, H5F_ACC_RDWR);
+ dataset = file.openDataSet(DATASET_NAME);
- // Specify size and shape of subset to write.
+ // Specify size and shape of subset to write.
- offset[0] = 1;
- offset[1] = 2;
+ offset[0] = 1;
+ offset[1] = 2;
- count[0] = DIM0_SUB;
- count[1] = DIM1_SUB;
+ count[0] = DIM0_SUB;
+ count[1] = DIM1_SUB;
- stride[0] = 1;
- stride[1] = 1;
+ stride[0] = 1;
+ stride[1] = 1;
- block[0] = 1;
- block[1] = 1;
+ block[0] = 1;
+ block[1] = 1;
- // Define Memory Dataspace. Get file dataspace and select
- // a subset from the file dataspace.
+ // Define Memory Dataspace. Get file dataspace and select
+ // a subset from the file dataspace.
- dimsm[0] = DIM0_SUB;
- dimsm[1] = DIM1_SUB;
+ dimsm[0] = DIM0_SUB;
+ dimsm[1] = DIM1_SUB;
- DataSpace memspace(RANK, dimsm, NULL);
+ DataSpace memspace(RANK, dimsm, NULL);
- dataspace = dataset.getSpace();
- dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block);
+ dataspace = dataset.getSpace();
+ dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block);
- // Write a subset of data to the dataset, then read the
- // entire dataset back from the file.
+ // Write a subset of data to the dataset, then read the
+ // entire dataset back from the file.
- cout << endl << "Write subset to file specifying: " << endl;
- cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl;
- for (j = 0; j < DIM0_SUB; j++) {
- for (i = 0; i < DIM1_SUB; i++)
- sdata[j][i] = 5;
- }
-
- dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace);
- dataset.read(rdata, PredType::NATIVE_INT);
+ cout << endl << "Write subset to file specifying: " << endl;
+ cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl;
+ for (j = 0; j < DIM0_SUB; j++) {
+ for (i = 0; i < DIM1_SUB; i++)
+ sdata[j][i] = 5;
+ }
+
+ dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace);
+ dataset.read(rdata, PredType::NATIVE_INT);
- cout << endl << "Data in File after Subset is Written:" << endl;
- for (i = 0; i < DIM0; i++) {
- for (j = 0; j < DIM1; j++)
- cout << " " << rdata[i][j];
- cout << endl;
- }
- cout << endl;
-
- // It is not necessary to close these objects because close() will
- // be called when the object instances are going out of scope.
- dataspace.close();
- memspace.close();
- dataset.close();
- file.close();
+ cout << endl << "Data in File after Subset is Written:" << endl;
+ for (i = 0; i < DIM0; i++) {
+ for (j = 0; j < DIM1; j++)
+ cout << " " << rdata[i][j];
+ cout << endl;
+ }
+ cout << endl;
+
+ // It is not necessary to close these objects because close() will
+ // be called when the object instances are going out of scope.
+ dataspace.close();
+ memspace.close();
+ dataset.close();
+ file.close();
} // end of try block
// catch failure caused by the H5File operations
catch(FileIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch(DataSetIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch(DataSpaceIException error)
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0; // successfully terminated
diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp
index 5a2f3bc..3df8191 100644
--- a/c++/examples/readdata.cpp
+++ b/c++/examples/readdata.cpp
@@ -31,9 +31,9 @@ using namespace H5;
const H5std_string FILE_NAME( "SDS.h5" );
const H5std_string DATASET_NAME( "IntArray" );
-const int NX_SUB = 3; // hyperslab dimensions
+const int NX_SUB = 3; // hyperslab dimensions
const int NY_SUB = 4;
-const int NX = 7; // output buffer dimensions
+const int NX = 7; // output buffer dimensions
const int NY = 7;
const int NZ = 3;
const int RANK_OUT = 3;
@@ -49,8 +49,8 @@ int main (void)
{
for (i = 0; i < NY; i++)
{
- for (k = 0; k < NZ ; k++)
- data_out[j][i][k] = 0;
+ for (k = 0; k < NZ ; k++)
+ data_out[j][i][k] = 0;
}
}
@@ -81,19 +81,19 @@ int main (void)
*/
if( type_class == H5T_INTEGER )
{
- cout << "Data set has INTEGER type" << endl;
+ cout << "Data set has INTEGER type" << endl;
/*
- * Get the integer datatype
+ * Get the integer datatype
*/
- IntType intype = dataset.getIntType();
+ IntType intype = dataset.getIntType();
/*
* Get order of datatype and print message if it's a little endian.
*/
- H5std_string order_string;
+ H5std_string order_string;
H5T_order_t order = intype.getOrder( order_string );
- cout << order_string << endl;
+ cout << order_string << endl;
/*
* Get size of the data element stored in file and print it.
@@ -119,15 +119,15 @@ int main (void)
hsize_t dims_out[2];
int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);
cout << "rank " << rank << ", dimensions " <<
- (unsigned long)(dims_out[0]) << " x " <<
- (unsigned long)(dims_out[1]) << endl;
+ (unsigned long)(dims_out[0]) << " x " <<
+ (unsigned long)(dims_out[1]) << endl;
/*
* Define hyperslab in the dataset; implicitly giving strike and
* block NULL.
*/
- hsize_t offset[2]; // hyperslab offset in the file
- hsize_t count[2]; // size of the hyperslab in the file
+ hsize_t offset[2]; // hyperslab offset in the file
+ hsize_t count[2]; // size of the hyperslab in the file
offset[0] = 1;
offset[1] = 2;
count[0] = NX_SUB;
@@ -146,8 +146,8 @@ int main (void)
/*
* Define memory hyperslab.
*/
- hsize_t offset_out[3]; // hyperslab offset in memory
- hsize_t count_out[3]; // size of the hyperslab in memory
+ hsize_t offset_out[3]; // hyperslab offset in memory
+ hsize_t count_out[3]; // size of the hyperslab in memory
offset_out[0] = 3;
offset_out[1] = 0;
offset_out[2] = 0;
@@ -164,9 +164,9 @@ int main (void)
for (j = 0; j < NX; j++)
{
- for (i = 0; i < NY; i++)
- cout << data_out[j][i][0] << " ";
- cout << endl;
+ for (i = 0; i < NY; i++)
+ cout << data_out[j][i][0] << " ";
+ cout << endl;
}
/*
* 0 0 0 0 0 0 0
diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp
index f5c06cf..eada2ed 100644
--- a/c++/examples/writedata.cpp
+++ b/c++/examples/writedata.cpp
@@ -34,19 +34,19 @@ using namespace H5;
const H5std_string FILE_NAME( "Select.h5" );
const H5std_string DATASET_NAME( "Matrix in file" );
-const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
+const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
const int MSPACE1_DIM = 50; // Dataset size in memory
-const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
-const int MSPACE2_DIM = 4; // Dataset size in memory
-const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
-const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
-const int FSPACE_DIM2 = 12; // stored in the file
-const int MSPACE_RANK = 2; // Rank of the first dataset in memory
-const int MSPACE_DIM1 = 8; // We will read dataset back from the file
-const int MSPACE_DIM2 = 9; // to the dataset in memory with these
- // dataspace parameters
-const int NPOINTS = 4; // Number of points that will be selected
- // and overwritten
+const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
+const int MSPACE2_DIM = 4; // Dataset size in memory
+const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
+const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
+const int FSPACE_DIM2 = 12; // stored in the file
+const int MSPACE_RANK = 2; // Rank of the first dataset in memory
+const int MSPACE_DIM1 = 8; // We will read dataset back from the file
+const int MSPACE_DIM2 = 9; // to the dataset in memory with these
+ // dataspace parameters
+const int NPOINTS = 4; // Number of points that will be selected
+ // and overwritten
int main (void)
{
@@ -57,271 +57,271 @@ int main (void)
*/
try
{
- /*
- * Turn off the auto-printing when failure occurs so that we can
- * handle the errors appropriately
- */
- Exception::dontPrint();
-
- /*
- * Create a file.
- */
- H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
-
- /*
- * Create property list for a dataset and set up fill values.
- */
- int fillvalue = 0; /* Fill value for the dataset */
- DSetCreatPropList plist;
- plist.setFillValue(PredType::NATIVE_INT, &fillvalue);
-
- /*
- * Create dataspace for the dataset in the file.
- */
- hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
- DataSpace fspace( FSPACE_RANK, fdim );
-
- /*
- * Create dataset and write it into the file.
- */
- DataSet* dataset = new DataSet(file->createDataSet(
- DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
-
- /*
- * Select hyperslab for the dataset in the file, using 3x2 blocks,
- * (4,3) stride and (2,4) count starting at the position (0,1).
- */
- hsize_t start[2]; // Start of hyperslab
- hsize_t stride[2]; // Stride of hyperslab
- hsize_t count[2]; // Block count
- hsize_t block[2]; // Block sizes
- start[0] = 0; start[1] = 1;
- stride[0] = 4; stride[1] = 3;
- count[0] = 2; count[1] = 4;
- block[0] = 3; block[1] = 2;
- fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
-
- /*
- * Create dataspace for the first dataset.
- */
- hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
- (in memory) */
- DataSpace mspace1( MSPACE1_RANK, dim1 );
-
- /*
- * Select hyperslab.
- * We will use 48 elements of the vector buffer starting at the
- * second element. Selected elements are 1 2 3 . . . 48
- */
- start[0] = 1;
- stride[0] = 1;
- count[0] = 48;
- block[0] = 1;
- mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
-
- /*
- * Write selection from the vector buffer to the dataset in the file.
- *
- * File dataset should look like this:
- * 0 1 2 0 3 4 0 5 6 0 7 8
- * 0 9 10 0 11 12 0 13 14 0 15 16
- * 0 17 18 0 19 20 0 21 22 0 23 24
- * 0 0 0 0 0 0 0 0 0 0 0 0
- * 0 25 26 0 27 28 0 29 30 0 31 32
- * 0 33 34 0 35 36 0 37 38 0 39 40
- * 0 41 42 0 43 44 0 45 46 0 47 48
- * 0 0 0 0 0 0 0 0 0 0 0 0
- */
- int vector[MSPACE1_DIM]; // vector buffer for dset
-
- /*
- * Buffer initialization.
- */
- vector[0] = vector[MSPACE1_DIM - 1] = -1;
- for (i = 1; i < MSPACE1_DIM - 1; i++)
- vector[i] = i;
-
- dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace );
-
- /*
- * Reset the selection for the file dataspace fid.
- */
- fspace.selectNone();
-
- /*
- * Create dataspace for the second dataset.
- */
- hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
- (in memory */
- DataSpace mspace2( MSPACE2_RANK, dim2 );
-
- /*
- * Select sequence of NPOINTS points in the file dataspace.
- */
- hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
- from the file dataspace */
- coord[0][0] = 0; coord[0][1] = 0;
- coord[1][0] = 3; coord[1][1] = 3;
- coord[2][0] = 3; coord[2][1] = 5;
- coord[3][0] = 5; coord[3][1] = 6;
-
- fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
-
- /*
- * Write new selection of points to the dataset.
- */
- int values[] = {53, 59, 61, 67}; /* New values to be written */
- dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
-
- /*
- * File dataset should look like this:
- * 53 1 2 0 3 4 0 5 6 0 7 8
- * 0 9 10 0 11 12 0 13 14 0 15 16
- * 0 17 18 0 19 20 0 21 22 0 23 24
- * 0 0 0 59 0 61 0 0 0 0 0 0
- * 0 25 26 0 27 28 0 29 30 0 31 32
- * 0 33 34 0 35 36 67 37 38 0 39 40
- * 0 41 42 0 43 44 0 45 46 0 47 48
- * 0 0 0 0 0 0 0 0 0 0 0 0
- *
- */
-
- /*
- * Close the dataset and the file.
- */
- delete dataset;
- delete file;
-
- /*
- * Open the file.
- */
- file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
-
- /*
- * Open the dataset.
- */
- dataset = new DataSet( file->openDataSet( DATASET_NAME ));
-
- /*
- * Get dataspace of the dataset.
- */
- fspace = dataset->getSpace();
-
- /*
- * Select first hyperslab for the dataset in the file. The following
- * elements are selected:
- * 10 0 11 12
- * 18 0 19 20
- * 0 59 0 61
- *
- */
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
- fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
-
- /*
- * Add second selected hyperslab to the selection.
- * The following elements are selected:
- * 19 20 0 21 22
- * 0 61 0 0 0
- * 27 28 0 29 30
- * 35 36 67 37 38
- * 43 44 0 45 46
- * 0 0 0 0 0
- * Note that two hyperslabs overlap. Common elements are:
- * 19 20
- * 0 61
- */
- start[0] = 2; start[1] = 4;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
- fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
-
- /*
- * Create memory dataspace.
- */
- hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
+ /*
+ * Turn off the auto-printing when failure occurs so that we can
+ * handle the errors appropriately
+ */
+ Exception::dontPrint();
+
+ /*
+ * Create a file.
+ */
+ H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
+
+ /*
+ * Create property list for a dataset and set up fill values.
+ */
+ int fillvalue = 0; /* Fill value for the dataset */
+ DSetCreatPropList plist;
+ plist.setFillValue(PredType::NATIVE_INT, &fillvalue);
+
+ /*
+ * Create dataspace for the dataset in the file.
+ */
+ hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
+ DataSpace fspace( FSPACE_RANK, fdim );
+
+ /*
+ * Create dataset and write it into the file.
+ */
+ DataSet* dataset = new DataSet(file->createDataSet(
+ DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
+
+ /*
+ * Select hyperslab for the dataset in the file, using 3x2 blocks,
+ * (4,3) stride and (2,4) count starting at the position (0,1).
+ */
+ hsize_t start[2]; // Start of hyperslab
+ hsize_t stride[2]; // Stride of hyperslab
+ hsize_t count[2]; // Block count
+ hsize_t block[2]; // Block sizes
+ start[0] = 0; start[1] = 1;
+ stride[0] = 4; stride[1] = 3;
+ count[0] = 2; count[1] = 4;
+ block[0] = 3; block[1] = 2;
+ fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+
+ /*
+ * Create dataspace for the first dataset.
+ */
+ hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
+ (in memory) */
+ DataSpace mspace1( MSPACE1_RANK, dim1 );
+
+ /*
+ * Select hyperslab.
+ * We will use 48 elements of the vector buffer starting at the
+ * second element. Selected elements are 1 2 3 . . . 48
+ */
+ start[0] = 1;
+ stride[0] = 1;
+ count[0] = 48;
+ block[0] = 1;
+ mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
+
+ /*
+ * Write selection from the vector buffer to the dataset in the file.
+ *
+ * File dataset should look like this:
+ * 0 1 2 0 3 4 0 5 6 0 7 8
+ * 0 9 10 0 11 12 0 13 14 0 15 16
+ * 0 17 18 0 19 20 0 21 22 0 23 24
+ * 0 0 0 0 0 0 0 0 0 0 0 0
+ * 0 25 26 0 27 28 0 29 30 0 31 32
+ * 0 33 34 0 35 36 0 37 38 0 39 40
+ * 0 41 42 0 43 44 0 45 46 0 47 48
+ * 0 0 0 0 0 0 0 0 0 0 0 0
+ */
+ int vector[MSPACE1_DIM]; // vector buffer for dset
+
+ /*
+ * Buffer initialization.
+ */
+ vector[0] = vector[MSPACE1_DIM - 1] = -1;
+ for (i = 1; i < MSPACE1_DIM - 1; i++)
+ vector[i] = i;
+
+ dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace );
+
+ /*
+ * Reset the selection for the file dataspace fid.
+ */
+ fspace.selectNone();
+
+ /*
+ * Create dataspace for the second dataset.
+ */
+ hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
+ (in memory */
+ DataSpace mspace2( MSPACE2_RANK, dim2 );
+
+ /*
+ * Select sequence of NPOINTS points in the file dataspace.
+ */
+ hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
+ from the file dataspace */
+ coord[0][0] = 0; coord[0][1] = 0;
+ coord[1][0] = 3; coord[1][1] = 3;
+ coord[2][0] = 3; coord[2][1] = 5;
+ coord[3][0] = 5; coord[3][1] = 6;
+
+ fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
+
+ /*
+ * Write new selection of points to the dataset.
+ */
+ int values[] = {53, 59, 61, 67}; /* New values to be written */
+ dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
+
+ /*
+ * File dataset should look like this:
+ * 53 1 2 0 3 4 0 5 6 0 7 8
+ * 0 9 10 0 11 12 0 13 14 0 15 16
+ * 0 17 18 0 19 20 0 21 22 0 23 24
+ * 0 0 0 59 0 61 0 0 0 0 0 0
+ * 0 25 26 0 27 28 0 29 30 0 31 32
+ * 0 33 34 0 35 36 67 37 38 0 39 40
+ * 0 41 42 0 43 44 0 45 46 0 47 48
+ * 0 0 0 0 0 0 0 0 0 0 0 0
+ *
+ */
+
+ /*
+ * Close the dataset and the file.
+ */
+ delete dataset;
+ delete file;
+
+ /*
+ * Open the file.
+ */
+ file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
+
+ /*
+ * Open the dataset.
+ */
+ dataset = new DataSet( file->openDataSet( DATASET_NAME ));
+
+ /*
+ * Get dataspace of the dataset.
+ */
+ fspace = dataset->getSpace();
+
+ /*
+ * Select first hyperslab for the dataset in the file. The following
+ * elements are selected:
+ * 10 0 11 12
+ * 18 0 19 20
+ * 0 59 0 61
+ *
+ */
+ start[0] = 1; start[1] = 2;
+ block[0] = 1; block[1] = 1;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 3; count[1] = 4;
+ fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
+
+ /*
+ * Add second selected hyperslab to the selection.
+ * The following elements are selected:
+ * 19 20 0 21 22
+ * 0 61 0 0 0
+ * 27 28 0 29 30
+ * 35 36 67 37 38
+ * 43 44 0 45 46
+ * 0 0 0 0 0
+ * Note that two hyperslabs overlap. Common elements are:
+ * 19 20
+ * 0 61
+ */
+ start[0] = 2; start[1] = 4;
+ block[0] = 1; block[1] = 1;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 6; count[1] = 5;
+ fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
+
+ /*
+ * Create memory dataspace.
+ */
+ hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
dataset in memory when we
read selection from the
dataset on the disk */
- DataSpace mspace(MSPACE_RANK, mdim);
-
- /*
- * Select two hyperslabs in memory. Hyperslabs has the same
- * size and shape as the selected hyperslabs for the file dataspace.
- */
- start[0] = 0; start[1] = 0;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 3; count[1] = 4;
- mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
- start[0] = 1; start[1] = 2;
- block[0] = 1; block[1] = 1;
- stride[0] = 1; stride[1] = 1;
- count[0] = 6; count[1] = 5;
- mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
-
- /*
- * Initialize data buffer.
- */
- int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
- for (i = 0; i < MSPACE_DIM1; i++)
- for (j = 0; j < MSPACE_DIM2; j++)
- matrix_out[i][j] = 0;
-
- /*
- * Read data back to the buffer matrix.
- */
- dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace);
-
- /*
- * Display the result. Memory dataset is:
- *
- * 10 0 11 12 0 0 0 0 0
- * 18 0 19 20 0 21 22 0 0
- * 0 59 0 61 0 0 0 0 0
- * 0 0 27 28 0 29 30 0 0
- * 0 0 35 36 67 37 38 0 0
- * 0 0 43 44 0 45 46 0 0
- * 0 0 0 0 0 0 0 0 0
- * 0 0 0 0 0 0 0 0 0
- */
- for (i=0; i < MSPACE_DIM1; i++)
- {
- for(j=0; j < MSPACE_DIM2; j++)
- cout << matrix_out[i][j] << " ";
- cout << endl;
- }
-
- /*
- * Close the dataset and the file.
- */
- delete dataset;
- delete file;
+ DataSpace mspace(MSPACE_RANK, mdim);
+
+ /*
+ * Select two hyperslabs in memory. Hyperslabs has the same
+ * size and shape as the selected hyperslabs for the file dataspace.
+ */
+ start[0] = 0; start[1] = 0;
+ block[0] = 1; block[1] = 1;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 3; count[1] = 4;
+ mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
+ start[0] = 1; start[1] = 2;
+ block[0] = 1; block[1] = 1;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 6; count[1] = 5;
+ mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
+
+ /*
+ * Initialize data buffer.
+ */
+ int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
+ for (i = 0; i < MSPACE_DIM1; i++)
+ for (j = 0; j < MSPACE_DIM2; j++)
+ matrix_out[i][j] = 0;
+
+ /*
+ * Read data back to the buffer matrix.
+ */
+ dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace);
+
+ /*
+ * Display the result. Memory dataset is:
+ *
+ * 10 0 11 12 0 0 0 0 0
+ * 18 0 19 20 0 21 22 0 0
+ * 0 59 0 61 0 0 0 0 0
+ * 0 0 27 28 0 29 30 0 0
+ * 0 0 35 36 67 37 38 0 0
+ * 0 0 43 44 0 45 46 0 0
+ * 0 0 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0 0 0
+ */
+ for (i=0; i < MSPACE_DIM1; i++)
+ {
+ for(j=0; j < MSPACE_DIM2; j++)
+ cout << matrix_out[i][j] << " ";
+ cout << endl;
+ }
+
+ /*
+ * Close the dataset and the file.
+ */
+ delete dataset;
+ delete file;
} // end of try block
// catch failure caused by the H5File operations
catch( FileIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
- error.printErrorStack();
- return -1;
+ error.printErrorStack();
+ return -1;
}
return 0;
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 37ddcbb..adace89 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -346,10 +346,12 @@ endif ()
# By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types
# This option will force/override the default setting for all configurations
#-----------------------------------------------------------------------------
-option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF)
-if (HDF5_ENABLE_ASSERTS)
+#option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF)
+set (HDF5_ENABLE_ASSERTS "OFF" CACHE STRING "Determines whether NDEBUG is defined to control assertions (OFF NO YES)")
+set_property (CACHE HDF5_ENABLE_ASSERTS PROPERTY STRINGS OFF NO YES)
+if (HDF5_ENABLE_ASSERTS MATCHES "YES")
add_compile_options ("-UNDEBUG")
-else ()
+elseif (HDF5_ENABLE_ASSERTS MATCHES "NO")
add_compile_options ("-DNDEBUG")
endif ()
MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS)
@@ -358,8 +360,10 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS)
# Option for --enable-symbols
# This option will force/override the default setting for all configurations
#-----------------------------------------------------------------------------
-option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF)
-if (HDF5_ENABLE_SYMBOLS)
+#option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF)
+set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)")
+set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES)
+if (HDF5_ENABLE_SYMBOLS MATCHES "YES")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
@@ -372,7 +376,7 @@ if (HDF5_ENABLE_SYMBOLS)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif ()
endif ()
-else ()
+elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO")
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 528b24f..56e1695 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -16,7 +16,7 @@ message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
if (WIN32)
- set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8")
+ set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre")
else ()
set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
endif ()
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index ac55a13..9f52b3c 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -453,7 +453,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) {
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; }
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { return H5FD_HDFS; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) {
+#ifdef H5_HAVE_LIBHDFS
+ return H5FD_HDFS;
+#else
+ return -1;
+#endif
+}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; }
JNIEXPORT jlong JNICALL
@@ -463,7 +469,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5F
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; }
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { return H5FD_ROS3; }
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) {
+#ifdef H5_HAVE_ROS3_VFD
+ return H5FD_ROS3;
+#else
+ return -1;
+#endif
+}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; }
JNIEXPORT jlong JNICALL
diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in
index 8bc2078..49868ca 100644
--- a/test/test_usecases.sh.in
+++ b/test/test_usecases.sh.in
@@ -40,7 +40,7 @@ fi
# Define symbols
EXIT_SUCCESS=0
EXIT_FAILURE=1
-EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed
+EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed
RESULT_PASSED=" PASSED"
RESULT_FAILED="*FAILED*"
RESULT_SKIP="-SKIP-"
@@ -97,17 +97,17 @@ TOOLTEST() {
cat $actual_err >> $actual
if [ $exit_code -eq 0 ];then
- echo "$RESULT_PASSED"
- test yes = "$verbose" && sed 's/^/ /' < $actual
+ echo "$RESULT_PASSED"
+ test yes = "$verbose" && sed 's/^/ /' < $actual
else
- echo "$RESULT_FAILED"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && sed 's/^/ /' < $actual
+ echo "$RESULT_FAILED"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && sed 's/^/ /' < $actual
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
+ rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
fi
}
@@ -122,7 +122,9 @@ for FILE in use_*; do
case "$FILE" in
*.o) continue ;; ## don't copy the .o files
esac
- cp $FILE usecases_test
+ if test -f "$FILE" ; then
+ cp $FILE usecases_test
+ fi
done
# With the --disable-shared option, swmr program files are built in the test
@@ -131,7 +133,14 @@ done
# always be copied, swmr files in .libs should be copied only if they exists.
if [ -f .libs/use_append_chunk ]; then
mkdir usecases_test/.libs
- cp .libs/use_* usecases_test/.libs
+ for FILE in .libs/use_*; do
+ case "$FILE" in
+ *.o) continue ;; ## don't copy the .o files
+ esac
+ if test -f "$FILE" ; then
+ cp $FILE usecases_test/.libs
+ fi
+ done
cp .libs/twriteorder usecases_test/.libs
fi
@@ -176,10 +185,10 @@ for p in $USECASES_PROGRAMS; do
TOOLTEST ./$p -l w
TOOLTEST ./$p -l r
# use case 1.9, testing with multi-planes chunks
- TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks
+ TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks
# cleanup temp datafile
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $p.h5
+ rm -f $p.h5
fi
done
diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in
index ca46dcb..3cdf10f 100644
--- a/test/testflushrefresh.sh.in
+++ b/test/testflushrefresh.sh.in
@@ -20,7 +20,7 @@
# the verification of this feature needs to occur in separate processes
# from the one in which the file is being manipulated in. (i.e., we have
# a single writer process, and various reader processes spawning off
-# and doing the verification that individual objects are being
+# and doing the verification that individual objects are being
# correctly flushed).
#
# Programmer:
@@ -80,23 +80,30 @@ fi
# HDF5 has several tests that create and delete signal files to communicate
# between processes, and it seems that even though the names of the files are
# different, occasionally the wrong file is deleted, interrupting the flow of
-# the test. Running each of these tests in its own directory should eliminate
+# the test. Running each of these tests in its own directory should eliminate
# the problem.
mkdir flushrefresh_test
cp flushrefresh flushrefresh_test
# With the --disable-shared option, flushrefresh is built in the test directory,
-# otherwise it is in test/.libs with a wrapper script named flushrefresh in
-# the test directory. test/flushrefresh should always be copied,
+# otherwise it is in test/.libs with a wrapper script named flushrefresh in
+# the test directory. test/flushrefresh should always be copied,
# .libs/flushrefresh should be copied only if it exists.
if [ -f .libs/flushrefresh ]; then
mkdir flushrefresh_test/.libs
- cp .libs/flushrefresh flushrefresh_test/.libs
+ for FILE in .libs/flushrefresh*; do
+ case "$FILE" in
+ *.o) continue ;; ## don't copy the .o files
+ esac
+ if test -f "$FILE" ; then
+ cp $FILE flushrefresh_test/.libs
+ fi
+ done
fi
cd flushrefresh_test
# =================================================
-# Set up/initialize some variables to be used later
+# Set up/initialize some variables to be used later
# =================================================
testfile=flushrefresh.h5
startsignal=flushrefresh_VERIFICATION_START
@@ -119,13 +126,13 @@ pid_main=$!
# =======================================
until [ $verification_done -eq 1 ]; do
-
+
# Wait for signal from test program that verification routine can run.
before=`TimeStamp`
until [ -s $startsignal ]; do
after=`TimeStamp`
timediff=`expr $after - $before`
- if [ $timediff -gt $timeout_length ]; then
+ if [ $timediff -gt $timeout_length ]; then
nerrors=`expr $nerrors + 1`
timedout=1
break
@@ -165,7 +172,7 @@ if [ $timedout -eq 0 ]; then
until [ -s $startsignal ]; do
after=`TimeStamp`
timediff=`expr $after - $before`
- if [ $timediff -gt $timeout_length ]; then
+ if [ $timediff -gt $timeout_length ]; then
nerrors=`expr $nerrors + 1`
timedout=1
break
diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in
index f81a7d7..a41947e 100644
--- a/test/testswmr.sh.in
+++ b/test/testswmr.sh.in
@@ -131,9 +131,10 @@ for FILE in swmr*; do
case "$FILE" in
*.o) continue ;; ## don't copy the .o files
esac
- cp $FILE swmr_test
+ if test -f "$FILE" ; then
+ cp $FILE swmr_test
+ fi
done
-cp swmr* swmr_test
# With the --disable-shared option, swmr program files are built in the test
# directory, otherwise they are in test/.libs with a corresponding wrapper
@@ -145,7 +146,9 @@ if [ -f .libs/swmr ]; then
case "$FILE" in
*.o) continue ;; ## don't copy the .o files
esac
- cp $FILE swmr_test/.libs
+ if test -f "$FILE" ; then
+ cp $FILE swmr_test/.libs
+ fi
done
fi
@@ -153,7 +156,7 @@ cd swmr_test
# Loop over index types
-for index_type in "-i ea" "-i b2"
+for index_type in "-i ea" "-i b2"
do
# Try with and without compression
for compress in "" "-c 5"
diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in
index 32af072..28abcf5 100644
--- a/test/testvdsswmr.sh.in
+++ b/test/testvdsswmr.sh.in
@@ -117,7 +117,9 @@ for FILE in vds_swmr*; do
case "$FILE" in
*.o) continue ;; ## don't copy the .o files
esac
- cp $FILE vds_swmr_test
+ if test -f "$FILE" ; then
+ cp $FILE vds_swmr_test
+ fi
done
# With the --disable-shared option, swmr program files are built in the test
@@ -126,7 +128,14 @@ done
# always be copied, swmr files in .libs should be copied only if they exists.
if [ -f .libs/vds_swmr_writer ]; then
mkdir vds_swmr_test/.libs
- cp .libs/vds_swmr* vds_swmr_test/.libs
+ for FILE in .libs/vds_swmr*; do
+ case "$FILE" in
+ *.o) continue ;; ## don't copy the .o files
+ esac
+ if test -f "$FILE" ; then
+ cp $FILE vds_swmr_test/.libs
+ fi
+ done
fi
cd vds_swmr_test
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
index 50758b5..2440ca4 100644
--- a/tools/test/h5copy/testh5copy.sh.in
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -504,22 +504,21 @@ fi
TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename
echo "Test copying empty, 'full' & 'nested' groups"
-if test $USE_FILTER_DEFLATE = "yes" ; then
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty
-fi
+if test $USE_FILTER_DEFLATE = "yes" ; then
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested
+fi
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr
-if test $USE_FILTER_DEFLATE = "yes" ; then
echo "Test copying dataset within group in source file to group in destination"
TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group
+if test $USE_FILTER_DEFLATE = "yes" ; then
echo "Test copying & renaming group"
TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename
-fi
-
echo "Test copying 'full' group hierarchy into group in destination file"
TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets
+fi
echo "Test copying objects into group hier. that doesn't exist yet in destination file"
TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index 282ba76..c515786 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -1391,7 +1391,12 @@ TOOLTEST add_alignment $arg
TOOLTEST upgrade_layout h5repack_layouto.h5
# test for datum size > H5TOOLS_MALLOCSIZE
-TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1
+arg="h5repack_objs.h5 -f GZIP=1"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST gt_mallocsize $arg
+fi
# Check repacking file with committed datatypes in odd configurations
TOOLTEST committed_dt h5repack_named_dtypes.h5
@@ -1462,7 +1467,7 @@ VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5
# -j 2 -k 2, superblock will be 3
VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5
# -j 0 -k 1, file cannot be opened
-VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
+VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c
index ff9e2b4..90030d8 100644
--- a/tools/test/perform/sio_perf.c
+++ b/tools/test/perform/sio_perf.c
@@ -1423,6 +1423,6 @@ usage(const char *prog)
HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n");
HDprintf(" HDF5_PREFIX Data file prefix\n");
HDprintf("\n");
- fflush(stdout);
+ HDfflush(stdout);
} /* end usage() */