FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
F5types.c File Reference
#include "F5types.h"
#include "F5defs.h"
#include "F5private.h"
#include "F5X.h"
#include "F5A.h"
#include <stdlib.h>
#include <assert.h>
#include <string.h>

Go to the source code of this file.

Macros

#define new(type, size)
#define delete(ptr)
#define InsertEnum(type_id, enum_member)
#define IFITEM(x, type)

Functions

hid_t F5T_rgb_g ()
hid_t F5T_rgba_g ()
hid_t F5T_bgr_g ()
hid_t F5T_rgb16_g ()
hid_t F5T_rgba16_g ()
hid_t F5T_rgb_real_g ()
hid_t F5T_rgba_real_g ()
hid_t F5T_vec3_double_g ()
hid_t F5T_covec3_double_g ()
hid_t F5T_cartesianpoint3_double_g ()
hid_t F5Ttransient_F5field_Array_enum ()
hid_t F5Tsave_F5field_enum (hid_t loc_id)
const char * F5Tget_field_description (ArrayType what)
herr_t F5Tset_field_enum (hid_t loc_id, hid_t enum_type_id, ArrayType what)
ArrayType F5Tget_field_Array_enum (hid_t loc_id, int *major_version, int *minor_version, int *release_version)
hid_t F5Ttransient_ProcArray_enum ()
hid_t F5Tsave_ProcArray_enum (hid_t loc_id)
herr_t F5Tset_field_ProcArray_enum (hid_t loc_id, ProceduralArrayType what, hid_t ProcTypeIdLocation)
ProceduralArrayType F5Tget_field_ProcArray_enum (hid_t loc_id, hid_t enum_type, int *major_version, int *minor_version, int *release_version)
F5Ttensor_tnewF5Ttensor (const char *name, int rank, int dimension, int components)
void F5Tcreate_symmetric_rank2_covariant_tensor (F5Ttensor_t *This)
F5_API F5Ttensor_tF5Ttensor_commit (hid_t loc_id, F5Ttensor_t *)
F5_API int deleteF5Ttensor (F5Ttensor_t *This)
int F5Tis_convertible (hid_t src_id, hid_t dst_id)
F5_API void F5Tprint (hid_t type)

Macro Definition Documentation

◆ delete

#define delete ( ptr)
Value:
if (ptr) free(ptr)
free(name)

Definition at line 21 of file F5types.c.

◆ IFITEM

