FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
Basic Operations dealing with semantic structures below the end-user API.

Data Structures

struct  _TimeTableEntry

Typedefs

typedef struct _TimeTableEntry TimeTableEntry

Functions

F5_API hid_t F5Bcreate_timetable_type (void)
F5_API hsize_t F5Bappend_timetable (hid_t loc_id, hid_t timetable_type_location_id, const TimeTableEntry *TTE, hsize_t append_dims)
F5_API hsize_t F5Bget_timetable_size (hid_t loc_id)
hsize_t F5Bread_timetable (hid_t loc_id, TimeTableEntry *TTE, hsize_t table_size)
F5_API F5_TimeParameterF5BnewTimeParameter (void)
F5_API void F5deleteTimeParameter (F5_TimeParameter **)
F5_API int F5setTimeUnit (hid_t file_id, const F5_TimeParameter *)
F5_API int F5getTimeUnit (hid_t file_id, F5_TimeParameter *)
F5_API char * F5I_timegroup (const double *time, char *destbuf, size_t len)
F5_API hid_t F5Bappend_timeslice (hid_t file_id, const F5_TimeParameter *time)
F5_API hid_t F5Bappend_slice (hid_t file_id, const double *time)
F5_API F5PathF5Binitialize_path (hid_t File_id)
F5_API hid_t F5BgetMostRecentSlice (double *t, hid_t FileID, const char **time_attrib_names)
F5_API hid_t F5BgetMostRecentFileSlice (double t, const char *filename)
F5_API hid_t F5BgetGridVertexData (hid_t SliceID, const char *gridname, const char *chartname, const char *fieldname)

Detailed Description

Typedef Documentation

◆ TimeTableEntry

Data type entry for time tables.

Function Documentation

◆ F5Bappend_slice()

F5_API hid_t F5Bappend_slice ( hid_t file_id,
const double * time )

Get the HDF5 identifier for a given time slice. A new group is created in the file if none exists yet.

Parameters
file_idHDF5 File identifier.
timeThe time is specified as a pointer, such that it may be NULL to indicate a static dataset.
Returns
HDF5 identifier for the newly created or opened Time Slice group.
Todo

Maybe move to another header.

Add consistency check on re-open of an existing group

Definition at line 140 of file F5Bslice.c.

141{
142char timename[128];
143hid_t Slice_hid = F5Gappend(file_id, F5I_timegroup(time, timename, sizeof(timename) ));
144
145 if (time)
146 F5printf(30," -- F5Bappend_slice(%lg)", *time);
147 else
148 F5printf(30," -- F5Bappend_slice( <static> )");
149
150 if (time)
151 {
152 /* TODO: add time slice attribute ONLY if it is not yet
153 // there. Think about: what if it is there, but is
154 // not consistent?
155 */
156 hid_t space_hid = H5Screate(H5S_SCALAR);
157 hid_t attr_hid = F5Aappend(Slice_hid, FIBER_HDF5_TIME_ATTRIB , H5T_NATIVE_DOUBLE, space_hid, H5P_DEFAULT);
158 H5Awrite(attr_hid, H5T_NATIVE_DOUBLE, time);
159 H5Sclose(space_hid);
160 H5Aclose(attr_hid);
161 }
162 return Slice_hid;
163}
hid_t F5Aappend(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist)
Definition F5A.c:9
#define FIBER_HDF5_TIME_ATTRIB
Definition F5defs.h:45
#define F5printf(verbosity,...)
Definition F5private.h:60
char * F5I_timegroup(const double *time, char *destbuf, size_t len)
Definition F5Bslice.c:90
hid_t F5Gappend(hid_t loc_id, const char *name)
Definition F5X.c:59

References F5Aappend(), F5Gappend(), F5I_timegroup(), F5printf, and FIBER_HDF5_TIME_ATTRIB.

Referenced by F5Bappend_timeslice(), and F5LTcreateV().

◆ F5Bappend_timeslice()

F5_API hid_t F5Bappend_timeslice ( hid_t file_id,
const F5_TimeParameter * time )

