summaryrefslogtreecommitdiffstats
path: root/c++/examples
diff options
context:
space:
mode:
Diffstat (limited to 'c++/examples')
-rw-r--r--c++/examples/h5tutr_cmprss.cpp16
-rw-r--r--c++/examples/h5tutr_crtatt.cpp10
-rw-r--r--c++/examples/h5tutr_crtdat.cpp4
-rw-r--r--c++/examples/h5tutr_crtgrp.cpp6
-rw-r--r--c++/examples/h5tutr_crtgrpar.cpp14
-rw-r--r--c++/examples/h5tutr_crtgrpd.cpp12
-rw-r--r--c++/examples/h5tutr_extend.cpp28
-rw-r--r--c++/examples/h5tutr_rdwt.cpp4
-rw-r--r--c++/examples/h5tutr_subset.cpp24
-rw-r--r--c++/examples/run-c++-ex.sh.in2
10 files changed, 60 insertions, 60 deletions
diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp
index 9531bdd..e3cf978 100644
--- a/c++/examples/h5tutr_cmprss.cpp
+++ b/c++/examples/h5tutr_cmprss.cpp
@@ -42,7 +42,7 @@ int main (void)
// handle the errors appropriately
Exception::dontPrint();
- // Create a new file using the default property lists.
+ // Create a new file using the default property lists.
H5File file(FILE_NAME, H5F_ACC_TRUNC);
// Create the data space for the dataset.
@@ -60,9 +60,9 @@ int main (void)
// 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,
+
+ // Create the dataset.
+ DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
PredType::STD_I32BE, *dataspace, *plist) );
for (i = 0; i< DIM0; i++)
@@ -79,10 +79,10 @@ int main (void)
file.close();
// -----------------------------------------------
- // Re-open the file and dataset, retrieve filter
+ // 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};
@@ -113,7 +113,7 @@ int main (void)
cout << "H5Z_FILTER_DEFLATE" << endl;
break;
case H5Z_FILTER_SZIP:
- cout << "H5Z_FILTER_SZIP" << endl;
+ cout << "H5Z_FILTER_SZIP" << endl;
break;
default:
cout << "Other filter type included." << endl;
@@ -123,7 +123,7 @@ int main (void)
// Read data.
dataset->read(rbuf, PredType::NATIVE_INT);
- delete plist;
+ delete plist;
delete dataset;
file.close(); // can be skipped
diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp
index fcf6c27..409bd62 100644
--- a/c++/examples/h5tutr_crtatt.cpp
+++ b/c++/examples/h5tutr_crtatt.cpp
@@ -31,7 +31,7 @@ int main (void)
{
int attr_data[2] = { 100, 200};
hsize_t dims[1] = { DIM1 };
-
+
// Try block to detect exceptions raised by any of the calls inside it
try
@@ -47,11 +47,11 @@ int main (void)
// 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,
+ // Create a dataset attribute.
+ Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
attr_dataspace);
-
- // Write the attribute data.
+
+ // Write the attribute data.
attribute.write( PredType::NATIVE_INT, attr_data);
} // end of try block
diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp
index 985f6ac..3257223 100644
--- a/c++/examples/h5tutr_crtdat.cpp
+++ b/c++/examples/h5tutr_crtdat.cpp
@@ -37,7 +37,7 @@ int main (void)
// handle the errors appropriately
Exception::dontPrint();
- // Create a new file using the default property lists.
+ // Create a new file using the default property lists.
H5File file(FILE_NAME, H5F_ACC_TRUNC);
// Create the data space for the dataset.
@@ -46,7 +46,7 @@ int main (void)
dims[1] = NY;
DataSpace dataspace(RANK, dims);
- // Create the dataset.
+ // Create the dataset.
DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
} // end of try block
diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp
index e35cb46..43af08a 100644
--- a/c++/examples/h5tutr_crtgrp.cpp
+++ b/c++/examples/h5tutr_crtgrp.cpp
@@ -37,12 +37,12 @@ int main(void)
// 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.
-
+
} // end of try block
// catch failure caused by the H5File operations
@@ -57,6 +57,6 @@ int main(void)
error.printErrorStack();
return -1;
}
-
+
return 0;
}
diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp
index 76ec9e5..15cf1df 100644
--- a/c++/examples/h5tutr_crtgrpar.cpp
+++ b/c++/examples/h5tutr_crtgrpar.cpp
@@ -32,7 +32,7 @@ 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.
@@ -43,26 +43,26 @@ int main(void)
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 "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.
-
+
Group group3(group1.createGroup ("Group_B"));
-
+
// Close the groups and file.
group1.close();
group2.close();
group3.close();
file.close();
-
+
} // end of try block
// catch failure caused by the File operations
diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp
index e3bb1b1..c28b666 100644
--- a/c++/examples/h5tutr_crtgrpd.cpp
+++ b/c++/examples/h5tutr_crtgrpd.cpp
@@ -45,12 +45,12 @@ int main(void)
// handle the errors appropriately
Exception::dontPrint();
- // Initialize the first dataset.
+ // 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.
+ // Initialize the second dataset.
for (i = 0; i < D2DIM1; i++)
for (j = 0; j < D2DIM2; j++)
dset2_data[i][j] = j + 1;
@@ -69,7 +69,7 @@ int main(void)
// Create the dataset in group "MyGroup". Same note as for the
// dataspace above.
- DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
+ DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
@@ -89,7 +89,7 @@ int main(void)
Group group(file.openGroup("/MyGroup/Group_A"));
// Create the second dataset in group "Group_A".
- dataset = new DataSet (group.createDataSet(DATASET_NAME2,
+ dataset = new DataSet (group.createDataSet(DATASET_NAME2,
PredType::STD_I32BE, *dataspace));
// Write the data to the dataset using default memory space, file
@@ -100,7 +100,7 @@ int main(void)
delete dataspace;
delete dataset;
group.close();
-
+
} // end of try block
// catch failure caused by the H5File operations
@@ -129,6 +129,6 @@ int main(void)
error.printErrorStack();
return -1;
}
-
+
return 0;
}
diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp
index b6927ea..94e9acf 100644
--- a/c++/examples/h5tutr_extend.cpp
+++ b/c++/examples/h5tutr_extend.cpp
@@ -30,17 +30,17 @@ const H5std_string DATASETNAME("ExtendibleArray");
int main (void)
{
hsize_t dims[2] = {3,3}; // dataset dimensions at creation
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ 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
+ 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
+ // Variables used in extending and writing to the extended portion of dataset
hsize_t size[2];
hsize_t offset[2];
- hsize_t dimsext[2] = {7, 3}; // extend dimensions
+ hsize_t dimsext[2] = {7, 3}; // extend dimensions
int dataext[7][3] = { {2, 3, 4},
{2, 3, 4},
{2, 3, 4},
@@ -56,7 +56,7 @@ int main (void)
// handle the errors appropriately
Exception::dontPrint();
- // Create a new file using the default property lists.
+ // 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
@@ -70,23 +70,23 @@ int main (void)
prop.setChunk(2, chunk_dims);
// Create the chunked dataset. Note the use of pointer.
- DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
+ 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);
+ 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);
@@ -101,9 +101,9 @@ int main (void)
delete dataset;
file.close();
- // ---------------------------------------
+ // ---------------------------------------
// Re-open the file and read the data back
- // ---------------------------------------
+ // ---------------------------------------
int rdata[10][3];
int i,j, rank, rank_chunk;
@@ -111,7 +111,7 @@ int main (void)
// Open the file and dataset.
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
- dataset = new DataSet(file.openDataSet( DATASETNAME));
+ dataset = new DataSet(file.openDataSet( DATASETNAME));
// Get the dataset's dataspace and creation property list.
filespace = new DataSpace(dataset->getSpace());
@@ -127,7 +127,7 @@ int main (void)
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++)
@@ -141,7 +141,7 @@ int main (void)
delete memspace;
delete dataset;
file.close();
-
+
} // end of try block
// catch failure caused by the H5File operations
diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp
index f17e6a5..e9b76ad 100644
--- a/c++/examples/h5tutr_rdwt.cpp
+++ b/c++/examples/h5tutr_rdwt.cpp
@@ -28,9 +28,9 @@ const int DIM1 = 6;
int main (void)
{
-
+
// Data initialization.
-
+
int i, j;
int data[DIM0][DIM1]; // buffer for data to write
diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp
index 0747880..f7d0513 100644
--- a/c++/examples/h5tutr_subset.cpp
+++ b/c++/examples/h5tutr_subset.cpp
@@ -46,19 +46,19 @@ int main (void)
Exception::dontPrint();
// ---------------------------------------------------
- // Create a new file using the default property lists.
- // Then create a dataset and write data to it.
+ // 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);
- hsize_t dims[2];
+ hsize_t dims[2];
dims[0] = DIM0;
dims[1] = DIM1;
DataSpace dataspace = DataSpace (RANK, dims);
- DataSet dataset(file.createDataSet( DATASET_NAME,
+ DataSet dataset(file.createDataSet( DATASET_NAME,
PredType::STD_I32BE, dataspace) );
@@ -94,7 +94,7 @@ int main (void)
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;
@@ -107,7 +107,7 @@ int main (void)
block[0] = 1;
block[1] = 1;
-
+
// Define Memory Dataspace. Get file dataspace and select
// a subset from the file dataspace.
@@ -117,7 +117,7 @@ int main (void)
DataSpace memspace(RANK, dimsm, NULL);
dataspace = dataset.getSpace();
- dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block);
+ 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.
@@ -127,15 +127,15 @@ int main (void)
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++)
+ for (j = 0; j < DIM1; j++)
cout << " " << rdata[i][j];
cout << endl;
}
diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in
index 03e1eac..7ff8506 100644
--- a/c++/examples/run-c++-ex.sh.in
+++ b/c++/examples/run-c++-ex.sh.in
@@ -141,5 +141,5 @@ rm *.o
rm *.h5
echo
-exit $EXIT_VALUE
+exit $EXIT_VALUE