FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
F5L.h File Reference
#include "hdf5inc.h"
#include "F5WinDLLApi.h"
#include "F5defs.h"

Go to the source code of this file.

Macros

#define F5P_DEFAULT   (-1)

Functions

F5_API hid_t F5Lcreate (hid_t R_id, const char *fieldname, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t property_id)
F5_API hid_t F5LTcreate_topology (hid_t Grid_hid, const char *TopologyName, int IndexDepth, int SkeletonDimensionality, int DataspaceDimensionality, const hsize_t *refinement)
F5_API int F5LTset_maximal_grid_refinement (hid_t ContentsGroup_id, const char *gridname, int IndexDepth, int Dimensionality, const hsize_t *refinement)
F5_API int F5LTget_maximal_grid_refinement (hid_t ContentsGroup_id, const char *gridname, hsize_t *refinement)
F5_API int F5LTget_maximal_skeleton_refinement (hid_t ContentsGroup_id, const char *gridname, hsize_t *refinement, int IndexDepth, int Dimensionality)
F5_API int F5LTget_index_depth (hid_t Top_hid)
F5_API hid_t F5Lwrite (hid_t R_id, const char *fieldname, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t enum_type, hid_t property_id)
F5_API hid_t F5LwriteS (hid_t Container_id, const char *name, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t enum_type, hid_t dcpl_id)
F5_API int F5LreadS (hid_t Container_id, hid_t memtype, void *dataPtr, hid_t ElementLoadID)
F5_API hid_t F5Lwrite_fraction (hid_t R_id, const char *fieldname, int dimension, const hsize_t *full_dims, const hsize_t *datasize, hid_t fieldtype, hid_t memtype, const void *dataPtr, const hsize_t *datastart, const hsize_t *start_border, const hsize_t *end_border, const char *fraction_name, hid_t enum_type, hid_t property_id)
F5_API hid_t F5Lwrite_fractionS (hid_t R_id, const char *fieldname, int dimension, const hsize_t *full_dims, const hsize_t *datasize, hid_t fieldtype, hid_t memtype, const void *dataPtr, const hsize_t *datastart, const hsize_t *start_border, const hsize_t *end_border, const char *fraction_name, hid_t enum_type, hid_t property_id)
F5_API hid_t F5Lwrite_fraction_external (hid_t R_id, const char *fieldname, const char *target_file_name, const char *target_obj_name, const char *prefix, int rank, const hsize_t *full_dims, const hsize_t *datasize, hid_t fieldtype, hid_t memtype, const void *dataPtr, const hsize_t *datastart, const hsize_t *start_border, const hsize_t *end_border, const char *fraction_name, hid_t enum_type, hid_t property_id)
F5_API hid_t F5LSwrite_fraction (hid_t R_id, const char *fieldname, int dimension, const hsize_t *full_dims, const hsize_t *datasize, hid_t fieldtype, hid_t memtype, const void *const *dataPtr, const hsize_t *datastart, const hsize_t *start_border, const hsize_t *end_border, const char *fraction_name, hid_t enum_type, hid_t property_id)
F5_API hid_t F5Lwrite1D (hid_t R_id, const char *fieldname, hsize_t nElements, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t enum_type, hid_t property_id)
F5_API hid_t F5Lwrite_linear (hid_t R_id, const char *fieldname, int dimension, const hsize_t *dataspace_dims, hid_t fieldtype, const void *base, const void *delta)
F5_API int F5Lis_linear (hid_t Rep_id, const char *fieldname)
F5_API hid_t F5Lread_linear (hid_t F_id, hsize_t *dims, hid_t fieldtype, void *base, void *delta)
F5_API hid_t F5Lwrite_entity (hid_t R_id, const char *fieldname, hid_t fieldtype, const void *value)
F5_API hid_t F5Lwrites (hid_t F_id, const char *fieldname, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *const *dataPtr, hid_t enum_type, hid_t property_id)
F5_API hid_t F5LwriteX (hid_t R_id, const char *fieldname, int Mrank, const hsize_t dims[], hid_t fieldtype, hid_t memtype, const void *const dataPtr[], const int polynom_order[], const int component_map[], hid_t property_id, hid_t ProcIDLocation)
F5_API hid_t F5Lget_type (hid_t Field_hid, int FieldIDisGroup, hid_t elink_fapl_id)
F5_API int F5Lget_field_dimension_and_type (hid_t Representation_hid, const char *fieldname, hsize_t dims[FIBER_MAX_RANK], hid_t *type_id)
F5_API int F5LAsave_dimensions (hid_t Field_id, const char *aname, int rank, const hsize_t *dims)
F5_API int F5LAget_dimensions (hid_t Field_id, const char *aname, hsize_t dims[FIBER_MAX_RANK])
F5_API int F5Lset_space (hid_t Field_id, int rank, const hsize_t *dims)
F5_API int F5Dset_type_attribute (hid_t F_id, hid_t fieldtype)
F5_API hid_t F5Lget_space (hid_t Field_id)
F5_API int F5Lget_compound_extent_dims (hid_t CompoundGroupID, hsize_t *dims)
F5_API hid_t F5Lget_compound_space (hid_t CompoundGroupID)