Append a time slice in the given time unit. Only one time unit is allowed per file. If another time unit has already been defined in the file, the function will return without touching the file.

Definition at line 134 of file F5Bslice.c.

135{
136 /* ...TODO: Coding....... */
137 return F5Bappend_slice(file_id, &time->value);
138}
hid_t F5Bappend_slice(hid_t file_id, const double *time)
Definition F5Bslice.c:140
double value
Definition F5B.h:47

References F5Bappend_slice(), and _F5_TimeParameter::value.

◆ F5Bappend_timetable()

F5_API hsize_t F5Bappend_timetable ( hid_t loc_id,
hid_t timetable_type_location_id,
const TimeTableEntry * TTE,
hsize_t append_dims )

Initialize a time table for the given location.

Parameters
timetable_type_idThe type for time table entries, such as provided by F5Bcreate_timetable_type(), but it may well be (and should be) a named type instead of a transient type.
Returns
false if the time table already existed. F5_API int F5Binit_timetable(hid_t loc_id, hid_t timetable_type_id);

Append entries to the time table associated with a certain location.

Parameters
timetable_type_location_idthe location ID where the named datatype for timetable entries will be stored, in case it needs to be created.

Definition at line 261 of file F5Bslice.c.

264{
265hid_t mem_space_id;
266hid_t dataset_id;
267hsize_t size = 0;
268hsize_t current_dim = 0;
269
270 if (!TTE) return 0;
271
272 mem_space_id = H5Screate_simple( 1, &append_dims, NULL);
273
274 H5E_BEGIN_TRY
275 dataset_id = H5Dopen2( loc_id, F5_TIMETABLE_NAME, H5P_DEFAULT);
276 H5E_END_TRY
277
278/* printf("F5Bappend_timetable(,,TimeTableEntry={%g,%s},%d)\n",
279 TTE->TimeValue, TTE->TimesliceName,
280 (int)append_dims );
281 fflush(stdout);
282*/
283 if (dataset_id<=0)
284 {
285 dataset_id =
286 F5Bcreate_timetable_dataset(loc_id, dtype_location_id, append_dims);
287
288 if (dataset_id<=0)
289 return 0;
290
291 {
292 hid_t timetable_type_id = F5Bcreate_timetable_type();
293 H5Dwrite( dataset_id, timetable_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, TTE);
294 H5Tclose( timetable_type_id );
295 }
296 H5Dclose( dataset_id );
297 return append_dims;
298 }
299
300 {
301 hid_t current_file_space_id = H5Dget_space(dataset_id );
302 H5Sget_simple_extent_dims( current_file_space_id, &current_dim, NULL);
303 H5Sclose( current_file_space_id );
304 }
305
306 size = append_dims + current_dim;
307 H5Dset_extent( dataset_id, &size);
308
309 {
310 hid_t file_space_id = H5Dget_space(dataset_id );
311 H5Sselect_hyperslab(file_space_id, H5S_SELECT_SET, &current_dim, NULL, &append_dims, NULL);
312
313/* printf("F5Bappend_timetable(): New extent %d, insert at %d, count = %d\n",
314 (int)size, (int)current_dim, (int)append_dims);
315*/
316 hid_t timetable_type_id = F5Bcreate_timetable_type();
317 H5Dwrite( dataset_id, timetable_type_id, mem_space_id, file_space_id, H5P_DEFAULT, TTE);
318 H5Tclose( timetable_type_id );
319 H5Sclose( file_space_id );
320 }
321
322 H5Dclose( dataset_id );
323
324 return size;
325}
H5Tclose(type_id)
#define F5_TIMETABLE_NAME
Definition F5defs.h:150
hid_t F5Bcreate_timetable_type()
Definition F5Bslice.c:167

References F5_TIMETABLE_NAME, F5Bcreate_timetable_type(), and H5Tclose().

Referenced by F5I_add_grid().

◆ F5Bcreate_timetable_type()

F5_API hid_t F5Bcreate_timetable_type ( void )

Create a transient type that is compatible with the TimeTableEntry data structure. It must be release via H5Tclose() by the calling code.