#define IFITEM ( x,
type )
Value:
if (H5Tequal(x,type))\
{printf("%s\n",#x);\
return;}

Definition at line 690 of file F5types.c.

690#define IFITEM(x,type)\
691 if (H5Tequal(x,type))\
692 {printf("%s\n",#x);\
693 return;}

Referenced by F5Tprint().

◆ InsertEnum

#define InsertEnum ( type_id,
enum_member )
Value:
enum_value=enum_member; \
H5Tenum_insert(type_id, #enum_member, &enum_value);

Referenced by F5Ttransient_F5field_Array_enum(), and F5Ttransient_ProcArray_enum().

◆ new

#define new ( type,
size )
Value:
(type*)calloc(size, sizeof(type))

Definition at line 20 of file F5types.c.

Function Documentation

◆ deleteF5Ttensor()

F5_API int deleteF5Ttensor ( F5Ttensor_t * This)

Remove a tensor description.

Definition at line 622 of file F5types.c.

623{
624 delete(This->name);
625 if (This->type_id>0)
626 H5Tclose(This->type_id);
627
628 delete(This->indexing);
629 delete(This->parity);
630 delete(This->covariance);
631 delete(This->reverse_indexing);
632 delete(This->metric);
633 delete(This->transformation_rule);
634 return 1;
635}
H5Tclose(type_id)
int * parity
Definition F5types.h:103
int * indexing
Definition F5types.h:101
char * transformation_rule
Definition F5types.h:111
int * covariance
Definition F5types.h:105
char * name
Definition F5types.h:86
hid_t type_id
Definition F5types.h:88
char * metric
Definition F5types.h:109
int * reverse_indexing
Definition F5types.h:107

References F5Ttensor_t::covariance, F5_API, H5Tclose(), F5Ttensor_t::indexing, F5Ttensor_t::metric, F5Ttensor_t::name, F5Ttensor_t::parity, F5Ttensor_t::reverse_indexing, F5Ttensor_t::transformation_rule, and F5Ttensor_t::type_id.

◆ F5T_bgr_g()

hid_t F5T_bgr_g ( )

Definition at line 50 of file F5types.c.

51{
52static hid_t id = -1;
53 if (id<0)
54 {
55 id = H5Tcreate(H5T_COMPOUND, 3);
56 H5Tinsert(id, "b", 0, H5T_NATIVE_UCHAR);
57 H5Tinsert(id, "g", 1, H5T_NATIVE_UCHAR);
58 H5Tinsert(id, "r", 2, H5T_NATIVE_UCHAR);
59 }
60 return id;
61}

◆ F5T_cartesianpoint3_double_g()

hid_t F5T_cartesianpoint3_double_g ( )

Definition at line 176 of file F5types.c.

177{
178static hid_t id = -1;
179 if (id<0)
180 {
181 id = H5Tcreate(H5T_COMPOUND, 24);
182 H5Tinsert(id, "x", 0, H5T_NATIVE_DOUBLE);
183 H5Tinsert(id, "y", sizeof(double), H5T_NATIVE_DOUBLE);
184 H5Tinsert(id, "z",2*sizeof(double), H5T_NATIVE_DOUBLE);
185 }
186 return id;
187}

◆ F5T_covec3_double_g()

hid_t F5T_covec3_double_g ( )

Definition at line 163 of file F5types.c.

164{
165static hid_t id = -1;
166 if (id<0)
167 {
168 id = H5Tcreate(H5T_COMPOUND, 24);
169 H5Tinsert(id, "dx", 0, H5T_NATIVE_DOUBLE);
170 H5Tinsert(id, "dy", sizeof(double), H5T_NATIVE_DOUBLE);
171 H5Tinsert(id, "dz",2*sizeof(double), H5T_NATIVE_DOUBLE);
172 }
173 return id;
174}

◆ F5T_rgb16_g()

hid_t F5T_rgb16_g ( )

Definition at line 64 of file F5types.c.

65{
66static hid_t id = -1;
67 if (id<0)
68 {
69 id = H5Tcreate(H5T_COMPOUND, 6);
70 H5Tinsert(id, "r", 0, H5T_NATIVE_USHORT);
71 H5Tinsert(id, "g", 2, H5T_NATIVE_USHORT);
72 H5Tinsert(id, "b", 4, H5T_NATIVE_USHORT);
73 }
74 return id;
75}

◆ F5T_rgb_g()

hid_t F5T_rgb_g ( )

Definition at line 23 of file F5types.c.

24{
25static hid_t id = -1;
26 if (id<0)
27 {
28 id = H5Tcreate(H5T_COMPOUND, 3);
29 H5Tinsert(id, "r", 0, H5T_NATIVE_UCHAR);
30 H5Tinsert(id, "g", 1, H5T_NATIVE_UCHAR);
31 H5Tinsert(id, "b", 2, H5T_NATIVE_UCHAR);
32 }
33 return id;
34}

◆ F5T_rgb_real_g()

hid_t F5T_rgb_real_g ( )

Definition at line 92 of file F5types.c.

93{
94static hid_t id = -1;
95 if (id<0)
96 {
97 id = H5Tcreate(H5T_COMPOUND, 12);
98 H5Tinsert(id, "r", 0, H5T_NATIVE_FLOAT);
99 H5Tinsert(id, "g", 4, H5T_NATIVE_FLOAT);
100 H5Tinsert(id, "b", 8, H5T_NATIVE_FLOAT);
101 }
102 return id;
103}

◆ F5T_rgba16_g()

hid_t F5T_rgba16_g ( )

Definition at line 78 of file F5types.c.

79{
80static hid_t id = -1;
81 if (id<0)
82 {
83 id = H5Tcreate(H5T_COMPOUND, 4*2);
84 H5Tinsert(id, "r", 0, H5T_NATIVE_USHORT);
85 H5Tinsert(id, "g", 2, H5T_NATIVE_USHORT);
86 H5Tinsert(id, "b", 4, H5T_NATIVE_USHORT);
87 H5Tinsert(id, "a", 6, H5T_NATIVE_USHORT);
88 }
89 return id;
90}

◆ F5T_rgba_g()

hid_t F5T_rgba_g ( )

Definition at line 36 of file F5types.c.

37{
38static hid_t id = -1;
39 if (id<0)
40 {
41 id = H5Tcreate(H5T_COMPOUND, 4);
42 H5Tinsert(id, "r", 0, H5T_NATIVE_UCHAR);
43 H5Tinsert(id, "g", 1, H5T_NATIVE_UCHAR);
44 H5Tinsert(id, "b", 2, H5T_NATIVE_UCHAR);
45 H5Tinsert(id, "a", 3, H5T_NATIVE_UCHAR);
46 }
47 return id;
48}

◆ F5T_rgba_real_g()

hid_t F5T_rgba_real_g ( )

Definition at line 105 of file F5types.c.

106{
107static hid_t id = -1;
108 if (id<0)
109 {
110 id = H5Tcreate(H5T_COMPOUND, 4*sizeof(float) );
111 H5Tinsert(id, "r", 0, H5T_NATIVE_FLOAT);
112 H5Tinsert(id, "g", 4, H5T_NATIVE_FLOAT);
113 H5Tinsert(id, "b", 8, H5T_NATIVE_FLOAT);
114 H5Tinsert(id, "a",12, H5T_NATIVE_FLOAT);
115 }
116 return id;
117}

◆ F5T_vec3_double_g()

hid_t F5T_vec3_double_g ( )

Definition at line 150 of file F5types.c.

151{
152static hid_t id = -1;
153 if (id<0)
154 {
155 id = H5Tcreate(H5T_COMPOUND, 24);
156 H5Tinsert(id, "Dx", 0, H5T_NATIVE_DOUBLE);
157 H5Tinsert(id, "Dy", sizeof(double), H5T_NATIVE_DOUBLE);
158 H5Tinsert(id, "Dz",2*sizeof(double), H5T_NATIVE_DOUBLE);
159 }
160 return id;
161}

◆ F5Tcreate_symmetric_rank2_covariant_tensor()

void F5Tcreate_symmetric_rank2_covariant_tensor ( F5Ttensor_t * This)

Definition at line 578 of file F5types.c.

579{
580int i, j, ni, nj, I;
581
582 assert(This->rank==2);
583
584 I = 0; /* the linear index */
585
586 /* Create symmetric 2x2 tensor */
587 for(ni=0, i=0; i<This->dimension; i++ )
588 {
589 for(nj=0, j=0; j<i; j++ )
590 {
591 This->indexing[ni+j] = This->indexing[nj+i] = I++;
592 nj += This->dimension;
593 }
594 This->indexing[ni+i] = I++;
595 ni += This->dimension;
596 }
597
598 for(i=0; i<This->dimension*This->dimension; i++)
599 {
600 This->parity[i] = +1;
601 }
602
603 /* Create covariant indices: g_mn */
604 This->covariance[0] = -1;
605 This->covariance[1] = -1;
606
607 /* TODO:
608 This->reverse_indexing
609 */
610}
int dimension
Definition F5types.h:92

References F5Ttensor_t::covariance, F5Ttensor_t::dimension, F5Ttensor_t::indexing, F5Ttensor_t::parity, and F5Ttensor_t::rank.

◆ F5Tget_field_Array_enum()

ArrayType F5Tget_field_Array_enum ( hid_t loc_id,
int * major_version,
int * minor_version,
int * release_version )

Get the field type for a field, which is supposed to be an HDF5 group or dataset.

We try to open an attribute named FIBER_ARRAY_TYPE_ENUM, its type is supposed to be a named data type bound to the file. The attributes of this type will be the version number information for the given loc_id . The value of this attribute will be an enum compatible with the ArrayType enum from which the information is retrieved. There are some fallback mechanisms in case there are troubles, such as no such attribute existing.

Definition at line 305 of file F5types.c.

307{
308hid_t attr_id;
310hid_t type_id;
311herr_t err = -1;
312
313 if (major_version) *major_version = 0;
314 if (minor_version) *minor_version = 0;
315 if (release_version) *release_version = 0;
316
317 attr_id = F5Atry_to_open(loc_id, FIBER_ARRAY_TYPE_ENUM);
318 if (attr_id<0)
319 {
320 F5printf(10, "F5Tget_field_Array_enum(): No type enum attribute.");
322#ifdef F5_BACKWARD_COMPATIBILITY
323 if (attr_id>0)
324 {
325 H5Aclose(attr_id);
326 return UniformSampling;
327 }
328 /* This is guessing for the best match... */
329 {
330 H5I_type_t ObjectType = H5Iget_type(loc_id);
331 switch (ObjectType)
332 {
333 case H5I_DATASET:
334 /* Need to check for dataset's dataspace here.
335 Could be constant as well.
336 */
337 return Contiguous;
338
339 default: ;
340 }
341 }
342#endif
343 return UnknownArrayType;
344 }
345 type_id = H5Aget_type(attr_id);
346
347 if (H5Tcommitted(type_id)<=0)
348 {
349 F5printf(-1, "F5Tget_field_enum(): Attribute " FIBER_ARRAY_TYPE_ENUM " is NOT a named type, cannot retrieve versioning information.");
350 }
351 else
352 {
353 F5Aget_version(type_id, major_version, minor_version, release_version);
354 }
355
356 /*
357 NOTE: We must use the transient memory type here, such that
358 we get byteorder conversion of the enum int type.
359 We MUST NOT use the file type for reading!
360 */
361 H5E_BEGIN_TRY
363 H5E_END_TRY
364
365 /*
366 enum types don't match, so that could be an old F5 file,
367 and we'll do some wild guess here now what it could be.
368 */
369 if (err<0)
370 {
371 F5printf(-1, "F5Tget_field_enum(): Attribute " FIBER_ARRAY_TYPE_ENUM " enum types do no match, thus assume uniform field if subgroup.");
372
373 H5I_type_t ObjectType = H5Iget_type(loc_id);
374 switch (ObjectType)
375 {
376 case H5I_DATASET:
377 what = Contiguous;
378 break;
379
380 case H5I_GROUP:
381 /*
382 This check could be more advanced and look for the origin/delta attributes
383 in the subgroup. If those are no there, we may assume the field to be
384 fragmented instead - possibly contiguously fragmented or also uniform fragmented
385 if the subgroup has origin/delta attributes.
386 */
387 what = UniformSampling;
388 break;
389
390 default:
391 what = UnknownArrayType;
392 }
393 }
394
395 H5Aclose(attr_id);
396 H5Tclose(type_id);
397
398 return what;
399}
hid_t F5Atry_to_open(hid_t location, const char *name)
Definition F5A.c:23
herr_t F5Aget_version(hid_t loc_id, int *major, int *minor, int *release)
Definition F5A.c:304
ArrayType
Definition F5defs.h:267
@ Contiguous
Definition F5defs.h:269
@ UniformSampling
Definition F5defs.h:276
@ UnknownArrayType
Definition F5defs.h:268
#define FIBER_UNIFORMARRAY_BASE_ATTRIBUTE
Definition F5defs.h:158
#define FIBER_ARRAY_TYPE_ENUM
Definition F5defs.h:293
herr_t F_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *name)
Definition F5private.c:332
#define F5printf(verbosity,...)
Definition F5private.h:60
hid_t F5Ttransient_F5field_Array_enum()
Definition F5types.c:189

