FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
Useful extension of the HDF5 API.

Macros

#define H5Gclose(x)

Functions

F5_API hid_t F5open (const char *filename, int socket)
F5_API int F5connect (const char *url)
F5_API int F5listen (const char *service)
F5_API void F5closesocket (int socket)
F5_API void F5socket_init ()
F5_API void F5socket_cleanup ()
F5_API hid_t F5Gcreate (hid_t loc_id, const char *name, int est_num_entries, int est_name_len)
F5_API hid_t F5append (const char *filename)
F5_API hid_t F5Gappend (hid_t loc_id, const char *name)
F5_API hid_t F5Gappend_hinted_creation (hid_t loc_id, const char *name, int est_num_entries, int est_name_len)
F5_API hid_t F5Gappend_external (hid_t loc_id, const char *name, const char *target_file_name, const char *target_obj_name, const char *prefix)
F5_API hid_t F5Dappend (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist_id)
F5_API hid_t F5Dcreate (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist_id)
F5_API int F5Gopen (hid_t location, const char *name)
F5_API int F5Gexist (hid_t location, const char *name)
F5_API hid_t F5Gtry_to_open (hid_t location, const char *name)
F5_API int F5Dexist (hid_t location, const char *name)
F5_API hid_t F5Dtry_to_open (hid_t location, const char *name)
F5_API herr_t F5Xclose (hid_t obj_id)
F5_API herr_t _F5Gclose (hid_t id, const char *filename, int lineno)

Detailed Description

These extensions are of general use, not only in conjunction with the fiber bundle concept, but they just happen to sit here in this library.

Macro Definition Documentation

◆ H5Gclose

Function Documentation

◆ _F5Gclose()

F5_API herr_t _F5Gclose ( hid_t id,
const char * filename,
int lineno )

Call H5Cclose with a debug message when F5_VERBOSITY is larger then 110

Definition at line 342 of file F5private.c.

343{
344 F5printf(110, " H5Gclose(%lx): %s(%d)", (long)id, filename, lineno );
345 return H5Gclose( id );
346}
#define F5printf(verbosity,...)
Definition F5private.h:60
#define H5Gclose(x)
Definition F5X.h:144

References F5printf, and H5Gclose.

◆ F5append()

F5_API hid_t F5append ( const char * filename)

Open some file for appending data.

Definition at line 225 of file F5X.c.

