summaryrefslogtreecommitdiffstats
path: root/hl/examples
diff options
context:
space:
mode:
Diffstat (limited to 'hl/examples')
-rw-r--r--hl/examples/ex_ds1.c4
-rw-r--r--hl/examples/ex_image1.c16
-rw-r--r--hl/examples/ex_image2.c12
-rw-r--r--hl/examples/ex_lite1.c10
-rw-r--r--hl/examples/ex_lite2.c10
-rw-r--r--hl/examples/ex_lite3.c12
-rw-r--r--hl/examples/ex_table_01.c36
-rw-r--r--hl/examples/ex_table_02.c28
-rw-r--r--hl/examples/ex_table_03.c42
-rw-r--r--hl/examples/ex_table_04.c58
-rw-r--r--hl/examples/ex_table_05.c56
-rw-r--r--hl/examples/ex_table_06.c22
-rw-r--r--hl/examples/ex_table_07.c34
-rw-r--r--hl/examples/ex_table_08.c42
-rw-r--r--hl/examples/ex_table_09.c46
-rw-r--r--hl/examples/ex_table_10.c44
-rw-r--r--hl/examples/ex_table_11.c40
-rw-r--r--hl/examples/ex_table_12.c36
18 files changed, 274 insertions, 274 deletions
diff --git a/hl/examples/ex_ds1.c b/hl/examples/ex_ds1.c
index 096a452..e89564d 100644
--- a/hl/examples/ex_ds1.c
+++ b/hl/examples/ex_ds1.c
@@ -59,7 +59,7 @@ int main(void)
if (H5LTmake_dataset_int(fid,DS_2_NAME,rankds,s2_dim,s2_wbuf)<0)
goto out;
-
+
/*-------------------------------------------------------------------------
* attach the DS_1_NAME dimension scale to DSET_NAME at dimension 0
*-------------------------------------------------------------------------
@@ -100,7 +100,7 @@ int main(void)
/* close file */
H5Fclose(fid);
-
+
return 0;
out:
diff --git a/hl/examples/ex_image1.c b/hl/examples/ex_image1.c
index ec7b4c2..a68a5ca 100644
--- a/hl/examples/ex_image1.c
+++ b/hl/examples/ex_image1.c
@@ -37,7 +37,7 @@ int main( void )
252,252,84, /* yellow */
252,168,0, /* orange */
252,0,0}; /* red */
-
+
/* create an image of 9 values divided evenly by the array */
space = WIDTH*HEIGHT / PAL_ENTRIES;
for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ )
@@ -50,22 +50,22 @@ int main( void )
}
if (n>PAL_ENTRIES-1) n=0;
}
-
+
/* create a new HDF5 file using default properties. */
file_id = H5Fcreate( "ex_image1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* make the image */
status = H5IMmake_image_8bit( file_id, "image1", WIDTH, HEIGHT, buf );
-
+
/* make a palette */
status = H5IMmake_palette( file_id, "pallete", pal_dims, pal );
-
+
/* attach the palette to the image */
status = H5IMlink_palette( file_id, "image1", "pallete" );
-
+
/* close the file. */
status = H5Fclose( file_id );
-
+
return 0;
-
+
}
diff --git a/hl/examples/ex_image2.c b/hl/examples/ex_image2.c
index 0b7876d..94b05a5 100644
--- a/hl/examples/ex_image2.c
+++ b/hl/examples/ex_image2.c
@@ -25,7 +25,7 @@
#define PAL_ENTRIES 256
static int read_data(const char* file_name, hsize_t *width, hsize_t *height );
-unsigned char *gbuf = 0; /* global buffer for image data */
+unsigned char *gbuf = 0; /* global buffer for image data */
int main( void )
{
@@ -34,20 +34,20 @@ int main( void )
hsize_t height; /* height of image */
unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */
hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */
- herr_t status, i, n;
-
+ herr_t status, i, n;
+
/* create a new HDF5 file using default properties. */
file_id = H5Fcreate( "ex_image2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* read first data file */
if (read_data(DATA_FILE1,&width,&height)<0)
goto out;
-
+
/* make the image */
status=H5IMmake_image_8bit( file_id, IMAGE1_NAME, width, height, gbuf );
/*-------------------------------------------------------------------------
- * define a palette, blue to red tones
+ * define a palette, blue to red tones
*-------------------------------------------------------------------------
*/
for ( i=0, n=0; i<PAL_ENTRIES*3; i+=3, n++)
@@ -71,7 +71,7 @@ int main( void )
/* read second data file */
if (read_data(DATA_FILE2,&width,&height)<0)
goto out;
-
+
/* make dataset */
status=H5IMmake_image_24bit( file_id, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", gbuf );
diff --git a/hl/examples/ex_lite1.c b/hl/examples/ex_lite1.c
index 35abb2c..1346036 100644
--- a/hl/examples/ex_lite1.c
+++ b/hl/examples/ex_lite1.c
@@ -21,17 +21,17 @@
int main( void )
{
- hid_t file_id;
+ hid_t file_id;
hsize_t dims[RANK]={2,3};
int data[6]={1,2,3,4,5,6};
herr_t status;
-
+
/* create a HDF5 file */
- file_id = H5Fcreate ("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
+ file_id = H5Fcreate ("ex_lite1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
/* create and write an integer type dataset named "dset" */
status = H5LTmake_dataset(file_id,"/dset",RANK,dims,H5T_NATIVE_INT,data);
-
+
/* close file */
status = H5Fclose (file_id);
diff --git a/hl/examples/ex_lite2.c b/hl/examples/ex_lite2.c
index fcb1c9d..2816843 100644
--- a/hl/examples/ex_lite2.c
+++ b/hl/examples/ex_lite2.c
@@ -17,21 +17,21 @@
int main( void )
{
- hid_t file_id;
+ hid_t file_id;
int data[6];
hsize_t dims[2];
herr_t status;
hsize_t i, j, nrow, n_values;
-
+
/* open file from ex_lite1.c */
- file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT);
+ file_id = H5Fopen ("ex_lite1.h5", H5F_ACC_RDONLY, H5P_DEFAULT);
/* read dataset */
status = H5LTread_dataset_int(file_id,"/dset",data);
/* get the dimensions of the dataset */
status = H5LTget_dataset_info(file_id,"/dset",dims,NULL,NULL);
-
+
/* print it by rows */
n_values = dims[0] * dims[1];
nrow = dims[1];
@@ -41,7 +41,7 @@ int main( void )
printf (" %d", data[i*nrow + j]);
printf ("\n");
}
-
+
/* close file */
status = H5Fclose (file_id);
diff --git a/hl/examples/ex_lite3.c b/hl/examples/ex_lite3.c
index cc6e591..069f56a 100644
--- a/hl/examples/ex_lite3.c
+++ b/hl/examples/ex_lite3.c
@@ -20,16 +20,16 @@
int main( void )
{
- hid_t file_id;
+ hid_t file_id;
hid_t dset_id;
- hid_t space_id;
+ hid_t space_id;
hsize_t dims[1] = { ATTR_SIZE };
int data[ATTR_SIZE] = {1,2,3,4,5};
- herr_t status;
+ herr_t status;
int i;
-
+
/* create a file */
- file_id = H5Fcreate ("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate ("ex_lite3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/* create a data space */
space_id = H5Screate_simple(1,dims,NULL);
@@ -45,7 +45,7 @@ int main( void )
* example of H5LTset_attribute_int
*-------------------------------------------------------------------------
*/
-
+
/* create and write the attribute "attr1" on the dataset "dset" */
status = H5LTset_attribute_int(file_id,"dset","attr1",data,ATTR_SIZE);
diff --git a/hl/examples/ex_table_01.c b/hl/examples/ex_table_01.c
index b3771f4..ba1ff57 100644
--- a/hl/examples/ex_table_01.c
+++ b/hl/examples/ex_table_01.c
@@ -19,7 +19,7 @@
/*-------------------------------------------------------------------------
* Table API example
*
- * H5TBmake_table
+ * H5TBmake_table
* H5TBread_table
*
*-------------------------------------------------------------------------
@@ -32,17 +32,17 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
Particle dst_buf[NRECORDS];
-
+
/* Calculate the size and the offsets of our struct members in memory */
size_t dst_size = sizeof( Particle );
size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
@@ -56,10 +56,10 @@ int main( void )
sizeof( dst_buf[0].longi),
sizeof( dst_buf[0].pressure),
sizeof( dst_buf[0].temperature)};
-
-
+
+
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -71,7 +71,7 @@ int main( void )
};
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -79,7 +79,7 @@ int main( void )
hsize_t chunk_size = 10;
int *fill_data = NULL;
int compress = 0;
- herr_t status;
+ herr_t status;
int i;
/* Initialize field_type */
@@ -90,21 +90,21 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_01.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/*-------------------------------------------------------------------------
- * H5TBmake_table
+ * H5TBmake_table
*-------------------------------------------------------------------------
*/
- status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
+
/*-------------------------------------------------------------------------
- * H5TBread_table
+ * H5TBread_table
*-------------------------------------------------------------------------
*/
@@ -112,7 +112,7 @@ int main( void )
/* print it by rows */
for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -120,12 +120,12 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/*-------------------------------------------------------------------------
* end
*-------------------------------------------------------------------------
*/
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_02.c b/hl/examples/ex_table_02.c
index acefef3..3580151 100644
--- a/hl/examples/ex_table_02.c
+++ b/hl/examples/ex_table_02.c
@@ -31,19 +31,19 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
Particle dst_buf[NRECORDS+NRECORDS_ADD];
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -67,9 +67,9 @@ int main( void )
sizeof( p_data[0].longi),
sizeof( p_data[0].pressure),
sizeof( p_data[0].temperature)};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -77,11 +77,11 @@ int main( void )
hsize_t chunk_size = 10;
int *fill_data = NULL;
int compress = 0;
- herr_t status;
+ herr_t status;
int i;
- /* Append particles */
- Particle particle_in[ NRECORDS_ADD ] =
+ /* Append particles */
+ Particle particle_in[ NRECORDS_ADD ] =
{{ "eight",80,80, 8.0f, 80.0},
{"nine",90,90, 9.0f, 90.0} };
@@ -93,17 +93,17 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_02.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* make a table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size, field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size, field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
/* append two records */
- status=H5TBappend_records(file_id, TABLE_NAME,NRECORDS_ADD, dst_size, dst_offset, dst_sizes,
+ status=H5TBappend_records(file_id, TABLE_NAME,NRECORDS_ADD, dst_size, dst_offset, dst_sizes,
&particle_in );
/* read the table */
@@ -111,7 +111,7 @@ int main( void )
/* print it by rows */
for (i=0; i<NRECORDS+NRECORDS_ADD; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -119,7 +119,7 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_03.c b/hl/examples/ex_table_03.c
index 7357dd2..fe4f401 100644
--- a/hl/examples/ex_table_03.c
+++ b/hl/examples/ex_table_03.c
@@ -32,13 +32,13 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
Particle dst_buf[NRECORDS];
@@ -50,19 +50,19 @@ int main( void )
HOFFSET( Particle, longi ),
HOFFSET( Particle, pressure ),
HOFFSET( Particle, temperature )};
-
+
Particle p = {"zero",0,0, 0.0f, 0.0};
size_t dst_sizes[NFIELDS] = { sizeof( p.name),
sizeof( p.lati),
sizeof( p.longi),
sizeof( p.pressure),
sizeof( p.temperature)};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
- /* Fill value particle */
- Particle fill_data[1] =
+ /* Fill value particle */
+ Particle fill_data[1] =
{ {"no data",-1,-1, -99.0f, -99.0} };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -73,8 +73,8 @@ int main( void )
herr_t status;
int i;
- /* Define 2 new particles to write */
- Particle particle_in[NRECORDS_WRITE] =
+ /* Define 2 new particles to write */
+ Particle particle_in[NRECORDS_WRITE] =
{ {"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0} };
@@ -95,21 +95,21 @@ int main( void )
file_id,
TABLE_NAME,
NFIELDS,
- NRECORDS,
- dst_size,
- field_names,
- dst_offset,
- field_type,
- chunk_size,
- fill_data,
+ NRECORDS,
+ dst_size,
+ field_names,
+ dst_offset,
+ field_type,
+ chunk_size,
+ fill_data,
0, /* no compression */
NULL ); /* no data written */
/* Overwrite 2 records starting at record 0 */
- start = 0;
- nrecords = NRECORDS_WRITE;
- status=H5TBwrite_records( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
+ start = 0;
+ nrecords = NRECORDS_WRITE;
+ status=H5TBwrite_records( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
dst_sizes, particle_in);
/* read the table */
@@ -117,7 +117,7 @@ int main( void )
/* print it by rows */
for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -125,7 +125,7 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_04.c b/hl/examples/ex_table_04.c
index c9559ef..55f4ee8 100644
--- a/hl/examples/ex_table_04.c
+++ b/hl/examples/ex_table_04.c
@@ -30,24 +30,24 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
/* Define a subset of Particle, with latitude and longitude fields */
- typedef struct Position
+ typedef struct Position
{
int lati;
int longi;
} Position;
/* Define a subset of Particle, with name and pressure fields */
- typedef struct NamePressure
+ typedef struct NamePressure
{
char name[16];
float pressure;
@@ -76,12 +76,12 @@ int main( void )
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
+ Particle fill_data[1] =
+ { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
hsize_t start; /* Record to start reading/writing */
hsize_t nrecords; /* Number of records to read/write */
int compress = 0;
- herr_t status;
+ herr_t status;
int i;
Particle *p_data = NULL; /* Initially no data */
float pressure_in [NRECORDS] = /* Define new values for the field "Pressure" */
@@ -89,21 +89,21 @@ int main( void )
Position position_in[NRECORDS] = { /* Define new values for "Latitude,Longitude" */
{0,0},
{10,10},
- {20,20},
- {30,30},
+ {20,20},
+ {30,30},
{40,40},
- {50,50},
- {60,60},
+ {50,50},
+ {60,60},
{70,70} };
NamePressure namepre_in[NRECORDS] = /* Define new values for "Name,Pressure" */
{ {"zero",0.0f},
- {"one", 1.0f},
- {"two", 2.0f},
- {"three", 3.0f},
+ {"one", 1.0f},
+ {"two", 2.0f},
+ {"three", 3.0f},
{"four", 4.0f},
{"five", 5.0f},
- {"six", 6.0f},
- {"seven", 7.0f},
+ {"six", 6.0f},
+ {"seven", 7.0f},
};
size_t field_sizes_pos[2]=
{
@@ -111,12 +111,12 @@ int main( void )
sizeof(position_in[0].lati)
};
size_t field_sizes_namepre[2]=
- {
+ {
sizeof(namepre_in[0].name),
sizeof(namepre_in[0].pressure)
};
size_t field_sizes_pre[1]=
- {
+ {
sizeof(namepre_in[0].pressure)
};
@@ -133,20 +133,20 @@ int main( void )
file_id = H5Fcreate( "ex_table_04.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* Make the table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
/* Write the pressure field starting at record 2 */
- start = 2;
- nrecords = 3;
- status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Pressure", start, nrecords,
+ start = 2;
+ nrecords = 3;
+ status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Pressure", start, nrecords,
sizeof( float ), 0, field_sizes_pre, pressure_in );
/* Write the new longitude and latitude information starting at record 2 */
- start = 2;
- nrecords = 3;
- status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords,
+ start = 2;
+ nrecords = 3;
+ status=H5TBwrite_fields_name( file_id, TABLE_NAME, "Latitude,Longitude", start, nrecords,
sizeof( Position ), field_offset_pos, field_sizes_pos, position_in );
/* read the table */
@@ -154,7 +154,7 @@ int main( void )
/* print it by rows */
for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -162,12 +162,12 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/*-------------------------------------------------------------------------
* end
*-------------------------------------------------------------------------
*/
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_05.c b/hl/examples/ex_table_05.c
index 62c231d..b39ef1d 100644
--- a/hl/examples/ex_table_05.c
+++ b/hl/examples/ex_table_05.c
@@ -31,29 +31,29 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
/* Define a subset of Particle, with latitude and longitude fields */
- typedef struct Position
+ typedef struct Position
{
int lati;
int longi;
} Position;
/* Define a subset of Particle, with name and pressure fields */
- typedef struct NamePressure
+ typedef struct NamePressure
{
char name[16];
float pressure;
} NamePressure;
-
+
/* Calculate the type_size and the offsets of our struct members */
Particle dst_buf[NRECORDS];
size_t dst_size = sizeof( Particle );
@@ -70,28 +70,28 @@ int main( void )
size_t field_offset_pos[2] = { HOFFSET( Position, lati ),
HOFFSET( Position, longi )};
-
+
/* Initially no data */
Particle *p_data = NULL;
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
+ Particle fill_data[1] =
+ { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
int compress = 0;
hsize_t nfields;
hsize_t start; /* Record to start reading/writing */
hsize_t nrecords; /* Number of records to read/write */
- herr_t status;
+ herr_t status;
int i;
/* Define new values for the field "Pressure" */
- float pressure_in [NRECORDS] =
+ float pressure_in [NRECORDS] =
{ 0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f };
int field_index_pre[1] = { 3 };
@@ -100,11 +100,11 @@ int main( void )
/* Define new values for the fields "Latitude,Longitude" */
Position position_in[NRECORDS] = { {0,0},
{10,10},
- {20,20},
- {30,30},
+ {20,20},
+ {30,30},
{40,40},
- {50,50},
- {60,60},
+ {50,50},
+ {60,60},
{70,70} };
size_t field_sizes_pos[2]=
@@ -112,9 +112,9 @@ int main( void )
sizeof(position_in[0].longi),
sizeof(position_in[0].lati)
};
-
+
size_t field_sizes_pre[1]=
- {
+ {
sizeof(float)
};
@@ -126,27 +126,27 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_05.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* Make the table */
- status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title", file_id, TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
/* Write the pressure field starting at record 2 */
nfields = 1;
- start = 2;
- nrecords = 3;
- status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords,
+ start = 2;
+ nrecords = 3;
+ status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords,
sizeof( float ), 0, field_sizes_pre, pressure_in );
/* Write the new longitude and latitude information starting at record 2 */
nfields = 2;
- start = 2;
- nrecords = 3;
- status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords,
+ start = 2;
+ nrecords = 3;
+ status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords,
sizeof( Position ), field_offset_pos, field_sizes_pos, position_in );
/* read the table */
@@ -154,7 +154,7 @@ int main( void )
/* print it by rows */
for (i=0; i<NRECORDS; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -162,7 +162,7 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_06.c b/hl/examples/ex_table_06.c
index 377afc3..a0d6017 100644
--- a/hl/examples/ex_table_06.c
+++ b/hl/examples/ex_table_06.c
@@ -30,13 +30,13 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
/* Calculate the size and the offsets of our struct members in memory */
@@ -46,20 +46,20 @@ int main( void )
HOFFSET( Particle, longi ),
HOFFSET( Particle, pressure ),
HOFFSET( Particle, temperature )};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
+ Particle fill_data[1] =
+ { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
int compress = 0;
hsize_t nfields_out;
hsize_t nrecords_out;
- herr_t status;
+ herr_t status;
/* Initialize field_type */
string_type = H5Tcopy( H5T_C_S1 );
@@ -69,13 +69,13 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_06.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
/* Make a table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size,
- field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,dst_size,
+ field_names, dst_offset, field_type,
chunk_size, fill_data, compress, NULL);
/* Get table info */
@@ -83,7 +83,7 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* Close the file. */
H5Fclose( file_id );
diff --git a/hl/examples/ex_table_07.c b/hl/examples/ex_table_07.c
index eb365b2..2d80967 100644
--- a/hl/examples/ex_table_07.c
+++ b/hl/examples/ex_table_07.c
@@ -30,13 +30,13 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
/* Calculate the size and the offsets of our struct members in memory */
@@ -46,9 +46,9 @@ int main( void )
HOFFSET( Particle, longi ),
HOFFSET( Particle, pressure ),
HOFFSET( Particle, temperature )};
-
+
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -66,14 +66,14 @@ int main( void )
hid_t file_id;
hsize_t chunk_size = 10;
int compress = 0;
- Particle fill_data[1] =
+ Particle fill_data[1] =
{ {"no data",-1,-1, -99.0f, -99.0} };
hsize_t start; /* Record to start reading */
hsize_t nrecords; /* Number of records to insert/delete */
hsize_t nfields_out;
hsize_t nrecords_out;
- herr_t status;
-
+ herr_t status;
+
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -82,18 +82,18 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_07.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make the table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
+
/* Delete records */
- start = 3;
- nrecords = 3;
+ start = 3;
+ nrecords = 3;
status=H5TBdelete_record( file_id, TABLE_NAME, start, nrecords );
/* Get table info */
@@ -101,11 +101,11 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* Close the file. */
H5Fclose( file_id );
-
+
return 0;
-
+
}
diff --git a/hl/examples/ex_table_08.c b/hl/examples/ex_table_08.c
index 8ce2881..fb6cab9 100644
--- a/hl/examples/ex_table_08.c
+++ b/hl/examples/ex_table_08.c
@@ -31,19 +31,19 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
Particle dst_buf[ NRECORDS + NRECORDS_INS ];
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -53,7 +53,7 @@ int main( void )
{"six", 60,60, 6.0f, 60.0},
{"seven",70,70, 7.0f, 70.0}
};
-
+
/* Calculate the size and the offsets of our struct members in memory */
size_t dst_size = sizeof( Particle );
size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
@@ -66,15 +66,15 @@ int main( void )
sizeof( p_data[0].longi),
sizeof( p_data[0].pressure),
sizeof( p_data[0].temperature)};
-
+
/* Define an array of Particles to insert */
- Particle p_data_insert[NRECORDS_INS] =
+ Particle p_data_insert[NRECORDS_INS] =
{ {"new",30,30, 3.0f, 30.0},
{"new",40,40, 4.0f, 40.0}
};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -88,7 +88,7 @@ int main( void )
hsize_t nfields_out;
hsize_t nrecords_out;
int i;
-
+
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -97,19 +97,19 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_08.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make the table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
/* Insert records */
- start = 3;
- nrecords = NRECORDS_INS;
- status=H5TBinsert_record( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
+ start = 3;
+ nrecords = NRECORDS_INS;
+ status=H5TBinsert_record( file_id, TABLE_NAME, start, nrecords, dst_size, dst_offset,
dst_sizes, p_data_insert );
/* read the table */
@@ -120,10 +120,10 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* print it by rows */
for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -131,12 +131,12 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file. */
H5Fclose( file_id );
-
+
return 0;
-
+
}
diff --git a/hl/examples/ex_table_09.c b/hl/examples/ex_table_09.c
index 21d1813..b02568c 100644
--- a/hl/examples/ex_table_09.c
+++ b/hl/examples/ex_table_09.c
@@ -32,13 +32,13 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
Particle dst_buf[ NRECORDS + NRECORDS_INS ];
@@ -57,7 +57,7 @@ int main( void )
sizeof( dst_buf[0].temperature)};
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -69,15 +69,15 @@ int main( void )
};
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
int compress = 0;
- Particle fill_data[1] =
- { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
+ Particle fill_data[1] =
+ { {"no data",-1,-1, -99.0f, -99.0} }; /* Fill value particle */
hsize_t start1; /* Record to start reading from 1st table */
hsize_t nrecords; /* Number of records to insert */
hsize_t start2; /* Record to start writing in 2nd table */
@@ -85,7 +85,7 @@ int main( void )
int i;
hsize_t nfields_out;
hsize_t nrecords_out;
-
+
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -94,24 +94,24 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_09.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make 2 tables: TABLE2_NAME is empty */
- status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
- status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+
+ status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, NULL );
-
-
+
+
/* Add 2 records from TABLE1_NAME to TABLE2_NAME */
- start1 = 3;
- nrecords = NRECORDS_INS;
- start2 = 6;
+ start1 = 3;
+ nrecords = NRECORDS_INS;
+ start2 = 6;
status=H5TBadd_records_from( file_id, TABLE1_NAME, start1, nrecords, TABLE2_NAME, start2 );
/* read TABLE2_NAME: it should have 2 more records now */
@@ -122,10 +122,10 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* print it by rows */
for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -133,10 +133,10 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file. */
H5Fclose( file_id );
-
+
return 0;
}
diff --git a/hl/examples/ex_table_10.c b/hl/examples/ex_table_10.c
index 5483d52..5e87914 100644
--- a/hl/examples/ex_table_10.c
+++ b/hl/examples/ex_table_10.c
@@ -32,17 +32,17 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -66,10 +66,10 @@ int main( void )
sizeof( dst_buf[0].longi),
sizeof( dst_buf[0].pressure),
sizeof( dst_buf[0].temperature)};
-
-
+
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -77,11 +77,11 @@ int main( void )
hsize_t chunk_size = 10;
int compress = 0;
int *fill_data = NULL;
- herr_t status;
+ herr_t status;
hsize_t nfields_out;
hsize_t nrecords_out;
int i;
-
+
/* Initialize the field field_type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -90,34 +90,34 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_10.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make two tables */
- status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE1_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
- status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
- dst_size,field_names, dst_offset, field_type,
+
+ status=H5TBmake_table( "Table Title",file_id,TABLE2_NAME,NFIELDS,NRECORDS,
+ dst_size,field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
+
/* Combine the two tables into a third in the same file */
status=H5TBcombine_tables( file_id, TABLE1_NAME, file_id, TABLE2_NAME, TABLE3_NAME );
/* read the combined table */
status=H5TBread_table( file_id, TABLE3_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
-
+
/* Get table info */
status=H5TBget_table_info (file_id,TABLE3_NAME, &nfields_out, &nrecords_out );
-
+
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* print it by rows */
for (i=0; i<nrecords_out; i++) {
- printf ("%-5s %-5d %-5d %-5f %-5f",
+ printf ("%-5s %-5d %-5d %-5f %-5f",
dst_buf[i].name,
dst_buf[i].lati,
dst_buf[i].longi,
@@ -125,10 +125,10 @@ int main( void )
dst_buf[i].temperature);
printf ("\n");
}
-
+
/* Close the file */
H5Fclose( file_id );
-
+
return 0;
}
diff --git a/hl/examples/ex_table_11.c b/hl/examples/ex_table_11.c
index d082f65..52aa922 100644
--- a/hl/examples/ex_table_11.c
+++ b/hl/examples/ex_table_11.c
@@ -30,17 +30,17 @@
int main( void )
{
- typedef struct Particle1
+ typedef struct Particle1
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle1;
-
+
/* Define an array of Particles */
- Particle1 p_data[NRECORDS] = {
+ Particle1 p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -50,7 +50,7 @@ int main( void )
{"six", 60,60, 6.0f, 60.0},
{"seven",70,70, 7.0f, 70.0}
};
-
+
/* Calculate the size and the offsets of our struct members in memory */
size_t dst_size1 = sizeof( Particle1 );
size_t dst_offset1[NFIELDS] = { HOFFSET( Particle1, name ),
@@ -58,9 +58,9 @@ int main( void )
HOFFSET( Particle1, longi ),
HOFFSET( Particle1, pressure ),
HOFFSET( Particle1, temperature )};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
@@ -70,14 +70,14 @@ int main( void )
Particle1 fill_data[1] = { "no data",-1,-1, -99.0f, -99.0 };
int fill_data_new[1] = { -100 };
hsize_t position;
- herr_t status;
+ herr_t status;
hsize_t nfields_out;
hsize_t nrecords_out;
-
+
/* Define the inserted field information */
hid_t field_type_new = H5T_NATIVE_INT;
int data[NRECORDS] = { 0,1,2,3,4,5,6,7 };
-
+
/* Initialize the field type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -86,18 +86,18 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_11.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make the table */
- status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
- dst_size1,field_names, dst_offset1, field_type,
+ status=H5TBmake_table( "Table Title",file_id,TABLE_NAME,NFIELDS,NRECORDS,
+ dst_size1,field_names, dst_offset1, field_type,
chunk_size, fill_data, compress, p_data );
-
+
/* Insert the new field at the end of the field list */
position = NFIELDS;
- status=H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position,
+ status=H5TBinsert_field( file_id, TABLE_NAME, "New Field", field_type_new, position,
fill_data_new, data );
/* Get table info */
@@ -105,12 +105,12 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* Close the file. */
H5Fclose( file_id );
-
+
return 0;
-
-
+
+
}
diff --git a/hl/examples/ex_table_12.c b/hl/examples/ex_table_12.c
index 9ec3054..26e238f 100644
--- a/hl/examples/ex_table_12.c
+++ b/hl/examples/ex_table_12.c
@@ -30,15 +30,15 @@
int main( void )
{
- typedef struct Particle
+ typedef struct Particle
{
char name[16];
int lati;
int longi;
float pressure;
- double temperature;
+ double temperature;
} Particle;
-
+
/* Calculate the size and the offsets of our struct members in memory */
size_t dst_size = sizeof( Particle );
size_t dst_offset[NFIELDS] = { HOFFSET( Particle, name ),
@@ -46,9 +46,9 @@ int main( void )
HOFFSET( Particle, longi ),
HOFFSET( Particle, pressure ),
HOFFSET( Particle, temperature )};
-
+
/* Define an array of Particles */
- Particle p_data[NRECORDS] = {
+ Particle p_data[NRECORDS] = {
{"zero",0,0, 0.0f, 0.0},
{"one",10,10, 1.0f, 10.0},
{"two", 20,20, 2.0f, 20.0},
@@ -58,21 +58,21 @@ int main( void )
{"six", 60,60, 6.0f, 60.0},
{"seven",70,70, 7.0f, 70.0}
};
-
+
/* Define field information */
- const char *field_names[NFIELDS] =
+ const char *field_names[NFIELDS] =
{ "Name","Latitude", "Longitude", "Pressure", "Temperature" };
hid_t field_type[NFIELDS];
hid_t string_type;
hid_t file_id;
hsize_t chunk_size = 10;
int compress = 0;
- Particle fill_data[1] =
+ Particle fill_data[1] =
{ {"no data",-1,-1, -99.0f, -99.0} };
- herr_t status;
+ herr_t status;
hsize_t nfields_out;
hsize_t nrecords_out;
-
+
/* Initialize the field type */
string_type = H5Tcopy( H5T_C_S1 );
H5Tset_size( string_type, 16 );
@@ -81,15 +81,15 @@ int main( void )
field_type[2] = H5T_NATIVE_INT;
field_type[3] = H5T_NATIVE_FLOAT;
field_type[4] = H5T_NATIVE_DOUBLE;
-
+
/* Create a new file using default properties. */
file_id = H5Fcreate( "ex_table_12.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT );
-
+
/* Make a table */
- status=H5TBmake_table( "Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size,
- field_names, dst_offset, field_type,
+ status=H5TBmake_table( "Table Title", file_id, TABLE_NAME, NFIELDS, NRECORDS, dst_size,
+ field_names, dst_offset, field_type,
chunk_size, fill_data, compress, p_data );
-
+
/* Delete the field */
status=H5TBdelete_field( file_id, TABLE_NAME, "Pressure" );
@@ -98,11 +98,11 @@ int main( void )
/* print */
printf ("Table has %d fields and %d records\n",(int)nfields_out,(int)nrecords_out);
-
+
/* Close the file. */
H5Fclose( file_id );
-
+
return 0;
-
+
}