Macro Definition Documentation

◆ F5P_DEFAULT

#define F5P_DEFAULT   (-1)

Function Documentation

◆ F5Dset_type_attribute()

F5_API int F5Dset_type_attribute ( hid_t F_id,
hid_t fieldtype )

Add an attribute to the given group that designates this group as storing multiple components of some compound data types.

Definition at line 1052 of file F5L.c.

1053{
1054hid_t TypeAttrDS_hid;
1055hid_t TypeAttr_hid;
1056herr_t herr;
1057void *buf;
1058
1059 TypeAttr_hid = F5Atry_to_open( F_id, FIBER_HDF5_TYPEID_ATTRIB );
1060 if (TypeAttr_hid>0)
1061 {
1062 F5printf(5, "F5 Warning: F5Dset_type_attribute(): type already exists!\n");
1063 H5Aclose(TypeAttr_hid);
1064 return -1;
1065 }
1066
1067 TypeAttrDS_hid = H5Screate(H5S_SCALAR);
1068 TypeAttr_hid = H5Acreate2(F_id, FIBER_HDF5_TYPEID_ATTRIB, fieldtype, TypeAttrDS_hid,
1069 H5P_DEFAULT, H5P_DEFAULT);
1070 if (TypeAttr_hid<0)
1071 {
1072 F5printf(1, "F5Dset_type_attribute::H5Acreate() failed.");
1073 H5Sclose(TypeAttrDS_hid);
1074 return -3;
1075 }
1076
1077 buf = calloc( H5Tget_size(fieldtype), 1);
1078 herr = H5Awrite(TypeAttr_hid, fieldtype, buf);
1079 if (herr<0) F5printf(1, "F5Dset_type_attribute::H5Awrite() failed.");
1080 H5Sclose(TypeAttrDS_hid);
1081 H5Aclose(TypeAttr_hid);
1082 free(buf);
1083
1084 if (!F5Tcheck_committed(fieldtype))
1085 F5printf(0, "F5 Warning: F5Dset_type_attribute(): compound type not committed!\n");
1086
1087 return 0;
1088}
hid_t F5Atry_to_open(hid_t location, const char *name)
Definition F5A.c:23
int F5Tcheck_committed(hid_t fieldtype)
Definition F5L.c:34
free(name)
#define FIBER_HDF5_TYPEID_ATTRIB
Definition F5defs.h:144
#define F5printf(verbosity,...)
Definition F5private.h:60

References F5Atry_to_open(), F5printf, F5Tcheck_committed(), FIBER_HDF5_TYPEID_ATTRIB, and free().

Referenced by F5Fwrite_fraction(), F5Fwrite_fractionS(), F5FwriteIMAGE(), F5LSwrite_fraction(), F5LwriteS(), F5Lwrites(), and F5LwriteX().

◆ F5Lget_space()

F5_API hid_t F5Lget_space ( hid_t Field_id)

Get the dataspace of an F5 field. The field id may be a group or a dataset ID. If it has an dimensions attribute, then this one is taken for dataspace information. Otherwise, the dataspace of the dataset is used. If it's not a dataset and does not have a dimension attribute, then it's an error.

Definition at line 250 of file F5L.c.

251{
252hid_t space_id, attr_id;
253int rank = -1, i, Dims[FIBER_MAX_RANK];
254hsize_t dims[FIBER_MAX_RANK];
255
256 F5printf(40, "-- F5Lget_space(): Determine skeleton topology.");
257
258 H5E_BEGIN_TRY
260 H5E_END_TRY
261
262 if (attr_id>0)
263 {
264 hsize_t TotalNumber = 1;
265
266 space_id = H5Aget_space(attr_id);
267 rank = H5Sget_simple_extent_npoints(space_id);
268
270 H5Aclose(attr_id);
271 H5Sclose(space_id);
272
273 for(i=0; i<rank; i++)
274 {
275 dims[i] = Dims[i];
276 TotalNumber *= dims[i];
277 }
278 if (TotalNumber==0) /* no known regular topology here */
279 {
280 F5printf(20, " F5Lget_space(): Unknown topology, might be complex.");
281 return -1;
282 }
283
284 space_id = H5Screate_simple(rank, dims, dims);
285 return space_id;
286 }
287
288 space_id = H5Dget_space(Field_id);
289 return space_id;
290}
#define FIBER_MAX_RANK
Definition F5defs.h:105
#define FIBER_FIELD_DATASPACE_DIMENSIONS_ATTRIBUTE
Definition F5defs.h:153
herr_t F_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *name)
Definition F5private.c:332
hid_t F5Aopen_name(hid_t location, const char *name)
Definition F5A.c:34