References Contiguous, F5Aget_version(), F5Atry_to_open(), F5printf, F5Ttransient_F5field_Array_enum(), F_H5Aread(), FIBER_ARRAY_TYPE_ENUM, FIBER_UNIFORMARRAY_BASE_ATTRIBUTE, H5Tclose(), UniformSampling, and UnknownArrayType.

Referenced by F5Fget_field_enum().

◆ F5Tget_field_description()

const char * F5Tget_field_description ( ArrayType what)

Return a human-readable description of the array type, for convenience on console or log file outputs.

Definition at line 249 of file F5types.c.

250{
251 switch(what)
252 {
253 case UnknownArrayType : return "UnknownArrayType";
254 case Contiguous : return "Contiguous";
255 case SeparatedCompound : return "SeparatedCompound";
256 case Constant : return "Constant";
257 case FragmentedContiguous : return "FragmentedContiguous";
258 case FragmentedSeparatedCompound: return "FragmentedSeparatedCompound";
259 case DirectProduct : return "DirectProduct";
260 case IndexPermutation : return "IndexPermutation";
261 case UniformSampling : return "UniformSampling";
262 case FragmentedUniformSampling : return "FragmentedUniformSampling";
263 }
264 return "";
265}
@ FragmentedContiguous
Definition F5defs.h:272
@ SeparatedCompound
Definition F5defs.h:270
@ FragmentedUniformSampling
Definition F5defs.h:277
@ IndexPermutation
Definition F5defs.h:275
@ Constant
Definition F5defs.h:271
@ DirectProduct
Definition F5defs.h:274
@ FragmentedSeparatedCompound
Definition F5defs.h:273