226{
227hid_t id;
228
229 H5E_BEGIN_TRY
230 id = H5Fcreate (filename, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
231 H5E_END_TRY
232
233 if (id<0)
234 return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
235
236 return id;
237}

Referenced by F5Gappend_external(), and saveF5image().

◆ F5closesocket()

F5_API void F5closesocket ( int socket)

A forwarding call to the platformspecific system call to close a socket.

Definition at line 582 of file F5X.c.

583{
584 if (socket>0)
585 closesocket(socket);
586}
#define closesocket(fd)
Definition F5X.c:40

References closesocket.

◆ F5connect()

F5_API int F5connect ( const char * url)

Open a socket connection to the specified host and port. The URL must be of the form:

HDF5://myhost.com:6666/T=0.000000/

Definition at line 415 of file F5X.c.

416{
417#ifndef NI_MAXHOST
418#define NI_MAXHOST 10000
419#endif
420
421char hostname[NI_MAXHOST];
422char *p, *command;
423
424const char*service = "6666";
425int sockfd = 0;
426struct addrinfo *res;
427struct addrinfo *r;
428int error;
429int commandlen = 0;
430
431 /*
432 URL chopping: get hostname and service name
433 */
434 if ( strncmp( url, "hdf5://", 7 ) != 0
435 &&
436 strncmp( url, "HDF5://", 7 ) != 0 )
437 {
438 return 0;
439 }
440 url += 7;
441
442 strcpy(hostname, url);
443 p = strchr(hostname,':');
444 if (p)
445 {
446 *p = '\0';
447 p++;
448 service = p;
449 }
450
451 command = strchr(p?p:hostname,'/');
452 if (command)
453 {
454 *command++ = '\0';
455 commandlen = strlen(command);
456 }
457
458
459/***************************************/
460 error = getaddrinfo(hostname, service, NULL, &res);
461 switch(error)
462 {
463 case EAI_AGAIN: /* case WSATRY_AGAIN: */
464 printf("CANNOT open HDF5 stream from `%s' %s: "
465 "A temporary failure in name resolution occurred.\n", hostname, service);
466 return -1;
467
468 case EAI_BADFLAGS:/* WSAEINVAL */
469 printf("CANNOT open HDF5 stream from `%s' %s: "
470 "An invalid value was provided for the ai_flags member of the hints parameter.\n",
471 hostname, service);
472 return -1;
473
474 case EAI_FAIL:/* WSANO_RECOVERY */
475 printf("CANNOT open HDF5 stream from `%s' %s:"
476 " A nonrecoverable failure in name resolution occurred.\n",
477 hostname, service);
478 return -1;
479
480/*
481EAI_FAMILY WSAEAFNOSUPPORT The ai_family member of the hints parameter is not supported.
482EAI_MEMORY WSA_NOT_ENOUGH_MEMORY A memory allocation failure occurred.
483*/
484 case EAI_NONAME: /* WSAHOST_NOT_FOUND */
485 printf("CANNOT open HDF5 stream from `%s' %s: "
486 "The name does not resolve for the supplied parameters "
487 "or the nodename and servname parameters were not provided.\n", hostname, service);
488 return -1;
489
490 case EAI_SERVICE: /* WSATYPE_NOT_FOUND */
491 printf("CANNOT open HDF5 stream from `%s' %s: "
492 "The servname parameter is not supported for the specified "
493 "ai_socktype member of the hints parameter.\n", hostname, service);
494 return -1;
495
496/*EAI_SOCKTYPE WSAESOCKTNOSUPPORT The ai_socktype member of the hints parameter is not supported. */
497
498 default:
499 printf("CANNOT open HDF5 stream from `%s' %s: error code %d\n", hostname, service, error);
500 return -1;
501
502 case 0: /* no error */
503 F5printf(10, "HDF5 stream to `%s' %s: addrinfo ok, proceeding\n", hostname, service);
504 break;
505 }
506
507
508 for(r = res; r; r = r->ai_next)
509 {
510 int cerror;
511 sockfd = socket(r->ai_family,
512 r->ai_socktype,
513 r->ai_protocol);
514
515 if (sockfd <= 0 || sockfd==(int)INVALID_SOCKET)
516 {
517 printf("HDF5 stream: FAILED to open connection\n");
518 continue;
519 }
520
521 F5printf(5, "F5connect: Created socket for HDF5 stream from `%s':%s...\n", hostname, service );
522
523 cerror = connect(sockfd, r->ai_addr, r->ai_addrlen);
524 F5printf(5, "F5connect: Connected to `%s':%s...\n", hostname, service );
525 if (cerror)
526 {
527 cerror = WSAGetLastError();
528 switch( cerror )
529 {
530#if defined(_WINDOWS)
531 case WSAECONNREFUSED:
532#else
533 case ECONNREFUSED:
534#endif
535 printf("HDF5 stream to `%s' %s: connection refused.\n", hostname, service);
536 break;
537/*
538// case WSAEADDRNOTAVAIL:
539// printf("HDF5 stream to `%s' %s: The remote address is not a valid address.\n", hostname, service);
540// break;
541
542// case WSAEFAULT:
543// case WSAENETUNREACH:
544// case WSAEHOSTUNREACH:
545// printf("HDF5 stream to `%s' %s: A socket operation was attempted to an unreachable host.\n", hostname, service);
546// break;
547*/
548 default:
549 perror("CANNOT connect to HDF5 stream");
550 printf("HDF5 stream to `%s' %s: error code %d.\n", hostname, service, cerror);
551 continue;
552 }
553 closesocket( sockfd );
554 sockfd = 0;
555 continue;
556 }
557 break;
558 }
559 freeaddrinfo(res);
560
561 if (sockfd<=0)
562 {
563 puts("HDF5 URL: could not open valid connection.");
564 return -1;
565 }
566
567 if (commandlen>0)
568 {
569 int werr;
570 F5printf(1, "Sending HDF5 Request `%s'\n", command );
571
572 werr = send(sockfd, command, commandlen, 0);
573 if (werr<0)
574 perror("Sending HDF5 Request");
575 else if (werr != commandlen)
576 F5printf(1,"Warning: Only sent %d of %d bytes during HDF5 Request transfer\n", werr, commandlen);
577 }
578 return sockfd;
579}
#define INVALID_SOCKET
Definition F5X.c:38
#define WSAGetLastError()
Definition F5X.c:39
#define NI_MAXHOST

References closesocket, F5printf, INVALID_SOCKET, NI_MAXHOST, and WSAGetLastError.

◆ F5Dappend()

F5_API hid_t F5Dappend ( hid_t loc_id,
const char * name,
hid_t type_id,
hid_t space_id,
hid_t create_plist_id )

Open some dataset if it exists, otherwise create one.

Definition at line 239 of file F5X.c.

240{
241hid_t id;
242
243 H5E_BEGIN_TRY
244 id = H5Dopen2(loc_id, name, H5P_DEFAULT );
245 H5E_END_TRY
246
247 if (id>0)
248 {
249 hid_t FileSpace_id = H5Dget_space( id );
250 hssize_t NewPoints = H5Sget_simple_extent_npoints( space_id );
251 hssize_t OldPoints = H5Sget_simple_extent_npoints( FileSpace_id );
252 F5printf(41, "F5Dappend(%lli,%s,...) opening existing dataset...", loc_id, name);
253 H5Sclose( FileSpace_id );
254
255 if (NewPoints != OldPoints)
256 {
257 hid_t lapl_id = H5P_DEFAULT;
258
259 F5printf(0, "PERFORMANCE WARNING: F5Dappend(,%s,,NewSize=%lld,...) modifying dataset to different size, it is %lld currently (%s to %u%%).",
260 name, (long long)NewPoints, (long long)OldPoints,
261 (NewPoints<OldPoints)?"shrink":"grow", (int)(100*NewPoints)/OldPoints );
262 H5Dclose(id);
263 id = -1;
264 H5Ldelete( loc_id, name, lapl_id );
265 }
266 }
267
268 if (id<0)
269 {
270 F5printf(41, "F5Dappend(%lli,%s,...) could not open existing dataset...", loc_id, name);
271 id = H5Dcreate2(loc_id, name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT) ;
272 if (id<0)
273 F5printf(41, "F5Dappend(%lli,%s,...) could not create dataset...", loc_id, name);
274 }
275 return id;
276}
name
Definition F5P.c:82

References F5printf, and name.

Referenced by F5Cwrite_regular_surface(), and F5write_particle_cartesian3DvU().

◆ F5Dcreate()

F5_API hid_t F5Dcreate ( hid_t loc_id,
const char * name,
hid_t type_id,
hid_t space_id,
hid_t create_plist_id )

Create a new dataset, possibly deleting an old one if such exists.

Definition at line 278 of file F5X.c.

279{
280hid_t id;
281 H5E_BEGIN_TRY
282 id = H5Dcreate2(loc_id, name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT) ;
283 H5E_END_TRY
284 if (id<0)
285 {
286 F5printf(10, "F5Dcreate(%d,%s,...) could not create dataset, dataset already exists, deleting it...", (int)(loc_id), name);
287 H5Ldelete( loc_id, name, H5P_DEFAULT );
288 id = H5Dcreate2(loc_id, name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT);
289 }
290
291 if (id<0)
292 F5printf(0, "F5Dcreate(%d,%s,...) could not create dataset, not even after deletion...", (int)(loc_id), name);
293
294 return id;
295}

References F5printf, and name.

Referenced by F5Lcreate().

◆ F5Dexist()

F5_API int F5Dexist ( hid_t location,
const char * name )

Check if a dataset exists.

Definition at line 321 of file F5X.c.

322{
323hid_t retval;
324
325 H5E_BEGIN_TRY
326 retval = H5Dopen2(location, name, H5P_DEFAULT);
327 H5E_END_TRY
328
329 if (retval>=0)
330 H5Dclose(retval);
331
332 return retval>=0;
333}

References name.

Referenced by F5P_has_vertices(), F5P_is_curvilinear(), and F5P_is_rectilinear().

◆ F5Dtry_to_open()

F5_API hid_t F5Dtry_to_open ( hid_t location,
const char * name )

Definition at line 335 of file F5X.c.

336{
337hid_t retval;
338
339 H5E_BEGIN_TRY
340 retval = H5Dopen2(location, name, H5P_DEFAULT);
341 H5E_END_TRY
342
343 return retval;
344}

References name.

Referenced by F5Fget_attribute_byname(), F5Fset_attribute_byname(), and F5P_is_triangular_surface().

◆ F5Gappend()

F5_API hid_t F5Gappend ( hid_t loc_id,
const char * name )

◆ F5Gappend_external()

F5_API 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 at line 136 of file F5X.c.

140{
141herr_t external_err;
142hid_t id;
143 H5E_BEGIN_TRY
144 id = H5Gopen2(loc_id, name, H5P_DEFAULT);
145 H5E_END_TRY
146 if (id>=0)
147 return id;
148
149
150/* link creation property list used in creating the new link. */
151/*
152If crt_intermed_group is non-positive, the H5G_CRT_INTMD_GROUP, if present, will be removed from lcpl_id. Missing intermediate groups will not be created upon calls to functions such as those listed above that use lcpl_id.
153 herr_t H5Pset_create_intermediate_group( hid_t lcpl_id, unsigned crt_intermed_group )
154*/
155hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE);
156 H5Pset_char_encoding( lcpl_id, H5T_CSET_UTF8 );
157
158/*
159 herr_t H5Pset_elink_cb( hid_t lapl_id, H5L_elink_traverse_t func, void *op_data )
160 Purpose:
161 Sets the external link traversal callback function in a link access property list.
162
163 herr_t H5Pset_elink_fapl( hid_t lapl_id, hid_t fapl_id )
164 Purpose:
165Sets a file access property list for use in accessing a file pointed to by an external link.
166*/
167hid_t lapl_id = H5Pcreate( H5P_LINK_ACCESS );
168
169 if (prefix && *prefix)
170 H5Pset_elink_prefix( lapl_id, prefix );
171
172/*
173 The library opens target file target_file_name with the file access property list that is set via H5Pset_elink_fapl when the external link link_name is accessed. If no such property list is set, the library uses the file access property list associated with the file of link_loc_id to open the target file.
174*/
175 external_err = H5Lcreate_external( target_file_name, target_obj_name,
176 loc_id, name, lcpl_id, lapl_id );
177 H5Pclose(lcpl_id);
178 H5Pclose(lapl_id);
179
180 H5E_BEGIN_TRY
181 id = H5Gopen2(loc_id, name, H5P_DEFAULT);
182 H5E_END_TRY
183 if (id<0)
184 {
185 hid_t ExternalFileID, ExternalFileGroup;
186 F5printf(0, "F5Gappend_external(%lli,%s, target_file_name=%s,target_obj_name=%s,prefix=%s) INFO - No external file yet, thus- CREATING external file structure", loc_id, name,
187 target_file_name,
188 target_obj_name,
189 prefix );
190 ExternalFileID = F5append( target_file_name );
191 if (ExternalFileID<0)
192 {
193 F5printf(0, "F5GappendExternal(%lli,%s, target_file_name=%s,target_obj_name=%s,prefix=%s) FAILED CREATING external file", loc_id, name,
194 target_file_name,
195 target_obj_name,
196 prefix );
197 }
198
199 ExternalFileGroup = F5Gappend_tree(ExternalFileID, target_obj_name);
200
201 if (ExternalFileGroup<0)
202 {
203 F5printf(0, "F5GappendExternal(%lli,%s, target_file_name=%s,target_obj_name=%s,prefix=%s) FAILED CREATING external file group", loc_id, name,
204 target_file_name,
205 target_obj_name,
206 prefix );
207 }
208
209 H5Gclose( ExternalFileGroup );
210 H5Fclose( ExternalFileID );
211
212 id = H5Gopen2(loc_id, name, H5P_DEFAULT);
213 if (id<0)
214 {
215 F5printf(0, "F5GappendExternal(%lli,%s, target_file_name=%s,target_obj_name=%s,prefix=%s) FAILED CREATING external file structure", loc_id, name,
216 target_file_name,
217 target_obj_name,
218 prefix );
219 }
220 }
221
222 return id;
223}
hid_t F5Gappend_tree(hid_t loc_id, const char *name)
Definition F5X.c:113
hid_t F5append(const char *filename)
Definition F5X.c:225