References F5Aopen_name(), F5printf, F_H5Aread(), FIBER_FIELD_DATASPACE_DIMENSIONS_ATTRIBUTE, and FIBER_MAX_RANK.

◆ F5Lis_linear()

F5_API int F5Lis_linear ( hid_t Rep_id,
const char * fieldname )

Definition at line 985 of file F5L.c.

986{
987hid_t attr_id, F_id;
988
989 H5E_BEGIN_TRY
990 F_id = H5Gopen2(Rep_id, fieldname, H5P_DEFAULT);
991 H5E_END_TRY
992
993 if (F_id<0)
994 return 0;
995
996 H5E_BEGIN_TRY
998 H5E_END_TRY
999
1000 if (attr_id<0)
1001 {
1002 puts("no "FIBER_UNIFORMARRAY_BASE_ATTRIBUTE" attribute!");
1003 H5Gclose( F_id );
1004 return 0;
1005 }
1006 H5Aclose(attr_id);
1007
1008 H5E_BEGIN_TRY
1010 H5E_END_TRY
1011
1012 if (attr_id<0)
1013 {
1014 H5Gclose( F_id );
1015 return 0;
1016 }
1017 H5Aclose(attr_id);
1018 H5Gclose( F_id );
1019
1020 return 1;
1021}
#define FIBER_UNIFORMARRAY_DELTA_ATTRIBUTE
Definition F5defs.h:159
#define FIBER_UNIFORMARRAY_BASE_ATTRIBUTE
Definition F5defs.h:158
#define H5Gclose(x)
Definition F5X.h:144

References F5Aopen_name(), FIBER_UNIFORMARRAY_BASE_ATTRIBUTE, FIBER_UNIFORMARRAY_DELTA_ATTRIBUTE, and H5Gclose.

Referenced by F5Fis_linear(), F5P_is_rectilinear(), and F5P_is_uniform().

◆ F5Lwrite_fraction_external()

F5_API hid_t F5Lwrite_fraction_external ( hid_t R_id,
const char * fieldname,
const char * target_file_name,
const char * target_obj_name,
const char * prefix,
int rank,
const hsize_t * full_dims,
const hsize_t * datasize,
hid_t fieldtype,
hid_t memtype,
const void * dataPtr,
const hsize_t * datastart,
const hsize_t * start_border,
const hsize_t * end_border,
const char * fraction_name,
hid_t enum_type,
hid_t property_id )

Definition at line 738 of file F5L.c.

751{
752hid_t F_id, B_id;
753
754 F5printf(20, "F5Lwrite_fraction(rank=%d)", rank);
755 if (rank==3)
756 F5printf(20, "F5Lwrite_fraction(%lux%lux%lu)",
757 (long)datasize[0], (long)datasize[1], (long)datasize[2]);
758
759 F_id = F5Gappend_external(R_id, fieldname, target_file_name, target_obj_name, prefix );
760 if (F_id<0)
761 {
762 F5printf(20, "F5Lwrite_fraction_external() - FAILED to create external field fragment.");
763 return F_id;
764 }
765
766 {
767 char myBlockname[ MAX_BLOCKNAME ];
768 B_id = F5Lwrite(F_id, fraction_name?fraction_name:blockname(myBlockname, rank, datastart),
769 rank, datasize, fieldtype, memtype, dataPtr, enum_type, property_id);
770
771 if (B_id<=0)
772 {
773 F5printf(1, "F5Lwrite_fraction_external() - FAILED to append field fragment data.");
774 F5Xclose(F_id);
775 return B_id;
776 }
777 }
778 if (full_dims)
779 F5Lset_space(F_id, rank, full_dims);
780
782
783 if (start_border)
785
786 if (end_border)
788
789 F5Xclose(B_id);
790 return F_id;
791}
#define MAX_BLOCKNAME
Definition F5L.c:623
#define FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE
Definition F5defs.h:175
#define FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE
Definition F5defs.h:176
#define FIBER_FRAGMENT_OFFSET_ATTRIBUTE
Definition F5defs.h:174
int F5LAsave_dimensions(hid_t Field_id, const char *aname, int rank, const hsize_t *dims)
Definition F5A.c:192
hid_t F5Lwrite(hid_t R_id, const char *fieldname, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t enum_type, hid_t dcpl_id)
Definition F5L.c:357
int F5Lset_space(hid_t Field_id, int rank, const hsize_t *dims)
Definition F5L.c:292
hid_t F5Gappend_external(hid_t loc_id, const char *name, const char *target_file_name, const char *target_obj_name, const char *prefix)
Definition F5X.c:136
herr_t F5Xclose(hid_t obj_id)
Definition F5X.c:347