References Constant, Contiguous, DirectProduct, FragmentedContiguous, FragmentedSeparatedCompound, FragmentedUniformSampling, IndexPermutation, SeparatedCompound, UniformSampling, and UnknownArrayType.

◆ F5Tget_field_ProcArray_enum()

ProceduralArrayType F5Tget_field_ProcArray_enum ( hid_t loc_id,
hid_t enum_type,
int * major_version,
int * minor_version,
int * release_version )

Definition at line 490 of file F5types.c.

493{
494hid_t attr_id;
496hid_t type_id;
497 attr_id = F5Aopen_name(loc_id, FIBER_ARRAY_TYPE_ENUM);
498 type_id = H5Aget_type(attr_id);
499
500 if (H5Tcommitted(type_id)<=0)
501 {
502 F5printf(-1, "F5Tget_field_enum(): Not a named type, cannot retrieve versioning information.");
503 }
504 /*
505 NOTE: We must use the transient memory type here, such that
506 we get byteorder conversion of the enum int type.
507 We MUST NOT use the file type for reading!
508 */
510 F5Aget_version(type_id, major_version, minor_version, release_version);
511 H5Aclose(attr_id);
512 H5Tclose(type_id);
513
514 return what;
515}
ProceduralArrayType
Definition F5defs.h:283
hid_t F5Ttransient_ProcArray_enum()
Definition F5types.c:402
hid_t F5Aopen_name(hid_t location, const char *name)
Definition F5A.c:34