References F5append(), F5Gappend_tree(), F5printf, H5Gclose, and name.

Referenced by F5Lwrite_fraction_external().

◆ F5Gappend_hinted_creation()

F5_API hid_t F5Gappend_hinted_creation ( hid_t loc_id,
const char * name,
int est_num_entries,
int est_name_len )

Open or create a group, if created then with estimated hints about its number of entries and estimated length of its member names.

Definition at line 87 of file F5X.c.

89{
90hid_t id;
91
92 F5printf(30, "F5Gappend(%lli,%s)", loc_id, name);
93
94 H5E_BEGIN_TRY
95 id = H5Gopen2(loc_id, name, H5P_DEFAULT );
96 H5E_END_TRY
97
98 if (id<0)
99 {
100 id = F5Gcreate(loc_id, name, est_num_entries, est_name_len );
101 if (id<0)
102 {
103 F5printf(0, "F5Gcreate(`%s') failed on ID %d!\n", name, (int)loc_id);
104 }
105 }
106
107 if (id<0)
108 F5printf(0, "F5Gappend(%lli,%s) FAILED", loc_id, name);
109
110 return id;
111}
hid_t F5Gcreate(hid_t loc_id, const char *name, int est_num_entries, int est_name_len)
Definition F5X.c:65

References F5Gcreate(), F5printf, and name.