References F5Gappend_external(), F5LAsave_dimensions(), F5Lset_space(), F5Lwrite(), F5printf, F5Xclose(), FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE, FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE, FIBER_FRAGMENT_OFFSET_ATTRIBUTE, and MAX_BLOCKNAME.

Referenced by F5Fwrite_fraction_external().

◆ F5Lwrite_fractionS()

F5_API hid_t F5Lwrite_fractionS ( hid_t R_id,
const char * fieldname,
int dimension,
const hsize_t * full_dims,
const hsize_t * datasize,
hid_t fieldtype,
hid_t memtype,
const void * dataPtr,
const hsize_t * datastart,
const hsize_t * start_border,
const hsize_t * end_border,
const char * fraction_name,
hid_t enum_type,
hid_t property_id )

Write a contiguious compound data set as separated compound data into the file, which involves data transformation.

Calls F5LwriteS().

Definition at line 691 of file F5L.c.

699{
700hid_t F_id, B_id;
701
702 F5printf(-1, "F5Lwrite_fractionS(rank=%d)", rank);
703
704 F_id = F5Gappend(R_id, fieldname);
705 if (F_id<0)
706 {
707 F5printf(1, "F5Lwrite_fractionS() - FAILED to append field fragment group.");
708 return F_id;
709 }
710 {
711 char myBlockname[MAX_BLOCKNAME];
712 B_id = F5LwriteS(F_id, fraction_name?fraction_name:blockname(myBlockname, rank, datastart),
713 rank, datasize, fieldtype, memtype, dataPtr, enum_type, property_id);
714 }
715 if (B_id<0)
716 {
717 F5printf(1, "F5Lwrite_fractionS() - FAILED to append field fragment data.");
718 F5Xclose(F_id);
719 return B_id;
720 }
721
722 if (full_dims)
723 F5Lset_space(F_id, rank, full_dims);
724
726
727 if (start_border)
729
730 if (end_border)
732
733 F5Xclose(B_id);
734 return F_id;
735}
hid_t F5LwriteS(hid_t R_id, const char *fieldname, int dimension, const hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t enum_type, hid_t dcpl_id)
Definition F5L.c:418
hid_t F5Gappend(hid_t loc_id, const char *name)
Definition F5X.c:59

References F5Gappend(), F5LAsave_dimensions(), F5Lset_space(), F5LwriteS(), F5printf, F5Xclose(), FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE, FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE, FIBER_FRAGMENT_OFFSET_ATTRIBUTE, and MAX_BLOCKNAME.

Referenced by F5Fwrite_fractionS().

◆ F5LwriteX()

F5_API hid_t F5LwriteX ( hid_t R_id,
const char * fieldname,
int Mrank,
const hsize_t dims[],
hid_t fieldtype,
hid_t memtype,
const void *const dataPtr[],
const int polynom_order[],
const int component_map[],
hid_t property_id,
hid_t ProcIDLocation )

Write a field as an n-dimensional direct product, where each dimensional extend is given as an explicit dataset or a polynom. Used e.g. for as rectilinear coordinates, uniform coordinates or "stacked" coordinates.

Parameters
rankThe rank n (dimensionality) of the dataset.
dimsThe extent (size) of the dataset in each dimension.
fieldtypeThe type of the dataset; it must be a compound type with n members.
memtypeThe type of the dataset how it resides in memory; it must be a compound type with n members where the ith member must be convertible to the field type's ith member.
polynom_orderFor each dimension, provides the order of the respective polynom. If it is negative, then the respective coordinate is interpreted as given explicitely by a dataset containing each point and the extent is taken from the dims parameter.
property_idData creation properties, may be F5P_DEFAULT.
ProcIDLocationGroup ID where the enumeration type is stored in the file.
Note
The component order of the field and memory type do not need to be identical, i.e. the field type may be {x,y,z}, while the memory type specifies {z,y,x}. The data are accessed in memory according to the memory type, but written into the file in the order as specified by the field type.

References F5_API, and FIBER_MAX_RANK.