References F5Aget_version(), F5Aopen_name(), F5printf, F5Ttransient_ProcArray_enum(), F_H5Aread(), FIBER_ARRAY_TYPE_ENUM, and H5Tclose().

◆ F5Tis_convertible()

int F5Tis_convertible ( hid_t first_type,
hid_t second_type )

Check if the two types are equivalent. This requires that each type of a compound type has the the same name and the same class. Also, all attributes must be equal.

Definition at line 637 of file F5types.c.

638{
639/*herr_t (*old_func)(void*);*/
640/*void *old_client_data; */
641H5T_cdata_t *pcdata;
642H5T_conv_t c;
643int i;
644hid_t class_src_id,
645 class_dst_id;
646
647 F5printf(200, "F5Tis_convertible(%d,%d)", src_id, dst_id);
648
649 class_src_id = H5Tget_class(src_id);
650 class_dst_id = H5Tget_class(dst_id);
651
652//printf("F5Tis_convertible(%d,%d)\n", src_id, dst_id);
653//if (class_src_id == H5T_COMPOUND) puts("src is compound");
654//if (class_dst_id == H5T_COMPOUND) puts("dst is compound");
655
656 if (class_src_id == H5T_COMPOUND && class_dst_id == H5T_COMPOUND)
657 {
658 int src_n = H5Tget_nmembers(src_id),
659 dst_n = H5Tget_nmembers(dst_id);
660
661// printf("src[%d], dst[%d]\n", src_n, dst_n);
662
663 if (src_n != dst_n)
664 return 0;
665
666 for(i=0; i<src_n; i++)
667 {
668 char * src_name = H5Tget_member_name(src_id, i ),
669 * dst_name = H5Tget_member_name(dst_id, i );
670
671 int ok = strcmp(src_name, dst_name)==0;
672
673// printf("-> {%s} {%s}\n", src_name, dst_name);
674
675 H5free_memory(src_name);
676 H5free_memory(dst_name);
677
678 if (!ok)
679 return 0;
680 }
681 }
682
683 H5E_BEGIN_TRY
684 c = H5Tfind(src_id, dst_id, &pcdata );
685 H5E_END_TRY
686
687 return c!=NULL;
688}
return ok
Definition F5P.c:95

References F5printf, and ok.

◆ F5Tprint()

F5_API void F5Tprint ( hid_t type)

Prints type info

Definition at line 695 of file F5types.c.

