17#pragma message "This function is conflicting with the F5F API and will fail in common situations. See source comments for details."
34 F5printf(55,
"F5Fopen_group_or_dataset() no group, trying for a dataset!");
38 F5printf(55,
"F5Fopen_group_or_dataset() no dataset found");
42 F5printf(55,
"F5Fopen_group_or_dataset() Yay dataset found!");
45 F5printf(55,
"F5Fopen_group_or_dataset() Yay! found group!");
51#pragma message "This function is contradicting and complicating the F5F API and thus deprecated. See source comments for details."
69 F5printf(1,
"F5Fget_fragment_attribute() could not find range attribute!");
74 *space_id = H5Aget_space(*attr_id);
75 assert( *space_id >0);
76 if (H5Sget_simple_extent_npoints(*space_id) != N)
82 F5printf(1,
"F5Fget_fragment_attribute() found range attribute with not N elements!");
116#pragma message "This function is conflicting with the F5F API, see comments for F5Fopen_group_or_dataset_attribute()"
122 *attr_id = H5Acreate2( gid>0? gid : did,
123 attribute_name, type_id, *space_id,
124 H5P_DEFAULT, H5P_DEFAULT );
127 if (*attr_id < 0 && force == 0)
129 F5printf(55,
"F5Fopen_or_create_group_or_dataset_attribute() Could not set %s attribute, might already exist.", attribute_name);
136 else if( *attr_id<0 )
138 F5printf(1,
"F5Fopen_or_create_group_or_dataset_attribute() Could not create attribute.");
157 type_size = H5Tget_size(type_id);
158 buf = (
char*)malloc( N * type_size );
159 F_H5Aread( attr_id, type_id, buf, attribute_name );
161 memcpy( data, buf, N * type_size );
176 type_size = H5Tget_size(type_id) ;
177 buf =(
char*)malloc( N * type_size );
179 memcpy(buf, data, N * type_size);
183 H5Awrite(attr_id, type_id, buf );
192 void*data, hsize_t N, hid_t mem_type_id )
194hid_t attr_id, space_id, type_id;
202 type_id = mem_type_id;
204 type_id = H5Aget_type(attr_id);
217 const void*data, hsize_t N, hid_t mem_type_id,
int force )
219const hsize_t dims = N;
220hid_t attr_id, type_id, space_id;
224 F5printf(5,
"F5Fset_attribute() got NULL F5Path, no range written!");
229 F5printf(5,
"F5Fset_attribute() F5Path has no field ID, no range written!");
233 space_id= H5Screate_simple(1, &dims, &dims );
236 type_id = mem_type_id;
238 type_id = H5Aget_type(attr_id);
268 void*data, hsize_t N, hid_t mem_type_id )
281 type_id = mem_type_id;
283 type_id = H5Aget_type(attr_id);
288 if (did>0) H5Dclose(did);
295 F5printf(55,
"F5Fget_fragment_attribute() returning normally!");
301 const void*data,
const hsize_t N, hid_t mem_type_id,
int force )
303const hsize_t dims = N;
311 F5printf(5,
"F5Fset_fragment_attribute() got NULL F5Path, no range written!");
316 F5printf(5,
"F5Fset_fragment_attribute() F5Path has no field ID, no range written!");
320 space_id= H5Screate_simple(1, &dims, &dims );
321 type_id = mem_type_id;
325 F5printf(50,
"F5Fset_fragment_attribute() Could not set %s attribute, fragment %s does not exist.",
326 attribute_name, fragment_name);
340 if (did>0) H5Dclose(did);
342 F5printf(55,
"F5Fset_fragment_attribute2() returning normally!");
354 if( fragment_name != NULL )
356 hid_t type_id = H5Tcopy(H5T_C_S1);
357 hid_t space_id = H5Screate(H5S_SCALAR);
359 size_t size = strlen(text);
360 H5Tset_size(type_id, size);
361 H5Tset_strpad(type_id, H5T_STR_NULLTERM);
364 attr_id = H5Acreate2( f->
Field_hid, attribute_name, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
368 F5printf(50,
"F5Fset_string_attribute(): Unit Attribute %s written to %d.",
370 H5Awrite(attr_id, type_id, text);
375 F5printf(50,
"F5Fset_string_attribute(): WARNING Unit Attribute not written to %s/%d.",
385 hid_t type_id = H5Tcopy(H5T_C_S1);
386 hid_t space_id = H5Screate(H5S_SCALAR);
388 size_t size = strlen(text);
389 H5Tset_size(type_id, size);
390 H5Tset_strpad(type_id, H5T_STR_NULLTERM);
405 F5printf(50,
"F5Fset_string_attribute(): String attribute %s written to %d.", text, (
int)f->
Field_hid);
406 H5Awrite(attr_id, type_id, text);
411 F5printf(50,
"F5Fset_string_attribute(): WARNING Unit Attribute not written to %s/%d.", text, (
int)f->
Field_hid);
420 F5printf(50,
"F5Fset_string_attribute(): Invalid field ID.");
427hid_t attr_id, space_id;
431 if( fragment_name != NULL )
434 attr_id = H5Aopen( f->
Field_hid, attribute_name, H5P_DEFAULT);
438 F5printf(50,
"F5Fset_string_attribute(): txt attribute %s fount at %d.",
441 type_id = H5Aget_type( attr_id );
443 size_t str_len = H5Tget_size( type_id );
445 *text = (
char*) calloc( str_len,
sizeof(
char) );
447 H5Aread(attr_id, H5T_STRING, *text );
454 F5printf(50,
"F5Fset_string_attribute(): WARNING Unit Attribute not written to %s/%d.",
480 F5printf(50,
"F5Fset_string_attribute(): txt attribute %s fount at %d.",
483 type_id = H5Aget_type( attr_id );
485 size_t str_len = H5Tget_size( type_id );
489 *text = (
char*) calloc( str_len,
sizeof(
char) );
491 H5Aread(attr_id, type_id, *text );
499 F5printf(50,
"F5Fset_string_attribute(): WARNING Unit Attribute not written to %s/%d.", text, (
int)f->
Field_hid);
508 F5printf(50,
"F5Fset_string_attribute(): Invalid field ID.");
538 minmax_ghost, 2, mem_type_id);
551 minmax_ghost, 2, type_id);
555 unsigned long* size_ghost)
557unsigned long sizes[2];
560 sizes, 2, H5T_NATIVE_ULONG );
562 *size_real = sizes[0];
563 *size_ghost = sizes[1];
570unsigned long sizes[2];
571 sizes[0] = size_real;
572 sizes[1] = size_ghost;
574 sizes, 2, H5T_NATIVE_ULONG, force );
583 F5printf(50,
"F5Fis_attribute_of_type, invalid F5Path");
589 if (H5Tequal(HDF5_type,gettype))
613hid_t attrib = 0, gid = -1, did = -1;
617 F5printf(15,
"F5Fis_range_of_type, invalid F5Path");
624 hid_t gettype =
F5Aget_type((gid>0)?gid:did, attribute_name, &attrib);
626 if (H5Tequal(HDF5_type,gettype))
631 if (did > 0) H5Dclose(did);
640 if (did > 0) H5Dclose(did);
650 F5printf(50,
"F5Fhas_attribute, invalid F5Path");
654htri_t exist = H5Aexists(f->
Field_hid, attr_name);
660 puts(
"F5Fhas_attribute, ERROR H5Aexists failed");
671hssize_t nr_elements = 0;
672hid_t did = 0 , gid = 0;
677 F5printf(50,
"F5Fget_attribute_nr_elements, invalid F5Path");
681 if( fragment_name != NULL )
685 if( check == 0 )
return 0;
687 hid_t open_id = gid>0?gid:did;
694 F5printf(1,
"F5Fget_attribute_nr_elements could not find attribute %s!", attribute_name);
697 space_id = H5Aget_space( attr_id );
699 nr_elements = H5Sget_simple_extent_npoints( space_id );
701 H5Sclose( space_id );
716 F5printf(1,
"F5Fget_attribute_nr_elements could not find attribute %s!", attribute_name);
720 space_id = H5Aget_space( attr_id );
722 nr_elements = H5Sget_simple_extent_npoints( space_id );
724 H5Sclose( space_id );
736 F5printf(50,
"F5Fhas_attribute, invalid F5Path");
740hid_t Gid = -1, Did = -1;
744 Gid = H5Gopen2(f->
Field_hid, fragment_name, H5P_DEFAULT);
748 F5printf(55,
"F5Fhas_fragment_attribute() no group, trying for a dataset!");
749 Did = H5Dopen2(f->
Field_hid, fragment_name, H5P_DEFAULT);
752 F5printf(55,
"F5Fhas_fragment_attribute() no dataset found");
758 F5printf(55,
"F5Fhas_fragment_attribute() Yay dataset found!");
761 F5printf(55,
"F5Fhas_fragment_attribute() Yay! found group!");
765htri_t exist = H5Aexists((Gid>0)?Gid:Did, attr_name);
767 if (Did > 0) H5Dclose(Did);
774 puts(
"F5Fhas_attribute, ERROR H5Aexists failed");
870 strcpy( buf,
"Undefined" );
875 if( H5Tequal( H5T_NATIVE_USHORT, type_id ) )
876 strcpy( buf,
"H5T_NATIVE_USHORT" );
877 else if( H5Tequal( H5T_NATIVE_INT, type_id ) )
878 strcpy( buf,
"H5T_NATIVE_INT" );
879 else if( H5Tequal( H5T_NATIVE_UCHAR, type_id ) )
880 strcpy( buf,
"H5T_NATIVE_UCHAR" );
881 else if( H5Tequal( H5T_NATIVE_FLOAT, type_id ) )
882 strcpy( buf,
"H5T_NATIVE_FLOAT" );
883 else if( H5Tequal( H5T_NATIVE_DOUBLE, type_id ) )
884 strcpy( buf,
"H5T_NATIVE_DOUBLE" );
886 strcpy( buf,
"F5T_COORD3_FLOAT" );
888 strcpy( buf,
"F5T_COORD3_DOUBLE" );
890 strcpy( buf,
"F5T_VEC3_FLOAT" );
892 strcpy( buf,
"F5T_VEC3_DOUBLE" );
894 strcpy( buf,
"F5T_BIVEC3_FLOAT" );
896 strcpy( buf,
"F5T_BIVEC3_DOUBLE" );
897 else if( H5Tequal( F5T_METRIC33_FLOAT, type_id ) )
898 strcpy( buf,
"F5T_METRIC33_FLOAT" );
900 strcpy( buf,
"F5T_METRIC33_DOUBLE" );
926 puts(
"F5Fset_dictionary2() error setting FIBER_FIELD_DICTIONARY attribute!");
932 H5T_NATIVE_USHORT, force);
935 H5T_NATIVE_USHORT, force);
953 puts(
"F5Fget_dictionary() error getting FIBER_FIELD_DICTIONARY attribute!");
F5_API hid_t F5Aget_type(hid_t loc_id, const char *name, hid_t *attrib)
int F5Fis_group(const F5Path *fpath)
hid_t F5Fget_type(F5Path *f)
#define F5T_BIVEC3_DOUBLE
#define F5T_COORD3_DOUBLE
#define F5T_METRIC33_DOUBLE
#define FIBER_FIELD_DICTIONARY_WORDS
#define FIBER_FIELD_ORIGIANL_TYPE
#define FIBER_FIELD_COMPONENT_AVERAGE
#define FIBER_FIELD_COMPONENT_DEVIATION
#define FIBER_FIELD_COMPONENT_RANGE
#define F5_METRIC_UNIT_DESCRIPTION
#define FIBER_FIELD_COMPONENT_RANGE_GHOST
#define FIBER_FIELD_COMPONENT_HISTOGRAM
#define FIBER_FRAGMENT_ARRAY_SIZE_GHOST_ATTRIBUTE
#define FIBER_FIELD_DICTIONARY
herr_t F_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *name)
#define F5printf(verbosity,...)
hid_t F5Aopen_name(hid_t location, const char *name)