summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-11 16:24:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-11 16:24:11 (GMT)
commitd9e5ca72f39934531b534524d07cf784c3d0e613 (patch)
tree1913b13a317132523091035f1175b2291c8b9db7 /examples
parent053807fa81579e6bd9ac6a701ddcaac39e4d0b87 (diff)
downloadhdf5-d9e5ca72f39934531b534524d07cf784c3d0e613.zip
hdf5-d9e5ca72f39934531b534524d07cf784c3d0e613.tar.gz
hdf5-d9e5ca72f39934531b534524d07cf784c3d0e613.tar.bz2
[svn-r14199] Description:
Add H5Dcreate to API versioned routines, replacing internal usage with H5Dcreate2 Fix thread-safe error stack initialization for API versioned error stack printing routines. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'examples')
-rw-r--r--examples/Attributes.txt2
-rw-r--r--examples/h5_attribute.c2
-rw-r--r--examples/h5_compound.c2
-rw-r--r--examples/h5_dtransform.c2
-rw-r--r--examples/h5_extend_write.c4
-rw-r--r--examples/h5_group.c8
-rw-r--r--examples/h5_mount.c7
-rw-r--r--examples/h5_ref2reg.c12
-rw-r--r--examples/h5_reference.c22
-rw-r--r--examples/h5_select.c11
-rw-r--r--examples/h5_shared_mesg.c2
-rw-r--r--examples/h5_write.c13
-rw-r--r--examples/ph5example.c26
13 files changed, 55 insertions, 58 deletions
diff --git a/examples/Attributes.txt b/examples/Attributes.txt
index e32601c..299451b 100644
--- a/examples/Attributes.txt
+++ b/examples/Attributes.txt
@@ -22,7 +22,7 @@ H5Acreate2 example: Show how to create an attribute for a dataset and a group
dataspace = H5Screate_simple(rank, dimsf, NULL);
/* Create a dataset */
- dataset = H5Dcreate(file, "Dataset1", H5T_UINT8, dataspace, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, "Dataset1", H5T_UINT8, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
<Write data to first dataset>
diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c
index b49b0e1..e26ed6e 100644
--- a/examples/h5_attribute.c
+++ b/examples/h5_attribute.c
@@ -95,7 +95,7 @@ main (void)
/*
* Create the dataset in the file.
*/
- dataset = H5Dcreate(file, "Dataset", H5T_NATIVE_INT, fid, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, "Dataset", H5T_NATIVE_INT, fid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write data to the dataset.
diff --git a/examples/h5_compound.c b/examples/h5_compound.c
index da22c87..3fca2a5 100644
--- a/examples/h5_compound.c
+++ b/examples/h5_compound.c
@@ -87,7 +87,7 @@ main(void)
/*
* Create the dataset.
*/
- dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, s1_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Wtite data to the dataset;
diff --git a/examples/h5_dtransform.c b/examples/h5_dtransform.c
index 6f4108b..71ec10a 100644
--- a/examples/h5_dtransform.c
+++ b/examples/h5_dtransform.c
@@ -99,7 +99,7 @@ main (void)
* Create a new dataset within the file using defined dataspace and
* datatype and default dataset creation properties.
*/
- dataset = H5Dcreate(file, "data_no_trans", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, "data_no_trans", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
printf("\nOriginal Data: \n");
PRINT(windchillF);
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index b54cc66..74f6c01 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -81,8 +81,8 @@ main (void)
* Create a new dataset within the file using cparms
* creation properties.
*/
- dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace,
- cparms);
+ dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
+ cparms, H5P_DEFAULT);
/*
* Extend the dataset. This call assures that dataset is at least 3 x 3.
diff --git a/examples/h5_group.c b/examples/h5_group.c
index f0adff7..da6a848 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -71,8 +71,8 @@ main(void)
plist = H5Pcreate(H5P_DATASET_CREATE);
H5Pset_chunk(plist, 2, cdims);
H5Pset_deflate( plist, 6);
- dataset = H5Dcreate(file, "/Data/Compressed_Data", H5T_NATIVE_INT,
- dataspace, plist);
+ dataset = H5Dcreate2(file, "/Data/Compressed_Data", H5T_NATIVE_INT,
+ dataspace, H5P_DEFAULT, plist, H5P_DEFAULT);
/*
* Close the first dataset .
*/
@@ -85,8 +85,8 @@ main(void)
dims[0] = 500;
dims[1] = 20;
dataspace = H5Screate_simple(RANK, dims, NULL);
- dataset = H5Dcreate(file, "/Data/Float_Data", H5T_NATIVE_FLOAT,
- dataspace, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, "/Data/Float_Data", H5T_NATIVE_FLOAT,
+ dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
*Close the second dataset and file.
diff --git a/examples/h5_mount.c b/examples/h5_mount.c
index 6c4910c..6da71a1 100644
--- a/examples/h5_mount.c
+++ b/examples/h5_mount.c
@@ -45,10 +45,9 @@ int main(void)
/*
* Initialization of buffer matrix "bm"
*/
- for(i =0; i<NX; i++) {
- for(j = 0; j<NY; j++)
+ for(i =0; i < NX; i++)
+ for(j = 0; j < NY; j++)
bm[i][j] = i + j;
- }
/*
* Create first file and a group in it.
@@ -69,7 +68,7 @@ int main(void)
dims[0] = NX;
dims[1] = NY;
sid = H5Screate_simple(RANK, dims, NULL);
- did = H5Dcreate(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT);
+ did = H5Dcreate2(fid2, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write data to the dataset.
diff --git a/examples/h5_ref2reg.c b/examples/h5_ref2reg.c
index 1459161..0cea797 100644
--- a/examples/h5_ref2reg.c
+++ b/examples/h5_ref2reg.c
@@ -70,7 +70,7 @@ int main(void)
/*
* Create integer dataset.
*/
- dsetv_id = H5Dcreate(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT);
+ dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write data to the dataset.
@@ -81,7 +81,7 @@ int main(void)
/*
* Dataset with references.
*/
- dsetr_id = H5Dcreate(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT);
+ dsetr_id = H5Dcreate2(file_id, dsetnamer, H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create a reference to the hyperslab.
@@ -90,7 +90,7 @@ int main(void)
start[1] = 3;
count[0] = 2;
count[1] = 3;
- status = H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL);
+ status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, NULL, count, NULL);
status = H5Rcreate(&ref[0], file_id, dsetnamev, H5R_DATASET_REGION, space_id);
/*
@@ -136,14 +136,14 @@ int main(void)
* Get name of the dataset the first region reference points to
* using H5Rget_name
*/
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, 10);
- printf (" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n", buf1, (int)name_size1);
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, 10);
+ printf(" Dataset's name (returned by H5Rget_name) the reference points to is %s, name length is %d\n", buf1, (int)name_size1);
/*
* Get name of the dataset the first region reference points to
* using H5Iget_name
*/
name_size2 = H5Iget_name(dsetv_id, (char*)buf2, 10);
- printf (" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n", buf2, (int)name_size2);
+ printf(" Dataset's name (returned by H5Iget_name) the reference points to is %s, name length is %d\n", buf2, (int)name_size2);
space_id = H5Rget_region(dsetr_id, H5R_DATASET_REGION,&ref_out[0]);
diff --git a/examples/h5_reference.c b/examples/h5_reference.c
index 3bd1ab3..31aa2cf 100644
--- a/examples/h5_reference.c
+++ b/examples/h5_reference.c
@@ -61,7 +61,7 @@ main(void) {
dim_b[0] = 2;
dim_b[1] = 6;
sid_b = H5Screate_simple(2, dim_b, NULL);
- did_b = H5Dcreate(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT);
+ did_b = H5Dcreate2(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create dataset "R" to store references to the objects "A" and "B".
@@ -69,13 +69,13 @@ main(void) {
dim_r[0] = 2;
sid_r = H5Screate_simple(1, dim_r, NULL);
tid_r = H5Tcopy(H5T_STD_REF_OBJ);
- did_r = H5Dcreate(fid, "R", tid_r, sid_r, H5P_DEFAULT );
+ did_r = H5Dcreate2(fid, "R", tid_r, sid_r, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Allocate write and read buffers.
*/
- wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t)*2);
- rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t)*2);
+ wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
+ rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
/*
* Create references to the group "A" and dataset "B"
@@ -87,8 +87,7 @@ main(void) {
/*
* Write dataset R using default transfer properties.
*/
- status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, wbuf);
+ status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/*
* Close all objects.
@@ -113,18 +112,17 @@ main(void) {
* Open and read dataset "R".
*/
did_r = H5Dopen2(fid, "R", H5P_DEFAULT);
- status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rbuf);
+ status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
/*
* Find the type of referenced objects.
*/
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[0], &obj_type);
- if ( obj_type == H5O_TYPE_GROUP )
+ if(obj_type == H5O_TYPE_GROUP)
printf("First dereferenced object is a group. \n");
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[1], &obj_type);
- if ( obj_type == H5O_TYPE_DATASET )
+ if(obj_type == H5O_TYPE_DATASET)
printf("Second dereferenced object is a dataset. \n");
/*
@@ -145,9 +143,7 @@ main(void) {
H5Fclose(fid);
free(rbuf);
free(wbuf);
- return 0;
+ return 0;
}
-
-
diff --git a/examples/h5_select.c b/examples/h5_select.c
index d39458f..dc08b8a 100644
--- a/examples/h5_select.c
+++ b/examples/h5_select.c
@@ -87,7 +87,8 @@ main (void)
* Buffers' initialization.
*/
vector[0] = vector[MSPACE1_DIM - 1] = -1;
- for (i = 1; i < MSPACE1_DIM - 1; i++) vector[i] = i;
+ for(i = 1; i < MSPACE1_DIM - 1; i++)
+ vector[i] = i;
/*
* Create a file.
@@ -109,7 +110,7 @@ main (void)
* Create dataset in the file. Notice that creation
* property list plist is used.
*/
- dataset = H5Dcreate(file, "Matrix in file", H5T_NATIVE_INT, fid, plist);
+ dataset = H5Dcreate2(file, "Matrix in file", H5T_NATIVE_INT, fid, H5P_DEFAULT, plist, H5P_DEFAULT);
/*
* Select hyperslab for the dataset in the file, using 3x2 blocks,
@@ -302,8 +303,9 @@ main (void)
* 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++) printf("%3d ", matrix_out[i][j]);
+ for(i = 0; i < MSPACE_DIM1; i++) {
+ for(j = 0; j < MSPACE_DIM2; j++)
+ printf("%3d ", matrix_out[i][j]);
printf("\n");
}
@@ -330,3 +332,4 @@ main (void)
return 0;
}
+
diff --git a/examples/h5_shared_mesg.c b/examples/h5_shared_mesg.c
index ab79b15..41a23a2 100644
--- a/examples/h5_shared_mesg.c
+++ b/examples/h5_shared_mesg.c
@@ -290,7 +290,7 @@ create_standard_file(const char *filename, hid_t fcpl_id)
*/
for(x = 0; x < NUM_DATASETS; ++x) {
/* Create a dataset */
- dset_id = H5Dcreate(file_id, DSETNAME[x], type_id, space_id, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, DSETNAME[x], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if(dset_id < 0) goto error;
/* Create an attribute on the dataset */
diff --git a/examples/h5_write.c b/examples/h5_write.c
index 3e2f73b..93d40ea 100644
--- a/examples/h5_write.c
+++ b/examples/h5_write.c
@@ -39,10 +39,9 @@ main (void)
/*
* Data and output buffer initialization.
*/
- for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
+ for(j = 0; j < NX; j++)
+ for(i = 0; i < NY; i++)
data[j][i] = i + j;
- }
/*
* 0 1 2 3 4 5
* 1 2 3 4 5 6
@@ -77,14 +76,13 @@ main (void)
* Create a new dataset within the file using defined dataspace and
* datatype and default dataset creation properties.
*/
- dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DATASETNAME, datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write the data to the dataset using default transfer properties.
*/
- status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data);
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
/*
* Close/release resources.
@@ -96,3 +94,4 @@ main (void)
return 0;
}
+
diff --git a/examples/ph5example.c b/examples/ph5example.c
index 851536a..7a41db2 100644
--- a/examples/ph5example.c
+++ b/examples/ph5example.c
@@ -271,12 +271,12 @@ phdf5writeInd(char *filename)
MESG("H5Pset_fapl_mpio succeed");
/* create the file collectively */
- fid1=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl1);
+ fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl1);
assert(fid1 != FAIL);
MESG("H5Fcreate succeed");
/* Release file-access template */
- ret=H5Pclose(acc_tpl1);
+ ret = H5Pclose(acc_tpl1);
assert(ret != FAIL);
@@ -285,22 +285,22 @@ phdf5writeInd(char *filename)
* and the slabs local to the MPI process.
* ------------------------- */
/* setup dimensionality object */
- sid1 = H5Screate_simple (SPACE1_RANK, dims1, NULL);
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
assert (sid1 != FAIL);
MESG("H5Screate_simple succeed");
/* create a dataset collectively */
- dataset1 = H5Dcreate(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1,
- H5P_DEFAULT);
+ dataset1 = H5Dcreate2(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset1 != FAIL);
- MESG("H5Dcreate succeed");
+ MESG("H5Dcreate2 succeed");
/* create another dataset collectively */
- dataset2 = H5Dcreate(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1,
- H5P_DEFAULT);
+ dataset2 = H5Dcreate2(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset2 != FAIL);
- MESG("H5Dcreate succeed");
+ MESG("H5Dcreate2 succeed");
@@ -538,14 +538,14 @@ phdf5writeAll(char *filename)
/* create a dataset collectively */
- dataset1 = H5Dcreate(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1, H5P_DEFAULT);
+ dataset1 = H5Dcreate2(fid1, DATASETNAME1, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset1 != FAIL);
- MESG("H5Dcreate succeed");
+ MESG("H5Dcreate2 succeed");
/* create another dataset collectively */
- dataset2 = H5Dcreate(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1, H5P_DEFAULT);
+ dataset2 = H5Dcreate2(fid1, DATASETNAME2, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(dataset2 != FAIL);
- MESG("H5Dcreate 2 succeed");
+ MESG("H5Dcreate2 2 succeed");
/*
* Set up dimensions of the slab this process accesses.