2003-04-01 01:59:04 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* 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 files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 22:56:24 +08:00
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/*
|
|
|
|
* This program illustrates assertion errors when linked
|
|
|
|
* to HDF5 1.4.1-post2 or 1.4.2-pre3 debug library.
|
|
|
|
*
|
|
|
|
* If the assertion errors are ignored, the program eventially causes
|
2007-08-24 04:25:25 +08:00
|
|
|
* an error in H5Gcreate2 when writing object 83381.
|
2001-07-31 04:03:25 +08:00
|
|
|
*
|
|
|
|
* When writing in single file mode, the assertion errors still occur
|
2007-08-24 04:25:25 +08:00
|
|
|
* but the H5Gcreate2 error does not.
|
2005-08-14 04:53:35 +08:00
|
|
|
*/
|
2001-07-31 04:03:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "hdf5.h"
|
|
|
|
|
|
|
|
#define FILEN "testmeta.h5"
|
|
|
|
|
|
|
|
#define MEMB_SIZE 100000000
|
|
|
|
#define CHUNK_SIZE 512
|
|
|
|
|
|
|
|
#define NDATAARRAYS 3
|
|
|
|
/*#define NPOINTS 2048*/
|
|
|
|
#define NPOINTS 20
|
|
|
|
#define NEXTARRAYS 10
|
|
|
|
#define NWATTRS 2
|
|
|
|
#define NDATAOBJECTS 100000
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
hid_t file_id, prop_id, memspace_id, type_id;
|
2005-05-08 03:37:48 +08:00
|
|
|
hid_t group_id;
|
|
|
|
hid_t dataset_id, dataspace_id;
|
2001-07-31 04:03:25 +08:00
|
|
|
herr_t status;
|
|
|
|
hsize_t dims[1];
|
|
|
|
hsize_t maxdims[1];
|
|
|
|
float data[NPOINTS];
|
|
|
|
float floatval;
|
|
|
|
unsigned numdataobj = 0;
|
|
|
|
unsigned i, j;
|
|
|
|
char name[80];
|
2005-05-08 03:37:48 +08:00
|
|
|
hsize_t start[1] = {0};
|
2001-07-31 04:03:25 +08:00
|
|
|
hsize_t stride[1] = {1};
|
|
|
|
hsize_t count[1] = {1};
|
|
|
|
|
|
|
|
/* Create a file */
|
|
|
|
file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Create a dataset to hold the number of data objects */
|
|
|
|
/* Create the data space */
|
|
|
|
dataspace_id = H5Screate(H5S_SCALAR);
|
|
|
|
|
|
|
|
/* Create dataset */
|
[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
2007-10-12 00:24:11 +08:00
|
|
|
dataset_id = H5Dcreate2(file_id, "/NumDataObj",
|
|
|
|
H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Write value to NumDataObj dataset */
|
|
|
|
status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL,
|
|
|
|
H5S_ALL, H5P_DEFAULT, &numdataobj);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close the identifiers */
|
|
|
|
status = H5Dclose(dataset_id);
|
|
|
|
status = H5Sclose(dataspace_id);
|
|
|
|
|
|
|
|
/* Create extendible arrays */
|
|
|
|
/* Set up for extendible dataset */
|
|
|
|
prop_id = H5Pcreate(H5P_DATASET_CREATE);
|
|
|
|
dims[0] = CHUNK_SIZE;
|
|
|
|
status = H5Pset_chunk(prop_id, 1, dims);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Create dataspace */
|
|
|
|
dims[0]=1;
|
|
|
|
maxdims[0]=H5S_UNLIMITED;
|
|
|
|
dataspace_id = H5Screate_simple(1, dims, maxdims);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
for(i=0; i<NEXTARRAYS; i++)
|
|
|
|
{
|
|
|
|
/* Create dataset */
|
|
|
|
sprintf(name, "/ExtArray%06d", i);
|
[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
2007-10-12 00:24:11 +08:00
|
|
|
dataset_id = H5Dcreate2(file_id, name,
|
|
|
|
H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close the identifier */
|
|
|
|
status = H5Dclose(dataset_id);
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close the identifiers */
|
|
|
|
status = H5Sclose(dataspace_id);
|
|
|
|
status = H5Pclose(prop_id);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Create group to hold data object data arrays */
|
2007-08-24 04:25:25 +08:00
|
|
|
group_id = H5Gcreate2(file_id, "/DataArray", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
2001-07-31 04:03:25 +08:00
|
|
|
H5Gclose(group_id);
|
|
|
|
|
|
|
|
for(j=0; j<NDATAOBJECTS; j++)
|
|
|
|
{
|
|
|
|
printf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS);
|
|
|
|
fflush(stdout);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
floatval = (float)j;
|
|
|
|
|
|
|
|
/* Create group to hold data arrays for this object */
|
|
|
|
sprintf(name, "/DataArray/%06d", j);
|
2007-08-24 04:25:25 +08:00
|
|
|
group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
if(group_id < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to create DataArray group.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Loop over data arrays */
|
|
|
|
for(i=0; i<NDATAARRAYS; i++)
|
|
|
|
{
|
|
|
|
/* Create dataspace */
|
|
|
|
dims[0]=NPOINTS;
|
|
|
|
maxdims[0]=NPOINTS;
|
|
|
|
dataspace_id = H5Screate_simple(1 ,dims, maxdims);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Create dataset */
|
|
|
|
sprintf(name, "DataArray%06d", i);
|
[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
2007-10-12 00:24:11 +08:00
|
|
|
dataset_id = H5Dcreate2(group_id, name,
|
|
|
|
H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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
2007-10-09 03:59:36 +08:00
|
|
|
if(dataset_id < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to create DataArray dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Write the data array data */
|
|
|
|
status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL,
|
|
|
|
H5S_ALL, H5P_DEFAULT, data);
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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
2007-10-09 03:59:36 +08:00
|
|
|
if(status < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to write DataArray dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close the identifiers */
|
|
|
|
status = H5Dclose(dataset_id);
|
|
|
|
status = H5Sclose(dataspace_id);
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Open NumDataObj dataset */
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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
2007-10-09 03:59:36 +08:00
|
|
|
dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT);
|
|
|
|
if(dataset_id < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to open NumDataObj dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Write value to NumDataObj dataset */
|
|
|
|
numdataobj = j + 1;
|
|
|
|
status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL,
|
|
|
|
H5S_ALL, H5P_DEFAULT, &numdataobj);
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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
2007-10-09 03:59:36 +08:00
|
|
|
if(status < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to write NumDataObj dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close identifiers */
|
|
|
|
status = H5Dclose(dataset_id);
|
|
|
|
status = H5Gclose(group_id);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Extend attribute arrays */
|
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API
versioning, due to changed behavior) and switch internal usage to H5Dset_extent
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
2007-10-08 23:26:02 +08:00
|
|
|
for(i = 0; i < NEXTARRAYS; i++) {
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Open extendable dataset */
|
|
|
|
sprintf(name, "/ExtArray%06d", i);
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
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
2007-10-09 03:59:36 +08:00
|
|
|
dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT);
|
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API
versioning, due to changed behavior) and switch internal usage to H5Dset_extent
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
2007-10-08 23:26:02 +08:00
|
|
|
if(dataset_id < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to open ExtArray dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API
versioning, due to changed behavior) and switch internal usage to H5Dset_extent
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
2007-10-08 23:26:02 +08:00
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Extend attribute dataset */
|
|
|
|
dims[0] = (hsize_t)j + 1;
|
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API
versioning, due to changed behavior) and switch internal usage to H5Dset_extent
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
2007-10-08 23:26:02 +08:00
|
|
|
status = H5Dset_extent(dataset_id, dims);
|
|
|
|
if(status < 0) {
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to extend DataArray dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
[svn-r14192] Description:
Deprecate H5Dextend in favor of H5Dset_extent (without using API
versioning, due to changed behavior) and switch internal usage to H5Dset_extent
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
2007-10-08 23:26:02 +08:00
|
|
|
} /* end if */
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Select element and write value to attribute dataset */
|
|
|
|
dims[0] = 1;
|
|
|
|
memspace_id = H5Screate_simple(1, dims, dims);
|
|
|
|
dataspace_id = H5Dget_space(dataset_id);
|
|
|
|
type_id = H5Dget_type(dataset_id);
|
|
|
|
|
|
|
|
start[0] = 0;
|
|
|
|
status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET,
|
|
|
|
start, stride, count, NULL);
|
|
|
|
start[0] = (hssize_t)j;
|
|
|
|
status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET,
|
|
|
|
start, stride, count, NULL);
|
|
|
|
status = H5Dwrite(dataset_id, type_id, memspace_id,
|
|
|
|
dataspace_id, H5P_DEFAULT, &floatval);
|
|
|
|
if(status < 0)
|
|
|
|
{
|
2005-08-14 04:53:35 +08:00
|
|
|
fprintf(stderr, "Failed to write DataArray dataset.\n");
|
2001-07-31 04:03:25 +08:00
|
|
|
status = H5Fclose(file_id);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Close identifiers */
|
|
|
|
status = H5Tclose(type_id);
|
|
|
|
status = H5Sclose(dataspace_id);
|
|
|
|
status = H5Sclose(memspace_id);
|
|
|
|
status = H5Dclose(dataset_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
/* Close the file */
|
|
|
|
status = H5Fclose(file_id);
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2001-07-31 04:03:25 +08:00
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2007-08-24 04:25:25 +08:00
|
|
|
|