Referenced by F5Gappend().

◆ F5Gcreate()

F5_API hid_t F5Gcreate ( hid_t loc_id,
const char * name,
int est_num_entries,
int est_name_len )

Create a group using utf8 encoding for the link name and making use of the estimated group entry and name length properties for optimization. If these values are negative, no such hints will be set.

Definition at line 65 of file F5X.c.

67{
68hid_t id;
69hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE);
70 H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8);
71
72hid_t gcpl_id = H5Pcreate( H5P_GROUP_CREATE );
73
74 if (est_num_entries>=0 && est_name_len >=0)
75 {
76 H5Pset_est_link_info( gcpl_id, (unsigned) est_num_entries, (unsigned) est_name_len );
77 }
78 H5Pset_link_creation_order( gcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED );
79
80 id = H5Gcreate2(loc_id, name, lcpl_id, gcpl_id, H5P_DEFAULT);
81
82 H5Pclose( gcpl_id );
83 H5Pclose( lcpl_id );
84 return id;
85}

References name.

Referenced by F5Gappend_hinted_creation(), F5Lwrite_linear(), F5Lwrites(), and F5LwriteX().

◆ F5Gexist()

F5_API int F5Gexist ( hid_t location,
const char * name )

Check if a group exists.

Definition at line 307 of file F5X.c.