Definition at line 167 of file F5Bslice.c.

168{
169hid_t dtype_id = H5Tcreate( H5T_COMPOUND, sizeof(TimeTableEntry) );
170 {
171 hid_t string_dtype_id = H5Tcreate( H5T_STRING, F5_TIMESLICE_NAME_LENGTH );
172 H5Tinsert( dtype_id, FIBER_HDF5_TIME_ATTRIB, 0, H5T_NATIVE_DOUBLE);
173 H5Tinsert( dtype_id, "F5::SliceGroup", sizeof(double), string_dtype_id );
174 H5Tclose( string_dtype_id );
175 }
176 return dtype_id;
177}
#define F5_TIMESLICE_NAME_LENGTH
Definition F5B.h:67
struct _TimeTableEntry TimeTableEntry

References F5_TIMESLICE_NAME_LENGTH, FIBER_HDF5_TIME_ATTRIB, and H5Tclose().

Referenced by F5Bappend_timetable(), F5Bget_file_timetable_type(), and F5Bread_timetable().

◆ F5Bget_timetable_size()

F5_API hsize_t F5Bget_timetable_size ( hid_t loc_id)

Get the number of entries in the respective time table.

Definition at line 328 of file F5Bslice.c.

329{
330hid_t dataset_id;
331hsize_t current_dim = 0;
332
333 H5E_BEGIN_TRY
334 dataset_id = H5Dopen2( loc_id, F5_TIMETABLE_NAME, H5P_DEFAULT);
335 H5E_END_TRY
336
337 if (dataset_id<=0)
338 return 0;
339
340 {
341 hid_t timetable_type_id = H5Dget_type( dataset_id );
342 int type_is_ok = F5check_timetable_Type(timetable_type_id);
343 H5Tclose( timetable_type_id );
344 if (!type_is_ok)
345 {
346 H5Dclose( dataset_id );
347 F5printf(-1, "WARNING: Invalid Time Table time detected!");
348 return 0;
349 }
350 }
351
352
353 {
354 hid_t current_file_space_id = H5Dget_space(dataset_id );
355 H5Sget_simple_extent_dims( current_file_space_id, &current_dim, NULL);
356 H5Sclose( current_file_space_id );
357 }
358
359
360 H5Dclose( dataset_id );
361
362 return current_dim;
363}

References F5_TIMETABLE_NAME, F5printf, and H5Tclose().

◆ F5BgetGridVertexData()

F5_API hid_t F5BgetGridVertexData ( hid_t SliceID,
const char * gridname,
const char * chartname,
const char * fieldname )

Get the GridVertexData for given grid-, chart- and fieldnames.

Definition at line 5 of file F5Bgrid.c.

9{
10hid_t G_id, T_id, R_id, D_id;
11
12 G_id = H5Gopen2(SliceID, gridname, H5P_DEFAULT);
13
14 T_id = H5Gopen2(G_id, FIBER_HDF5_POINTS , H5P_DEFAULT);
15 H5Gclose(G_id);
16 if (T_id<0) return -1;
17
18 R_id = H5Gopen2(T_id, chartname, H5P_DEFAULT);
19 H5Gclose(T_id);
20 if (R_id<0) return -1;
21
22 D_id = H5Dopen2(R_id, fieldname, H5P_DEFAULT);
23 H5Gclose(R_id);
24
25 return D_id;
26}
#define FIBER_HDF5_POINTS
Definition F5defs.h:55
#define H5Gclose(x)
Definition F5X.h:144

References FIBER_HDF5_POINTS, and H5Gclose.

◆ F5BgetMostRecentFileSlice()

F5_API hid_t F5BgetMostRecentFileSlice ( double t,
const char * filename )

Get the MostRecentSlice out of a HDF5 file with the given name.

Definition at line 70 of file F5Bslice.c.