696{
697 printf("F5Tprint started\n");
698
699 IFITEM(H5T_NATIVE_CHAR,type)
700 IFITEM(H5T_NATIVE_SHORT,type)
701 IFITEM(H5T_NATIVE_INT ,type)
702 IFITEM(H5T_NATIVE_LONG ,type)
703 IFITEM(H5T_NATIVE_LLONG ,type)
704 IFITEM(H5T_NATIVE_USHORT ,type)
705 IFITEM(H5T_NATIVE_UINT ,type)
706 IFITEM(H5T_NATIVE_ULONG ,type)
707 IFITEM(H5T_NATIVE_ULLONG ,type)
708 IFITEM(H5T_NATIVE_FLOAT ,type)
709 IFITEM(H5T_NATIVE_DOUBLE ,type)
710 IFITEM(H5T_NATIVE_LDOUBLE ,type)
711 IFITEM(H5T_NATIVE_INT8 ,type)
712 IFITEM(H5T_NATIVE_INT16 ,type)
713 IFITEM(H5T_NATIVE_INT32 ,type)
714 IFITEM(H5T_NATIVE_INT64 ,type)
715 IFITEM(H5T_NATIVE_UCHAR ,type)
716// IFITEM(F5T_COORD3_FLOAT, type)
717// IFITEM(F5T_COORD3_DOUBLE, type)
718
719 printf("F5Tprint(): UNKNOWN TYPE\n");
720}
#define IFITEM(x, type)
Definition F5types.c:690

References F5_API, and IFITEM.

◆ F5Tsave_F5field_enum()

hid_t F5Tsave_F5field_enum ( hid_t loc_id)

Create a named field type for F5 array descriptions by saving the transient enum type to a file.

Definition at line 222 of file F5types.c.