308{
309hid_t retval;
310
311 H5E_BEGIN_TRY
312 retval = H5Gopen2(location, name, H5P_DEFAULT);
313 H5E_END_TRY
314
315 if (retval>=0)
316 H5Gclose(retval);
317
318 return retval>=0;
319}

References H5Gclose, and name.

Referenced by F5Bopen_coordinate_domain(), F5LTcreateV(), F5P_has_vertices(), F5P_is_curvilinear(), F5P_is_particle_system(), and F5P_is_triangular_surface().

◆ F5Gopen()

F5_API int F5Gopen ( hid_t location,
const char * name )

Open a group

References F5_API, and name.

◆ F5Gtry_to_open()

F5_API hid_t F5Gtry_to_open ( hid_t location,
const char * name )

Try to open an HDF5 group, silently return -1 if it does not exist.

Definition at line 297 of file F5X.c.

298{
299hid_t retval;
300 H5E_BEGIN_TRY
301 retval = H5Gopen2(location, name, H5P_DEFAULT);
302 H5E_END_TRY
303
304 return retval;
305}

References name.

Referenced by F5B_read_chart_domain(), F5Bopen_coordinate_domain(), F5Fget_attribute_byname(), F5iterate_grids_per_bundle(), F5iterate_representations(), F5iterate_topology_fields(), F5LTcreateV(), and F5P_is_triangular_surface().