71{
72hid_t fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
73
74 if (fid<0)
75 return -1;
76
77{hid_t slice_id = F5BgetMostRecentSlice(&t, fid, F5_default_time_attrib_names);
78
79 H5Fclose(fid);
80
81 if (slice_id>0)
82 {
83 printf("F5Bslice: got data slice for T=%lg\n", t);
84 }
85
86 return slice_id;
87}
88}
F5_API const char * F5_default_time_attrib_names[]
Definition F5Bslice.c:10
hid_t F5BgetMostRecentSlice(double *t, hid_t loc_id, const char **time_attribs)
Definition F5Bslice.c:55

References F5_default_time_attrib_names, F5BgetMostRecentSlice(), and slice_info::t.

◆ F5BgetMostRecentSlice()

F5_API hid_t F5BgetMostRecentSlice ( double * t,
hid_t FileID,
const char ** time_attrib_names )

Get the next slice for given time attriute names.

Deprecated

Definition at line 55 of file F5Bslice.c.

56{
57struct slice_info si = { 0, -1, 0 };
59 si.t = t;
60
61 H5Giterate(loc_id, ".", 0, slice_iter, &si);
62
63 if (si.what>0)
64 *t = si.nearest_t;
65
66 return si.what;
67}
hid_t what
Definition F5Bslice.c:16
double * t
Definition F5Bslice.c:17
const char ** time_attribs
Definition F5Bslice.c:15
double nearest_t
Definition F5Bslice.c:17

References slice_info::nearest_t, slice_info::t, slice_info::time_attribs, and slice_info::what.

Referenced by F5BgetMostRecentFileSlice().

◆ F5Binitialize_path()

F5_API F5Path * F5Binitialize_path ( hid_t File_id)

Initialize an F5Path from a file for reading. The coordinate system is set to the default cartesian coordinates. No timeslice, grid, field etc. ID's are defined yet, these need to be filled in by iteration. This function is called internally by F5iterate_timeslices() for creating an F5Path object that is then modified to contain a valid group ID for each timeslice, grid, field, ... Currently, it is hard-coded for reading cartesian coordinates only. The preferred way is to employ iterators on reading files.

Definition at line 156 of file F5B.c.