223{
224hid_t type_id;
225
226 /* Try to open existing field ID first. */
227
228 H5E_BEGIN_TRY
229 type_id = H5Topen2(loc_id, FIBER_ARRAY_TYPE_ENUM, H5P_DEFAULT);
230 H5E_END_TRY
231
232 if (type_id<0)
233 {
234 type_id = H5Tcopy( F5Ttransient_F5field_Array_enum() );
235
236 H5Tcommit2(loc_id, FIBER_ARRAY_TYPE_ENUM, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
237
240 }
241 else
242 {
243 F5printf(30, "F5Tsave_F5field_enum() Warning: No version check implemented yet!");
244 }
245
246 return type_id;
247}
int F5Asave_string(hid_t loc_id, const char *name, const char *buf)
Definition F5A.c:45
herr_t F5Asave_version(hid_t loc_id, int major, int minor, int release)
Definition F5A.c:286
#define FIBER_RELEASE_VERSION
Definition F5defs.h:16
#define FIBER_VERSION_URL
Definition F5defs.h:21
#define FIBER_MAJOR_VERSION
Definition F5defs.h:14
#define FIBER_MINOR_VERSION
Definition F5defs.h:15
#define FIBER_VERSION_URL_LOCATION
Definition F5defs.h:20

References F5Asave_string(), F5Asave_version(), F5printf, F5Ttransient_F5field_Array_enum(), FIBER_ARRAY_TYPE_ENUM, FIBER_MAJOR_VERSION, FIBER_MINOR_VERSION, FIBER_RELEASE_VERSION, FIBER_VERSION_URL, and FIBER_VERSION_URL_LOCATION.

Referenced by F5LTmake_enum_type().

◆ F5Tsave_ProcArray_enum()

hid_t F5Tsave_ProcArray_enum ( hid_t loc_id)

Definition at line 422 of file F5types.c.

423{
424hid_t type_id;
425char vbuf[1024];
426 sprintf(vbuf, "%s-%d.%d.%d", FIBER_ARRAY_TYPE_ENUM,
428
429 /* Try to open existing field ID first. */
430
431 F5printf(50, "F5Tsave_ProcArray_enum(): Try to open existing procfield enum id %s\n", vbuf );
432 H5E_BEGIN_TRY
433 type_id = H5Topen2(loc_id, vbuf, H5P_DEFAULT);
434 H5E_END_TRY
435
436 if (type_id<0)
437 {
438 type_id = H5Tcopy( F5Ttransient_ProcArray_enum() );
439
440 F5printf(50, "F5Tsave_ProcArray_enum(): Saving type as %s\n", vbuf );
441 H5Tcommit2(loc_id, vbuf, type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
442
445 }
446 else
447 {
448 F5printf(30, "F5Tsave_ProcArray_enum() Warning: No version check implemented yet!");
449 }
450
451 return type_id;
452}

References F5Asave_string(), F5Asave_version(), F5printf, F5Ttransient_ProcArray_enum(), FIBER_ARRAY_TYPE_ENUM, FIBER_MAJOR_VERSION, FIBER_MINOR_VERSION, FIBER_RELEASE_VERSION, FIBER_VERSION_URL, and FIBER_VERSION_URL_LOCATION.

Referenced by F5Tset_field_ProcArray_enum().

◆ F5Tset_field_enum()

herr_t F5Tset_field_enum ( hid_t loc_id,
hid_t enum_type_id,
ArrayType what )

Set a field type in a file.

Definition at line 268 of file F5types.c.

269{
270hid_t space_id = H5Screate(H5S_SCALAR);
271hid_t attr_id;
272herr_t err;
273
274 if (loc_id < 0)
275 {
276 F5printf(30, "F5Tset_field_enum(%lli,%d): Called with invalid location ID!", loc_id, what);
277 H5Sclose(space_id);
278 return -1;
279 }
280
281 F5printf(30, "F5Tset_field_enum(%lli,%d)", loc_id, what);
282
283 H5E_BEGIN_TRY
284 attr_id = H5Acreate2(loc_id, FIBER_ARRAY_TYPE_ENUM, enum_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
285 H5E_END_TRY
286
287 if (attr_id<0)
288 {
289 F5printf(30, "F5Tset_field_enum(): Overwriting Field Typeinfo (last one counts!)");
290
291 F5check( H5Adelete(loc_id, FIBER_ARRAY_TYPE_ENUM) );
292 attr_id = H5Acreate2(loc_id, FIBER_ARRAY_TYPE_ENUM, enum_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
293 }
294
295 err = H5Awrite(attr_id, enum_type_id, &what);
296
297 if (err<0)
298 F5printf(30, "F5Tset_field_enum(%lli)::H5Awrite() returned %d\n", loc_id, err);
299
300 H5Aclose(attr_id);
301 H5Sclose(space_id);
302 return 0;
303}
#define F5check(HDF5call)
Definition F5private.h:71

References F5check, F5printf, and FIBER_ARRAY_TYPE_ENUM.

Referenced by F5Fcreate(), F5FSwrite_fraction(), F5Fwrite_1D(), F5Fwrite_flexible(), F5Fwrite_fraction(), F5Fwrite_fraction_external(), F5Fwrite_fractionS(), F5Fwrite_linear(), F5Fwrite_linear_fraction(), F5FwriteIMAGE(), F5Fwrites(), F5FwriteX(), F5Lwrite(), F5LwriteS(), and F5Lwrites().

◆ F5Tset_field_ProcArray_enum()

herr_t F5Tset_field_ProcArray_enum ( hid_t loc_id,
ProceduralArrayType what,
hid_t ProcIDLocation )

Set the array type of a procedural array.

Parameters
ProcIDLocationGroup ID where the enumeration type is stored in the file.

Definition at line 455 of file F5types.c.

456{
457hid_t space_id = H5Screate(H5S_SCALAR);
458hid_t attr_id;
459herr_t err;
460hid_t enum_type_id;
461
462 F5printf(30, "F5Tset_field_ProcArray_enum(%d,%d)", loc_id, what);
463
464 enum_type_id = F5Tsave_ProcArray_enum(ProcTypeIdLocation);
465
466 H5E_BEGIN_TRY
467 attr_id = H5Acreate2(loc_id, FIBER_ARRAY_TYPE_ENUM, enum_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
468 H5E_END_TRY
469
470 if (attr_id<0)
471 {
472 F5printf(30, "F5Tset_field_ProcArray_enum(): Overwriting Field Typeinfo (last one counts!)");
473
474 F5check( H5Adelete(loc_id, FIBER_ARRAY_TYPE_ENUM) );
475 attr_id = H5Acreate2(loc_id, FIBER_ARRAY_TYPE_ENUM, enum_type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
476 }
477
478 err = H5Awrite(attr_id, enum_type_id, &what);
479
480 if (err<0)
481 F5printf(30, "F5Tset_field_ProcArray_enum(%d)::H5Awrite() returned %d\n", loc_id, err);
482
483 H5Aclose(attr_id);
484 H5Sclose(space_id);
485 H5Tclose(enum_type_id);
486 return 0;
487}
hid_t F5Tsave_ProcArray_enum(hid_t loc_id)
Definition F5types.c:422

References F5check, F5printf, F5Tsave_ProcArray_enum(), FIBER_ARRAY_TYPE_ENUM, and H5Tclose().

Referenced by F5LwriteX().

◆ F5Ttensor_commit()

F5_API F5Ttensor_t * F5Ttensor_commit ( hid_t loc_id,
F5Ttensor_t *  )

Save tensor type to file and return a copy. All internal arrays are copied, no reference counting.

References F5_API.

◆ F5Ttransient_F5field_Array_enum()

hid_t F5Ttransient_F5field_Array_enum ( )

Get a field type for F5 array descriptions.

Definition at line 189 of file F5types.c.

190{
191 /*
192 Note: This transient type ID will never be closed.
193 */
194static hid_t type_id = -1;
195int enum_value;
196
197 if (type_id>0) return type_id;
198
199 type_id = H5Tenum_create(H5T_NATIVE_INT);
200#define InsertEnum(type_id, enum_member) enum_value=enum_member; \
201 H5Tenum_insert(type_id, #enum_member, &enum_value);
202
204 InsertEnum(type_id, Contiguous);
206 InsertEnum(type_id, Constant);
209 InsertEnum(type_id, DirectProduct);
211 InsertEnum(type_id, UniformSampling);
213
214/* enum alias?
215 enum_value = Contiguous;
216 H5Tenum_insert(type_id, "Contigous", &enum_value);
217*/
218
219 return type_id;
220}
#define InsertEnum(type_id, enum_member)

References Constant, Contiguous, DirectProduct, FragmentedContiguous, FragmentedSeparatedCompound, FragmentedUniformSampling, IndexPermutation, InsertEnum, SeparatedCompound, UniformSampling, and UnknownArrayType.

Referenced by F5Fwrite_fraction_external(), F5Tget_field_Array_enum(), and F5Tsave_F5field_enum().

◆ F5Ttransient_ProcArray_enum()

hid_t F5Ttransient_ProcArray_enum ( )

Definition at line 402 of file F5types.c.

403{
404static hid_t type_id = -1;
405int enum_value;
406
407 if (type_id>0) return type_id;
408
409 type_id = H5Tenum_create(H5T_NATIVE_INT);
410
414 /*
415 InsertEnum(type_id, FourierProcArray);
416 InsertEnum(type_id, ChebychevProcArray);
417 */
418 return type_id;
419}
@ UnknownProcArray
Definition F5defs.h:284
@ ExplicitProcArray
Definition F5defs.h:285
@ PolynomialProcArray
Definition F5defs.h:286

References ExplicitProcArray, InsertEnum, PolynomialProcArray, and UnknownProcArray.

Referenced by F5Tget_field_ProcArray_enum(), and F5Tsave_ProcArray_enum().

◆ newF5Ttensor()

F5Ttensor_t * newF5Ttensor ( const char * name,
int rank,
int dimension,
int components )

Create a new tensor type description. All arrays are allocated, but set to zero.

Definition at line 552 of file F5types.c.

553{
554F5Ttensor_t*This = new(F5Ttensor_t, 1);
555int i, total_components;
556
557 This->name = strdup(name);
558 This->type_id = -1; /* not yet defined */
559 This->rank = rank;
560 This->dimension = dimension;
561 This->components = components;
562
563 total_components = dimension;
564 for(i=1; i<rank; i++)
565 total_components *= dimension;
566
567
568 This->indexing = new(int, total_components);
569 This->parity = new(int, total_components);
570
571 This->covariance = new(int, rank);
572 This->reverse_indexing = new(int, components);
573
574 return This;
575}
name
Definition F5P.c:82
int components
Definition F5types.h:94

References F5Ttensor_t::components, F5Ttensor_t::covariance, F5Ttensor_t::dimension, F5Ttensor_t::indexing, F5Ttensor_t::name, name, F5Ttensor_t::parity, F5Ttensor_t::rank, F5Ttensor_t::reverse_indexing, and F5Ttensor_t::type_id.