◆ F5listen()

F5_API int F5listen ( const char * service)

Definition at line 621 of file F5X.c.

622{
623struct addrinfo hints, *res, *ressave;
624int n, sockfd = -1;
625
626 memset(&hints, 0, sizeof(struct addrinfo));
627
628 /*
629 AI_PASSIVE flag: the resulting address is used to bind
630 to a socket for accepting incoming connections.
631 So, when the hostname==NULL, getaddrinfo function will
632 return one entry per allowed protocol family containing
633 the unspecified address for that family.
634 */
635 hints.ai_flags = AI_PASSIVE;
636 hints.ai_family = AF_INET;
637 hints.ai_socktype = SOCK_STREAM;
638 hints.ai_protocol = IPPROTO_TCP;
639
640 n = getaddrinfo( NULL, service, &hints, &res);
641
642 if (n<0)
643 {
644 return n;
645 }
646
647 ressave = res;
648
649 /*
650 Try open socket with each address getaddrinfo returned,
651 until getting a valid listening socket.
652 */
653 while (res)
654 {
655 sockfd = socket(res->ai_family,
656 res->ai_socktype,
657 res->ai_protocol);
658
659 if (!(sockfd < 0))
660 {
661 if (bind(sockfd, res->ai_addr, res->ai_addrlen) == 0)
662 break;
663
664 closesocket(sockfd);
665 sockfd=-1;
666 }
667 res = res->ai_next;
668 }
669
670 if (sockfd < 0)
671 {
672 freeaddrinfo(ressave);
673 F5printf(1, "F5listen(): could not open socket\n");
674 return -1;
675 }
676
677
678 {
679 struct linger wait_on_close;
680 wait_on_close.l_onoff = 1; /* yes, wait on close */
681 wait_on_close.l_linger = 1; /* and wait for 1 second */
682 setsockopt (sockfd, SOL_SOCKET, SO_LINGER,
683 (const char*)&wait_on_close, sizeof (wait_on_close));
684/*
685// Erik says: the variables "on" and "port" are undeclared
686//#ifdef SO_REUSEPORT
687// if (setsockopt (sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(int)) < 0)
688// {
689// printf("Couldn't set SO_REUSEPORT to port %u: %s",
690// port, strerror (errno));
691// closesocket (sockfd);
692// return -1;
693// }
694//#endif
695*/
696 }
697
698 listen(sockfd, SOMAXCONN);
699
700 freeaddrinfo(ressave);
701
702 return sockfd;
703}

References closesocket, and F5printf.

◆ F5open()

F5_API hid_t F5open ( const char * filename,
int socket )

Open some URL for reading data (read-only). Note that this function may well invoke the streaming HDF5 driver when a valid socket descriptor is given. Such might well be created by a call to F5connect(). Note that the socket needs to be closed explicitely.

Definition at line 589 of file F5X.c.