157{
158/*const char*cs = coordinate_system ? coordinate_system : FIBER_HDF5_DEFAULT_CHART; */
159const char*cs = FIBER_HDF5_DEFAULT_CHART;
160ChartDomain_IDs*ChartDomain = (strcmp(cs, FIBER_HDF5_DEFAULT_CHART)==0) ? F5B_standard_cartesian_chart3D() : 0;
161
162F5Path*f = F5Bopen_coordinate_domain( File_id, ChartDomain);
163 if (!f) /* hack for backward compatibility. */
164 {
167
168 F5printf(10, "*F5Binitialize_path(): Could not initialize with "
170
171 f = F5Bopen_coordinate_domain(File_id, ChartDomain);
173
174 if (!f)
175 {
176 F5printf(10, "*F5Binitialize_path(): Could not initialize with "
177 FIBER_HDF5_DEPRECATED_OLD_CARTESIAN_DOMAIN " either... not good.");
178
180 }
181 }
182 return f;
183}
F5Path * F5Bopen_coordinate_domain(hid_t File_id, ChartDomain_IDs *ChartDomain)
Definition F5B.c:74
#define FIBER_HDF5_CARTESIAN_CHART_DOMAIN
Definition F5defs.h:77
#define FIBER_HDF5_DEFAULT_CHART
Definition F5defs.h:74
#define FIBER_HDF5_DEPRECATED_OLD_CARTESIAN_DOMAIN
Definition F5defs.h:89
ChartDomain_IDs * F5B_standard_cartesian_chart3D()
const char * domain_name
Definition F5Bchart.h:112

References ChartDomain_IDs::domain_name, F5B_standard_cartesian_chart3D(), F5Bopen_coordinate_domain(), F5printf, FIBER_HDF5_CARTESIAN_CHART_DOMAIN, FIBER_HDF5_DEFAULT_CHART, and FIBER_HDF5_DEPRECATED_OLD_CARTESIAN_DOMAIN.

Referenced by F5iterate_timeslices().

◆ F5BnewTimeParameter()

F5_API F5_TimeParameter * F5BnewTimeParameter ( void )

Allocate a new F5_TimeParameter structure in memory. Actually, one could also pass a static structure, but using this function and F5deleteTimePArameter(), the call is safe even if the TimeParameter structure is changed in a future version of F5.

References F5_API.

◆ F5Bread_timetable()

hsize_t F5Bread_timetable ( hid_t loc_id,
TimeTableEntry * TTE,
hsize_t table_size )

Read the entries of a time table.

Definition at line 366 of file F5Bslice.c.

369{
370hid_t dataset_id;
371
372 H5E_BEGIN_TRY
373 dataset_id = H5Dopen2( loc_id, F5_TIMETABLE_NAME, H5P_DEFAULT);
374 H5E_END_TRY
375
376 if (dataset_id<=0)
377 return 0;
378
379
380 {
381 hid_t space_id = H5Dget_space(dataset_id );
382 hsize_t current_dim = 0;
383 H5Sget_simple_extent_dims( space_id, &current_dim, NULL);
384 H5Sclose( space_id );
385
386 if (table_size<current_dim)
387 {
388 H5Dclose( dataset_id );
389 return 0;
390 }
391
392 {
393 hid_t dtype_id = F5Bcreate_timetable_type();
394
395 H5Dread( dataset_id, dtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, TTE);
396 H5Tclose( dtype_id );
397 }
398
399 H5Dclose( dataset_id );
400 return current_dim;
401 }
402}

References F5_TIMETABLE_NAME, F5Bcreate_timetable_type(), and H5Tclose().

◆ F5deleteTimeParameter()

F5_API void F5deleteTimeParameter ( F5_TimeParameter ** )

Deallocate a F5_TimeParameter structure from memory. It needs to be passed a pointer to a pointer, whereby the pointer is set to zero on deallocation. So it is safe to call this function multiple times on the same pointer (just for experimental convenience!).

References F5_API.

◆ F5getTimeUnit()

F5_API int F5getTimeUnit ( hid_t file_id,
F5_TimeParameter *  )

Get the time unit information as specified in the file.

References F5_API.

◆ F5I_timegroup()

F5_API char * F5I_timegroup ( const double * time,
char * destbuf,
size_t len )

Construct the name used for a timeslice, the toplevel hierarchy.

Retrieve the name of the time slice assocciated with the given time. The time is specified as a pointer, such that it may be NULL to indicate a static dataset.

Examples
ObjtoF5.c.

Definition at line 90 of file F5Bslice.c.

91{
92int precision = 10;
93char *result = destbuf;
94 if (!time)
95 {
96 return strncpy(destbuf, FIBER_STATIC_DATA, len);
97 }
98
99#ifdef _MSC_VER
100 _snprintf
101#else
102 snprintf
103#endif
104 (destbuf,len,"t=%0*.*f", 2*precision, precision, *time);
105
106/*
107 (destbuf,len,"t=%0*.*lf", 2*precision, precision, *time);
108*/
109
110
111/* printf("TIME %lg -->\n", time); */
112 return result;
113}
#define FIBER_STATIC_DATA
Definition F5defs.h:42

References FIBER_STATIC_DATA.

Referenced by F5Bappend_slice(), F5I_add_grid(), F5Rcreate_relative_vertex_Irefinement3D(), and F5Rcreate_relative_vertex_Qrefinement3D().

◆ F5setTimeUnit()

F5_API int F5setTimeUnit ( hid_t file_id,
const F5_TimeParameter * TP )

Set the time unit globally for the given file.

Returns
Non-zero indicates that an incompatible time unit has already been set and was not overriden. The caller should take special care to write new data into a different file then.

Definition at line 115 of file F5Bslice.c.

116{
117/* TODO:
118 Create a type which is convertible to "double",
119 Open group FIBER_HDF5_GLOBAL_CHARTS
120 Commit the type to this group
121 Add attributes to this group which describe the type's
122 unit
123 Close it
124
125 And do all that with checking whether such an type
126 already exists before.
127
128 Only the offset, TimeSemantics and comment members from
129 the F5_TimeParameter structure are used.
130 */
131 return 0;
132}