590{
591#ifdef H5_HAVE_STREAM
592hid_t proplist = H5Pcreate (H5P_FILE_ACCESS);
593hid_t file_id;
594
595H5FD_stream_fapl_t fapl;
596 fapl.increment = 1024*1024;
597 fapl.do_socket_io = 1;
598 fapl.socket = socket;
599 fapl.backlog = 0;
600 fapl.broadcast_fn = 0;
601 if (socket>0)
602 {
603 if (H5Pset_fapl_stream ( proplist, &fapl)<0)
604 {
605 puts("HDF5: Problem in H5Pset_fapl_stream ()!");
606 }
607 file_id = H5Fopen("/dev/null", H5F_ACC_RDONLY, proplist);
608 H5Pclose (proplist);
609 if (file_id<0)
610 {
611 puts("Problem Receiving HDF5 Stream Data...");
612 return -1;
613 }
614 return file_id;
615 }
616#endif
617 return H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
618}

◆ F5socket_cleanup()

F5_API void F5socket_cleanup ( )

Calling windows socket cleanup on windows

Definition at line 408 of file F5X.c.

409{
410#if defined(_WINDOWS)
411 WSACleanup( );
412#endif
413}

◆ F5socket_init()

F5_API void F5socket_init ( )

Calling windows socket init on windows

Definition at line 390 of file F5X.c.

391{
392#if defined(_WINDOWS)
393WSADATA wsaData;
394WORD wVersionRequested = MAKEWORD( 2, 2 );
395int err = WSAStartup( wVersionRequested, &wsaData );
396 switch(err)
397 {
398 case 0:
399 break;
400
401 default:
402 puts("windows sockets error");
403 break;
404 }
405#endif
406}

◆ F5Xclose()

F5_API herr_t F5Xclose ( hid_t obj_id)

Close an object regardless of its type.

Use this function to close any HDF5-Object,
if you do not know the type of the object.
This is especially usefull after a call to H5Rdereference().

@remark Normally you shouldn't use this function,
    because you should know the objects you are creating.
Remarks
The function doesn't work for properties, supported are only the following types:
  • H5I_FILE
  • H5I_GROUP
  • H5I_DATATYPE
  • H5I_DATASPACE
  • H5I_DATASET
  • H5I_ATTR
Parameters
ret_type_idA pointer to a storage to take the type of the given object. See H5Iget_type() for a list of types.
obj_idThe ID of the object to be closed.
Returns
Error Code of the closing function. (A non-negative value if successful; otherwise a negative value.)
Todo
Better Error Value than "-1".
Note
Could/should rename this to F5Dclose(), to denote it as a function to close F5 dataset ID's, which can be HDF5 groups or datasets.

Definition at line 347 of file F5X.c.

348{
349 /* Get the type */
350 H5I_type_t ObjectType = H5Iget_type(obj_id);
351
352 /* Return it to the caller, if wanted
353 if (pret_type_id)
354 (*pret_type_id) = ObjectType; */
355
356 /* Call the appropriate closing func */
357 switch (ObjectType)
358 {
359 case H5I_FILE:
360 return H5Fclose(obj_id);
361
362 case H5I_GROUP:
363 return H5Gclose(obj_id);
364
365 case H5I_DATATYPE:
366 return H5Tclose(obj_id);
367
368 case H5I_DATASPACE:
369 return H5Sclose(obj_id);
370
371 case H5I_DATASET:
372 return H5Dclose(obj_id);
373
374 case H5I_ATTR:
375 return H5Aclose(obj_id);
376
377 case H5I_BADID:
378 return -1;
379
380 default:
381 printf ("INTERNAL ERROR F5Xclose(): unknown type %d\n", ObjectType);
382 return -1;
383 }
384}
H5Tclose(type_id)

References H5Gclose, and H5Tclose().

Referenced by F5Fget_attribute_byname(), F5Fset_attribute_byname(), F5Fwrite_linear_fraction(), F5Fwrite_linear_fraction_overlap(), F5LSwrite_fraction(), F5Lwrite_fraction(), F5Lwrite_fraction_external(), and F5Lwrite_fractionS().