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

Go to the source code of this file.

Typedefs

typedef enum F5ErrorCode_type F5ErrorCode

Enumerations

enum  F5ErrorCode_type {
  F5_SUCCESS = 0 , F5ERROR_INVALID_FPATH = -1 , F5ERROR_INCONSISTENT_DATASPACE = -2 , F5ERROR_INVALID_FRAGMENT_START = -3 ,
  F5ERROR_INVALID_FRAGMENT_END = -4 , F5ERROR_INVALID_FIELDNAME = -5 , F5ERROR_INVALID_FRAGMENTNAME = -6 , F5ERROR_INVALID_DATA_ADDRESS = -7 ,
  F5ERROR_INVALID_PARAMETERS = -9 , F5ERROR_ALREADY_EXISTS = -10 , F5ERROR_COMPOUND_EXPECTED = -30 , F5ERROR_COMPONENTMAP_EXPECTED = -31 ,
  F5ERROR_COMPONENTMAP_INVALID = -32 , F5ERROR_NONSPECIFIED = -100
}

Functions

F5_API int F5Fis_group (const F5Path *)
F5_API int F5Ffragment_is_group (const F5Path *fpath, const char *fragment_name)
F5_API int F5LTset_dataspace (F5Path *f, int rank, hsize_t *dims)
F5_API int F5LTexpand_dataspace (F5Path *f, int rank, hsize_t *dims)
F5_API int F5Fexpand_dataspace (F5Path *fpath, int rank, hsize_t *Dims)
F5_API hid_t F5file_type (F5Path *fpath, hid_t fieldtype)
F5_API void F5close (F5Path *f)
F5_API void F5closep (F5Path **f)
F5_API int F5Fopen (F5Path *f, const char *fieldname)
F5_API F5PathF5FopenMostRecentSlice (hid_t File_id, double *t, const char *gridname, const char *fieldname, const char *coordinate_system)
F5_API void F5Fclose (F5Path *f)
F5_API hid_t F5Fgrab (F5Path *f)
F5_API hid_t F5Fget_type2 (F5Path *f, hid_t elink_fapl_id)
F5_API hid_t F5Fget_type (F5Path *f)
F5_API hid_t F5Tget_space (F5Path *f)
F5_API hsize_t * F5Tpermute_dimensions (F5Path *fpath, int rank, hsize_t *target_dims, const hsize_t *source_dims)
F5_API int F5Tget_extent (F5Path *f, hsize_t *dims, int maxDims)
F5_API int F5Tget_index_depth (F5Path *f, int *result)
F5_API int F5LTget_skeleton_dimensionality (hid_t Top_hid)
F5_API int F5Tget_refinement_level (F5Path *f, hsize_t *dims, int maxDims)
F5_API int F5Fcreate (F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t property_id)
F5_API const char * F5Fwhatsup (F5ErrorCode)
F5_API F5ErrorCode F5Fwrite (F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id)
F5_API F5ErrorCode F5FwriteHyperDimensional (F5Path *fpath, const char *fieldname, int rank, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id)
F5_API F5ErrorCode F5_DEPRECATED ("This is an internal function. Use F5FwriteHyperDimensional() instead.", F5Fwrite_flexible(F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id, int do_check))
F5_API F5ErrorCode F5FwriteIMAGE (F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id)
F5_API F5ErrorCode F5Fwrite_1D (F5Path *fpath, const char *fieldname, hsize_t nElements, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id)
F5_API int F5Fwrites (F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void **dataPtr, hid_t property_id)
F5_API F5ErrorCode F5FwriteX (F5Path *fpath, const char *fieldname, int rank, 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)
F5_API void F5FevalX (double *result, int Mrank, const int index[], int components, const double *const polynomials[], const int polynom_order[], const int component_map[])
F5_API int F5Fwrite_linear (F5Path *fpath, const char *fieldname, int rank, hsize_t *dims, hid_t fieldtype, const void *base, const void *delta)
F5_API F5ErrorCode F5Fwrite_fraction (F5Path *fpath, const char *fieldname, int rank, const hsize_t *full_dims, const hsize_t *fragment_dims, 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 property_id)
F5_API F5ErrorCode F5Fwrite_fraction_external (F5Path *fpath, 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 *fragment_dims, 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 property_id)
F5_API F5ErrorCode F5Fwrite_fractionS (F5Path *fpath, const char *fieldname, int rank, const hsize_t *full_dims, const hsize_t *fragment_dims, 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 property_id)
F5_API int F5FSwrite_fraction (F5Path *fpath, const char *fieldname, int rank, const hsize_t *full_dims, const hsize_t *fragment_dims, 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 property_id, int AllowFullCoverage)
F5_API int F5Fwrite_linear_fraction (F5Path *fpath, const char *fieldname, int rank, const hsize_t *full_dims, const hsize_t *fragment_dims, hid_t fieldtype, const void *base, const void *delta, const hsize_t *datastart, const char *fraction_name)
F5_API int F5Fwrite_linear_fraction_overlap (F5Path *myPath, int rank, const hsize_t *start_border, const hsize_t *end_border, const char *fraction_name)
F5_API ArrayType F5Fget_field_enum (const F5Path *fpath, const char *fieldname, int *major_version, int *minor_version, int *release_version)
F5_API int F5Fis_linear (F5Path *fpath, const char *fieldname)
F5_API int F5Fis_fragmented (F5Path *fpath, const char *fieldname)
F5_API int F5Fis_separatedcompound (F5Path *fpath, const char *fieldname)
F5_API int F5Fread_linear (F5Path *fpath, hsize_t *dims, hid_t fieldtype, void *base, void *delta)
F5_API int F5Fread_linearo (F5Path *fpath, const char *fieldname, hsize_t *dims, hid_t fieldtype, void *base, void *delta)
F5_API int F5Fread_linear_fragment (F5Path *fpath, hid_t fragment_hid, hsize_t *dims, hid_t fieldtype, void *base, void *delta)
F5_API int F5Fget_attribute_byname (F5Path *f, const char *attribute_name, void *data, hsize_t N, hid_t mem_type_id, const char *fragment_name)
F5_API int F5Fset_attribute_byname (F5Path *f, const char *attribute_name, const void *data, hsize_t N, hid_t mem_type_id, const char *fragment_name)
F5_API int F5Fget_range (F5Path *f, const char *fragment_name, void *minmax)
F5_API int F5Fset_range (F5Path *f, const char *fragment_name, const void *minmax)

Typedef Documentation

◆ F5ErrorCode

Examples
ObjtoF5.c.

Definition at line 267 of file F5F.h.

Enumeration Type Documentation

◆ F5ErrorCode_type

Enumerator
F5_SUCCESS 

no troubles

F5ERROR_INVALID_FPATH 

fpath pointer is invalid

F5ERROR_INCONSISTENT_DATASPACE 

inconsistent dataspace (does not match with representation group)

F5ERROR_INVALID_FRAGMENT_START 

F5Fwrite_fraction(): fragment starts beyond dataspace

F5ERROR_INVALID_FRAGMENT_END 

F5Fwrite_fraction(): fragment ends beyond dataspace

F5ERROR_INVALID_FIELDNAME 

Invalid field name

F5ERROR_INVALID_FRAGMENTNAME 

Invalid fragment name

F5ERROR_INVALID_DATA_ADDRESS 

Invalid data pointer, nullptr

F5ERROR_INVALID_PARAMETERS 

Some invalid function parameter

F5ERROR_ALREADY_EXISTS 
F5ERROR_COMPOUND_EXPECTED 
F5ERROR_COMPONENTMAP_EXPECTED 
F5ERROR_COMPONENTMAP_INVALID 
F5ERROR_NONSPECIFIED 

Definition at line 223 of file F5F.h.

224{
225 /** no troubles */
226 F5_SUCCESS = 0,
227
228 /** fpath pointer is invalid */
230
231 /** inconsistent dataspace (does not match with representation group) */
232
234
235 /** F5Fwrite_fraction(): fragment starts beyond dataspace */
237
238 /** F5Fwrite_fraction(): fragment ends beyond dataspace */
240
241 /** Invalid field name */
243
244 /** Invalid fragment name */
246
247 /** Invalid data pointer, nullptr */
249
250 /** Some invalid function parameter */
252
254
255 /** @relates F5FwriteX */
257
258 /** @relates F5FwriteX */
260
261 /** @relates F5FwriteX */
263
265};
@ F5ERROR_COMPONENTMAP_INVALID
Definition F5F.h:262
@ F5ERROR_INVALID_FRAGMENT_START
Definition F5F.h:236
@ F5ERROR_INVALID_FRAGMENT_END
Definition F5F.h:239
@ F5ERROR_ALREADY_EXISTS
Definition F5F.h:253
@ F5ERROR_INVALID_DATA_ADDRESS
Definition F5F.h:248
@ F5_SUCCESS
Definition F5F.h:226
@ F5ERROR_INVALID_FPATH
Definition F5F.h:229
@ F5ERROR_NONSPECIFIED
Definition F5F.h:264
@ F5ERROR_INVALID_FRAGMENTNAME
Definition F5F.h:245
@ F5ERROR_INCONSISTENT_DATASPACE
Definition F5F.h:233
@ F5ERROR_INVALID_FIELDNAME
Definition F5F.h:242
@ F5ERROR_INVALID_PARAMETERS
Definition F5F.h:251
@ F5ERROR_COMPOUND_EXPECTED
Definition F5F.h:256
@ F5ERROR_COMPONENTMAP_EXPECTED
Definition F5F.h:259

Function Documentation

◆ F5_DEPRECATED()

F5_API F5ErrorCode F5_DEPRECATED ( "This is an internal function. Use F5FwriteHyperDimensional() instead." ,
F5Fwrite_flexible(F5Path *fpath, const char *fieldname, int dimension, hsize_t *dims, hid_t fieldtype, hid_t memtype, const void *dataPtr, hid_t property_id, int do_check)  )

References F5_API.

◆ F5closep()

F5_API void F5closep ( F5Path ** f)

Definition at line 222 of file F5B.c.

223{
224 if (!f) return;
225 if (!*f) return;
226 F5close(*f);
227 *f = NULL;
228}
void F5close(F5Path *f)
Definition F5B.c:186

References F5close().

◆ F5FevalX()

F5_API void F5FevalX ( double * result,
int Mrank,
const int index[],
int components,
const double *const polynomials[],
const int polynom_order[],
const int component_map[] )

Definition at line 1293 of file F5F.c.

1296{
1297int i;
1298 for(i=0; i<Mrank; i++)
1299 {
1300 int c = component_map[ i ];
1301 result[ c ] = poly_eval( polynomials[c], polynom_order[c], index[ i ] );
1302 }
1303/*
1304 for(i=0; i<components; i++)
1305 {
1306 result[i] = poly_eval( polynomials[i], polynom_order[i], index[ component_map[ i ] ] );
1307 }
1308*/
1309}

◆ F5Fexpand_dataspace()

F5_API int F5Fexpand_dataspace ( F5Path * fpath,
int rank,
hsize_t * Dims )

Definition at line 768 of file F5F.c.

769{
770hsize_t full_dims[FIBER_MAX_RANK];
771int retval;
772 F5Tpermute_dimensions(fpath, rank, full_dims , Dims);
773 retval = F5LTexpand_dataspace(fpath, rank, full_dims);
774 F5Tpermute_dimensions(fpath, rank, Dims, full_dims);
775 return retval;
776}
F5_API hsize_t * F5Tpermute_dimensions(F5Path *fpath, int rank, hsize_t *target_dims, const hsize_t *source_dims)
Definition F5F.c:277
F5_API int F5LTexpand_dataspace(F5Path *f, int rank, hsize_t *dims)
Definition F5LT.c:120
#define FIBER_MAX_RANK
Definition F5defs.h:105

References F5LTexpand_dataspace(), F5Tpermute_dimensions(), and FIBER_MAX_RANK.

◆ F5Ffragment_is_group()

F5_API int F5Ffragment_is_group ( const F5Path * fpath,
const char * fragment_name )

flag to tell wether the fragment in the current field is a group

Note: The requirement to call this function is likely a design error in the calling code.

Definition at line 135 of file F5F.c.

136{
137 if (!fpath) return 0;
138
139H5G_stat_t info;
140
141 herr_t status = H5Gget_objinfo(fpath->Field_hid, fragment_name, 0, &info);
142
143 if (status < 0)
144 return 0;
145
146 if (info.type == H5G_GROUP)
147 {
148 F5printf(5, "F5Ffragment_is_group == true");
149 return 1;
150 }
151
152 return 0;
153}
#define F5printf(verbosity,...)
Definition F5private.h:60
hid_t Field_hid
Definition F5Path.h:59

References F5printf, and F5Path::Field_hid.

◆ F5Fget_attribute_byname()

F5_API int F5Fget_attribute_byname ( F5Path * f,
const char * attribute_name,
void * data,
hsize_t N,
hid_t mem_type_id,
const char * fragment_name )

Get a field's attribute, possibly specifying data conversion.

Parameters
mem_type_idThe type of the attribute as it resides in memory, may be zero to use the type of the attribute in-file.
fragment_nameOptional name of a fragment, null string indicates unfragmented read.

Definition at line 1593 of file F5F.c.

1596{
1597herr_t err;
1598hid_t attr_id, type_id;
1599 if (!f)
1600 {
1601 F5printf(5, "Open attribute %s without path object cannot succeed!", attribute_name);
1602 return 0;
1603 }
1604
1605 if (fragment_name)
1606 {
1607 hid_t frag_id = F5Gtry_to_open(f->Field_hid, fragment_name);
1608 if (frag_id<0)
1609 {
1610 frag_id = F5Dtry_to_open(f->Field_hid, fragment_name);
1611 if (frag_id<0)
1612 {
1613 F5printf(5, "F5Fget_attribute_byname(%s,%s). No such fragment.", attribute_name, fragment_name);
1614 return 0;
1615 }
1616 }
1617
1618 attr_id = F5Atry_to_open( frag_id, attribute_name);
1619 F5Xclose( frag_id );
1620 }
1621 else
1622 attr_id = F5Atry_to_open( f->Field_hid, attribute_name);
1623
1624 if (attr_id<0)
1625 {
1626 /* attribute not found */
1627 F5printf(5, "Open attribute %s in fragment %s not found.", attribute_name, fragment_name);
1628 return 0;
1629 }
1630
1631 {
1632 hid_t space_id = H5Aget_space(attr_id);
1633 hsize_t NumberofExistingAttributeElements = H5Sget_simple_extent_npoints(space_id);
1634 H5Sclose(space_id);
1635 if (NumberofExistingAttributeElements != N)
1636 {
1637 F5printf(1,"F5Fget_attribute_byname() MISMATCH - trying to read %d elements for attribute %s which has %d elements in file.",
1638 (int)N, attribute_name, (int)NumberofExistingAttributeElements);
1639 return 0;
1640 }
1641 }
1642
1643 if (mem_type_id)
1644 type_id = mem_type_id;
1645 else
1646 type_id = H5Aget_type(attr_id);
1647
1648 {
1649 H5E_BEGIN_TRY
1650 err = F_H5Aread(attr_id, type_id, data, attribute_name);
1651 H5E_END_TRY
1652 }
1653
1654 H5Aclose(attr_id);
1655
1656 if (!mem_type_id)
1657 H5Tclose(type_id);
1658
1659 if (err<0)
1660 return 0;
1661 else
1662 return 1;
1663}
hid_t F5Atry_to_open(hid_t location, const char *name)
Definition F5A.c:23
H5Tclose(type_id)
herr_t F_H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf, const char *name)
Definition F5private.c:332
hid_t F5Dtry_to_open(hid_t location, const char *name)
Definition F5X.c:335
hid_t F5Gtry_to_open(hid_t location, const char *name)
Definition F5X.c:297
herr_t F5Xclose(hid_t obj_id)
Definition F5X.c:347

References F5Atry_to_open(), F5Dtry_to_open(), F5Gtry_to_open(), F5printf, F5Xclose(), F_H5Aread(), F5Path::Field_hid, and H5Tclose().

Referenced by F5Fget_range().

◆ F5Fget_field_enum()

F5_API ArrayType F5Fget_field_enum ( const F5Path * fpath,
const char * fieldname,
int * major_version,
int * minor_version,
int * release_version )

Get the field enumeration type for a given field. If the fieldname is zero, then the fpath object must contain a valid Field_id. The F5Path object is unchanged.

Definition at line 17 of file F5F.c.

19{
20ArrayType retval;
21int is_group = -1;
22hid_t loc_id;
23
24 F5printf(50, "F5Fget_field_enum(%s)", fieldname);
25
26 if (!fpath)
27 {
28 F5printf(50, "F5Fget_field_enum(%s): No valid F5Path given.", fieldname);
29 *major_version = *minor_version = *release_version = 0;
30 return UnknownArrayType;
31 }
32
33 if (fieldname)
34 {
35 H5E_BEGIN_TRY
36 is_group = 0;
37 loc_id = H5Dopen2(fpath->Representation_hid, fieldname, H5P_DEFAULT);
38 H5E_END_TRY
39 if (loc_id<0)
40 {
41 loc_id = H5Gopen2(fpath->Representation_hid, fieldname, H5P_DEFAULT);
42 if (loc_id<0)
43 {
44 F5printf(50, "F5Fget_field_enum(%s): Cannot determine field type!", fieldname);
45 }
46 is_group = 1;
47 }
48 }
49 else
50 loc_id = fpath->Field_hid;
51
52 retval = F5Tget_field_Array_enum(loc_id,
53 major_version, minor_version, release_version);
54
55 switch(is_group)
56 {
57 case 1: H5Gclose(loc_id); break;
58 case 0: H5Dclose(loc_id); break;
59 }
60
61 F5printf(50, "~F5Fget_field_enum(%s)", fieldname);
62 return retval;
63}
ArrayType
Definition F5defs.h:267
@ UnknownArrayType
Definition F5defs.h:268
ArrayType F5Tget_field_Array_enum(hid_t loc_id, int *major_version, int *minor_version, int *release_version)
Definition F5types.c:305
#define H5Gclose(x)
Definition F5X.h:144
hid_t Representation_hid
Definition F5Path.h:58

References F5printf, F5Tget_field_Array_enum(), F5Path::Field_hid, H5Gclose, F5Path::Representation_hid, and UnknownArrayType.

Referenced by F5Fis_fragmented(), F5Fis_separatedcompound(), and F5iterate_field_fragments().

◆ F5Fget_range()

F5_API int F5Fget_range ( F5Path * f,
const char * fragment_name,
void * minmax )

Field attribute (recommended): The min/max of components of a dataset. This two-element attribute is of the same type as a dataset, but contains the respective minimal/maximal value of the data's components. Example: for a set of point locations distributed in space, this gives the bounding box.

Parameters
memtype_idHDF5 Type ID describing the min/max variables. May be zero to use exactly the type of the field. Otherwise, type conversion must be available to HDF5.
Note
WARNING: You should never use the file type for reading, because then you might get values in the wrong bitorder! Usually you want to provide a type that is identically to the file type, but constructed from NATIVE types!
Todo
Write a function that converts types from file type to native type...

Definition at line 1666 of file F5F.c.

1667{
1668hid_t type_id = F5Fget_type(f);
1669
1670int check = F5Fget_attribute_byname( f, FIBER_FIELD_COMPONENT_RANGE, minmax, 2, type_id , fragment_name);
1671
1672 if( H5Iis_valid( type_id ) )
1673 if( H5Iget_type( type_id ) >= 0 )
1674 H5Tclose(type_id);
1675 return check;
1676}
hid_t F5Fget_type(F5Path *f)
Definition F5F.c:156
int F5Fget_attribute_byname(F5Path *f, const char *attribute_name, void *data, hsize_t N, hid_t mem_type_id, const char *fragment_name)
Definition F5F.c:1593
#define FIBER_FIELD_COMPONENT_RANGE
Definition F5defs.h:186

References F5Fget_attribute_byname(), F5Fget_type(), FIBER_FIELD_COMPONENT_RANGE, and H5Tclose().

◆ F5Fget_type()

F5_API hid_t F5Fget_type ( F5Path * f)

Definition at line 156 of file F5F.c.

157{
158 return F5Fget_type2(f,0);
159}
hid_t F5Fget_type2(F5Path *f, hid_t elink_fapl_id)
Definition F5F.c:161

References F5Fget_type2().

Referenced by F5Fget_average(), F5Fget_deviation(), F5Fget_fragment_range_ghost2(), F5Fget_range(), F5Fset_average2(), F5Fset_deviation2(), F5Fset_fragment_range_ghost2(), F5Fset_original_type2(), and F5Fset_range().

◆ F5file_type()

F5_API hid_t F5file_type ( F5Path * fpath,
hid_t fieldtype )

In F5, types are saved to the file to store certain information about datasets. The insufficiency in HDF5 is that a certain type can be saved to one file only, but not to many files, like a dataset. When a type is saved to a file, it becomes a "named type" - in contrast to "transient" types, which are not bound to a file. Only named types may carry attributes, transient types may not contain attributes.

Type attributes are used to describe properties of a type, in particular its tensorial properties, which is beyond the raw native type definition of e.g. float and dimension. We cannot store this information with a transient type, but must do it by our own ;-( .

Generic support would be desireable, but is not implemented right now. For now, only a limited set of pre-defined low-tensorial data types is hard-coded. By knowing this hard-coded type, also the tensorial type information is written into the file when saving the data type. Admittedly, this is not pretty, and a future revision will provide a more dynamically mechanism here.

The functionality is as follows:

Given a transient HDF5 type, return a named type that is suitable for the current file. The file ID's will be filled with the named data types.

@Note The file which is contained in fpath will be changed by this operation, because a new type might be created and saved into the file, so the fpath parameter cannot be const.

@Note This function currently only knows aboout point, vector and predefined tensor types in the ChartId. It is NOT fully generic. If it cannot convert some field type into a file type, it returns the transient type, i.e. we don't get a named type in this case.

Definition at line 941 of file F5Bchart.c.

942{
943 if (!fpath || !fpath->myChart)
944 {
945 F5printf(20, "F5file_type: No chart given, returning memory type.");
946 return fieldtype;
947 }
948
949 F5printf(40, "F5file_type(%p, %d): chart=%p", fpath, (int) fieldtype, fpath->myChart );
950
951 switch( H5Tget_class( fieldtype) )
952 {
953 default:
954 F5printf(20, "F5file_type query for unknown type (could be a native one).");
955 return fieldtype;
956
957 case H5T_INTEGER:
958 case H5T_FLOAT:
959 case H5T_STRING:
960 F5printf(20, "F5file_type query for integer/float/string type (could be a native one).");
961 return fieldtype;
962
963 case H5T_BITFIELD:
964 case H5T_OPAQUE:
965 case H5T_REFERENCE:
966 case H5T_ENUM:
967 case H5T_VLEN:
968 case H5T_ARRAY:
969 F5printf(20, "F5file_type query for unsupported type (could be a native one).");
970 return fieldtype;
971
972 case H5T_COMPOUND:
973 ;
974 }
975
976/*
977 The following code is executed once we know the fieldtype is a compound type.
978 */
979
980 {
981 hid_t FirstCompoundType = H5Tget_member_type( fieldtype, 0);
982 int CompoundPrecision = H5Tget_size( FirstCompoundType );
983
984 F5_ChartPrecisionTypes*IN = F5Bget_precision_by_size(fpath->myChart, CompoundPrecision),
985 *OUT = F5Bget_precision_by_size(fpath->FileIDs, CompoundPrecision);
986
987 H5Tclose( FirstCompoundType );
988
989 F5printf(20, "F5file_type query for compound type, precision %d.\n", CompoundPrecision);
990
991 assert(IN);
992 assert(OUT);
993 assert( fpath->myChart );
994 assert( fpath->FileIDs );
995
996 if (F5Tequal(fieldtype, IN->Point_hid_t) )
997 {
998 F5printf(20, "F5file_type query for point type.\n");
999 if (OUT->Point_hid_t<1)
1000 {
1001 F5printf(0, "F5file_type(): Possible internal error, point type not found in file!");
1002
1003 OUT->Point_hid_t = F5Tmake_precise_tensor(fpath, FIBER_HDF5_CHART_POINT_TYPE, CompoundPrecision,
1004 IN->Point_hid_t, 0,0, 0);
1005 {
1006 int cd = fpath->myChart->cell_dimensionality;
1007 printf("CELL Dimensionality: %d\n", cd);
1008 F5Asave_ints(OUT->Point_hid_t, FIBER_HDF5_CELLDIMENSIONALITY, &cd, 1);
1009 }
1010
1011#ifdef SAVE_MEMORDER_WITH_TYPE
1012 F5T_save_perm_vector(OUT->Point_hid_t,
1013 H5Tget_nmembers( OUT->Point_hid_t ),
1014 fpath->FileIDs->perm_vector);
1015#endif
1016 }
1017 return OUT->Point_hid_t;
1018 }
1019 else if (F5Tequal(fieldtype, IN->Vector_hid_t) )
1020 {
1021 F5printf(20, "F5file_type query for vector type %d", (int) IN->Vector_hid_t );
1022 if (OUT->Vector_hid_t<1)
1023 {
1024 int covariance[] = {1}; /* Tangential vectors have one upper index */
1025 OUT->Vector_hid_t =
1026 F5Tmake_precise_tensor(fpath, FIBER_HDF5_CHART_VECTOR_TYPE, CompoundPrecision,
1027 IN->Vector_hid_t, 1, covariance, 1);
1028 }
1029 return OUT->Vector_hid_t;
1030 }
1031 else if (F5Tequal(fieldtype, IN->Covector_hid_t) )
1032 {
1033 F5printf(20, "F5file_type query for covector type.\n");
1034 if (OUT->Covector_hid_t<1)
1035 {
1036 int covariance[] = {-1}; /* Co-vectors have one lower index */
1037 OUT->Covector_hid_t =
1039 IN->Covector_hid_t, 1, covariance, 1);
1040 }
1041 return OUT->Covector_hid_t;
1042 }
1043 else if (F5Tequal(fieldtype, IN->Bivector_hid_t) )
1044 {
1045 F5printf(20, "F5file_type query for bivector type.\n");
1046 if (OUT->Bivector_hid_t<1)
1047 {
1048 int covariance[] = {1,1}; /* bivectors have two upper indices */
1049 OUT->Bivector_hid_t =
1051 IN->Bivector_hid_t, 2, covariance, 2);
1052 }
1053 return OUT->Bivector_hid_t;
1054 }
1055 else if (F5Tequal(fieldtype, IN->Bicovector_hid_t) )
1056 {
1057 F5printf(20, "F5file_type query for bicovector type.\n");
1058 if (OUT->Bivector_hid_t<1)
1059 {
1060 int covariance[] = {-1,-1}; /* bicovectors have two lower indices */
1061 OUT->Bicovector_hid_t =
1063 IN->Bicovector_hid_t, 2, covariance, 2);
1064 }
1065 return OUT->Bicovector_hid_t;
1066 }
1067
1068 else if (F5Tequal(fieldtype, IN->Metric_hid_t) )
1069 {
1070 F5printf(20, "F5file_type query for metric type.\n");
1071 if (OUT->Metric_hid_t<1)
1072 {
1073 /* g_\mu\nu */
1074 int covariance[] = {-1, -1}; /* Metric tensors have two lower indices */
1075 OUT->Metric_hid_t =
1076 F5Tmake_precise_tensor(fpath, FIBER_HDF5_CHART_METRIC_TYPE, CompoundPrecision,
1077 IN->Metric_hid_t, 2, covariance, 0);
1078 }
1079 return OUT->Metric_hid_t;
1080 }
1081 else if (F5Tequal(fieldtype, IN->Cometric_hid_t) )
1082 {
1083 F5printf(20, "F5file_type query for cometric type.\n");
1084 if (OUT->Cometric_hid_t<1)
1085 {
1086 /* g^\mu\nu */
1087 int covariance[] = {1, 1}; /* Cometric tensors have two upper indices */
1088 OUT->Cometric_hid_t =
1090 IN->Cometric_hid_t, 2, covariance, 0);
1091 }
1092 return OUT->Cometric_hid_t;
1093 }
1094
1095
1096 F5printf(2, __FILE__ ": Warning: F5file_type() query could not identify file type.\n");
1097 {
1098 int TypeMembers = H5Tget_nmembers( fieldtype );
1099 const char*MultiplicityCategory;
1100 hid_t MultiplicityCategory_id;
1101 switch(TypeMembers)
1102 {
1103 case 1: MultiplicityCategory = "Chart-free compound types with one member"; break;
1104 case 2: MultiplicityCategory = "Chart-free compound types with two members"; break;
1105 case 3: MultiplicityCategory = "Chart-free compound types with three members"; break;
1106 case 4: MultiplicityCategory = "Chart-free compound types with four members"; break;
1107 default:MultiplicityCategory = "Chart-free compound types with many members"; break;
1108 }
1109 MultiplicityCategory_id = F5Gappend(fpath->GlobalChart_hid, MultiplicityCategory);
1110
1111 {
1112#define FIBER_HDF5_ANONYMOUS_TYPENAME "F5::TypeName%04u"
1113 char type_name[1024];
1114 unsigned nthType = 0;
1115 for(;nthType<10000;nthType++)
1116 {
1117 hid_t type_id;
1118 sprintf(type_name, FIBER_HDF5_ANONYMOUS_TYPENAME, nthType);
1119 type_id = F5Tappend(MultiplicityCategory_id, type_name, fieldtype);
1120
1121 if (type_id>0)
1122 {
1123 /*
1124 Inject This type to the chart file identifiers
1125 for the output file, for mere cleanup upon file
1126 closing. Otherwise This type ID will NOT be associated
1127 with the respective chart.
1128 */
1129 F5B_inject_precision_type(OUT, type_id);
1130 H5Gclose(MultiplicityCategory_id);
1131 return type_id;
1132 }
1133 }
1134 puts("F5file_type: Creating anonymous type name failed!");
1135 H5Gclose(MultiplicityCategory_id);
1136 return fieldtype;
1137 }
1138 }
1139 }
1140}
int F5Asave_ints(hid_t loc_id, const char *name, const int data[], hsize_t n)
Definition F5A.c:355
void F5T_save_perm_vector(hid_t location, int rank, int perm_vector[])
Definition F5Bchart.c:879
F5_ChartPrecisionTypes * F5Bget_precision_by_size(ChartDomain_IDs *CD, int TypeSize)
Definition F5Bchart.c:916
int F5B_inject_precision_type(F5_ChartPrecisionTypes *IDs, hid_t type_id)
Definition F5Bchart.c:477
#define FIBER_HDF5_ANONYMOUS_TYPENAME
struct _F5_ChartPrecisionTypes F5_ChartPrecisionTypes
Definition F5Bchart.h:71
hid_t F5Tappend(hid_t loc_id, const char *name, hid_t type_id)
Definition F5T.c:25
hid_t F5Tmake_precise_tensor(F5Path *fpath, const char *type_name, int TypeBytePrecision, hid_t transient_type, int rank, int indices[], int grade)
Definition F5T.c:115
#define FIBER_HDF5_CHART_METRIC_TYPE
Definition F5defs.h:135
#define FIBER_HDF5_CELLDIMENSIONALITY
Definition F5defs.h:127
#define FIBER_HDF5_CHART_POINT_TYPE
Definition F5defs.h:129
#define FIBER_HDF5_CHART_VECTOR_TYPE
Definition F5defs.h:130
#define FIBER_HDF5_CHART_COMETRIC_TYPE
Definition F5defs.h:136
#define FIBER_HDF5_CHART_BIVECTOR_TYPE
Definition F5defs.h:133
#define FIBER_HDF5_CHART_BICOVECTOR_TYPE
Definition F5defs.h:134
#define FIBER_HDF5_CHART_COVECTOR_TYPE
Definition F5defs.h:131
hid_t F5Gappend(hid_t loc_id, const char *name)
Definition F5X.c:59
int cell_dimensionality
Definition F5Bchart.h:142
int perm_vector[FIBER_MAX_RANK]
Definition F5Bchart.h:141
hid_t GlobalChart_hid
Definition F5Path.h:54
ChartDomain_IDs * FileIDs
Definition F5Path.h:35
ChartDomain_IDs * myChart
Definition F5Path.h:33

References _F5_ChartPrecisionTypes::Bicovector_hid_t, _F5_ChartPrecisionTypes::Bivector_hid_t, ChartDomain_IDs::cell_dimensionality, _F5_ChartPrecisionTypes::Cometric_hid_t, _F5_ChartPrecisionTypes::Covector_hid_t, F5Asave_ints(), F5B_inject_precision_type(), F5Bget_precision_by_size(), F5Gappend(), F5printf, F5T_save_perm_vector(), F5Tappend(), F5Tmake_precise_tensor(), FIBER_HDF5_ANONYMOUS_TYPENAME, FIBER_HDF5_CELLDIMENSIONALITY, FIBER_HDF5_CHART_BICOVECTOR_TYPE, FIBER_HDF5_CHART_BIVECTOR_TYPE, FIBER_HDF5_CHART_COMETRIC_TYPE, FIBER_HDF5_CHART_COVECTOR_TYPE, FIBER_HDF5_CHART_METRIC_TYPE, FIBER_HDF5_CHART_POINT_TYPE, FIBER_HDF5_CHART_VECTOR_TYPE, F5Path::FileIDs, F5Path::GlobalChart_hid, H5Gclose, H5Tclose(), _F5_ChartPrecisionTypes::Metric_hid_t, F5Path::myChart, ChartDomain_IDs::perm_vector, _F5_ChartPrecisionTypes::Point_hid_t, and _F5_ChartPrecisionTypes::Vector_hid_t.

Referenced by F5Fcreate(), F5FSwrite_fraction(), F5Fwrite_1D(), F5Fwrite_flexible(), F5Fwrite_fraction(), F5Fwrite_fraction_external(), F5Fwrite_fractionS(), F5Fwrite_linear(), F5Fwrite_linear_fraction(), F5FwriteIMAGE(), F5Fwrites(), F5FwriteX(), F5Rcreate_uniform_sparse(), F5write_particle_cartesian3Dv(), F5write_particle_cartesian3DvU(), and F5write_particle_double_cartesian3Dv().

◆ F5Fis_fragmented()

F5_API int F5Fis_fragmented ( F5Path * fpath,
const char * fieldname )

Definition at line 1106 of file F5F.c.

1107{
1108int major_version, minor_version, release_version;
1109ArrayType at = F5Fget_field_enum(fpath, fieldname,
1110 &major_version, &minor_version, &release_version);
1111
1112 if (major_version != FIBER_MAJOR_VERSION ||
1113 minor_version != FIBER_MINOR_VERSION ||
1114 release_version != FIBER_RELEASE_VERSION)
1115 return 0;
1116
1117 switch(at)
1118 {
1122 return 1;
1123
1124 default: return 0;
1125 }
1126}
ArrayType F5Fget_field_enum(const F5Path *fpath, const char *fieldname, int *major_version, int *minor_version, int *release_version)
Definition F5F.c:17
#define FIBER_RELEASE_VERSION
Definition F5defs.h:16
@ FragmentedContiguous
Definition F5defs.h:272
@ FragmentedUniformSampling
Definition F5defs.h:277
@ FragmentedSeparatedCompound
Definition F5defs.h:273
#define FIBER_MAJOR_VERSION
Definition F5defs.h:14
#define FIBER_MINOR_VERSION
Definition F5defs.h:15

References F5Fget_field_enum(), FIBER_MAJOR_VERSION, FIBER_MINOR_VERSION, FIBER_RELEASE_VERSION, FragmentedContiguous, FragmentedSeparatedCompound, and FragmentedUniformSampling.

◆ F5Fis_group()

F5_API int F5Fis_group ( const F5Path * fpath)

flag to tell wether the field id is a group

Definition at line 126 of file F5F.c.

127{
128 if (!fpath) return 0;
129 if (H5Iget_type( fpath->Field_hid ) == H5I_GROUP)
130 return 1;
131
132 return 0;
133}

References F5Path::Field_hid.

Referenced by F5close(), F5Fclose(), F5Fget_string_attribute(), F5Fget_type2(), F5Fset_attribute(), F5Fset_string_attribute(), F5iterate_field_fragments(), and F5Tget_space().

◆ F5Fis_separatedcompound()

F5_API int F5Fis_separatedcompound ( F5Path * fpath,
const char * fieldname )

Definition at line 1128 of file F5F.c.

1129{
1130int major_version, minor_version, release_version;
1131ArrayType at = F5Fget_field_enum(fpath, fieldname,
1132 &major_version, &minor_version, &release_version);
1133
1134 if (major_version != FIBER_MAJOR_VERSION ||
1135 minor_version != FIBER_MINOR_VERSION ||
1136 release_version != FIBER_RELEASE_VERSION)
1137 return 0;
1138
1139 switch(at)
1140 {
1142 return 1;
1143
1144 default: return 0;
1145 }
1146}

References F5Fget_field_enum(), FIBER_MAJOR_VERSION, FIBER_MINOR_VERSION, FIBER_RELEASE_VERSION, and FragmentedSeparatedCompound.

◆ F5Fread_linear_fragment()

F5_API int F5Fread_linear_fragment ( F5Path * fpath,
hid_t fragment_hid,
hsize_t * dims,
hid_t fieldtype,
void * base,
void * delta )

same as F5Fread_linear, but reads a fragment of a field @TODO revise this function as it requires a fragment_hid, which is out of synch with the remaining F5 API: Fragments must never passed as id's but only as name, which may also be a null pointer to indicate unfragmented fields.

Definition at line 1550 of file F5F.c.

1554{
1555hid_t field_id;
1556int rank;
1557hsize_t file_dims[FIBER_MAX_RANK];
1558
1559 F5printf(40, "F5Fread_linear()");
1560 /* F5Fclose( fpath ); */
1561
1562 /* field_id = F5Lread_linear(fpath->Representation_hid, fieldname, */
1563
1564 field_id = F5Lread_linear(fragment_hid,
1565 file_dims,
1566 fieldtype,
1567 base, delta);
1568
1569 if (field_id < 0 )
1570 return 0;
1571
1572 if (dims)
1573 {
1574 rank = H5Tget_nmembers( fieldtype );
1576 F5Tpermute_dimensions(fpath, rank, dims, file_dims );
1578 }
1579
1580 F5printf(40, "~F5Fread_linear()");
1581 return 1;
1582}
int F5printf_indent
Definition F5private.c:349
hid_t F5Lread_linear(hid_t F_id, hsize_t *dims, hid_t fieldtype, void *base, void *delta)
Definition F5L.c:911

References F5Lread_linear(), F5printf, F5printf_indent, F5Tpermute_dimensions(), and FIBER_MAX_RANK.

◆ F5Fread_linearo()

F5_API int F5Fread_linearo ( F5Path * fpath,
const char * fieldname,
hsize_t * dims,
hid_t fieldtype,
void * base,
void * delta )

References F5_API.

◆ F5Fset_attribute_byname()

F5_API int F5Fset_attribute_byname ( F5Path * f,
const char * attribute_name,
const void * data,
hsize_t N,
hid_t mem_type_id,
const char * fragment_name )

Set a field's attribute.

Parameters
fragment_nameOptional name of a fragment, null string indicates unfragmented read.

Definition at line 1680 of file F5F.c.

1684{
1685hid_t attr_id, space_id;
1686 if (!f)
1687 {
1688 F5printf(5,"F5Fset_attribute() got NULL F5Path, cannot set attribute %s .",attribute_name);
1689 return 0;
1690 }
1691 if (f->Field_hid<1)
1692 {
1693 F5printf(5,"F5Fset_attribute() F5Path has no field ID, cannot set attribute %s .",attribute_name);
1694 return 0;
1695 }
1696
1697 space_id = H5Screate_simple(1, &N, &N );
1698
1699 if (fragment_name)
1700 {
1701 hid_t frag_id;
1702 H5E_BEGIN_TRY
1703 frag_id = H5Gopen2(f->Field_hid, fragment_name, H5P_DEFAULT);
1704 H5E_END_TRY
1705 if (frag_id<0)
1706 {
1707 frag_id = F5Dtry_to_open(f->Field_hid, fragment_name);
1708 }
1709
1710 attr_id = F5Atry_to_open( frag_id, attribute_name);
1711 if (attr_id<0)
1712 attr_id = F5Acreate( frag_id, attribute_name, mem_type_id, space_id, H5P_DEFAULT);
1713
1714 F5Xclose( frag_id );
1715 }
1716 else
1717 {
1718 attr_id = F5Atry_to_open( f->Field_hid, attribute_name);
1719 if (attr_id<0)
1720 attr_id = F5Acreate( f->Field_hid, attribute_name, mem_type_id, space_id, H5P_DEFAULT);
1721 }
1722
1723 H5Sclose( space_id );
1724
1725 if (attr_id<0)
1726 {
1727 F5printf(5,"F5Fset_attribute() Could neither open or create attribute %s .",attribute_name);
1728 return 0;
1729 }
1730
1731 H5Awrite(attr_id, mem_type_id, data );
1732 H5Aclose(attr_id);
1733 return 1;
1734}
hid_t F5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist)
Definition F5private.c:11

References F5Acreate(), F5Atry_to_open(), F5Dtry_to_open(), F5printf, F5Xclose(), and F5Path::Field_hid.

Referenced by F5Fset_range().

◆ F5Fset_range()

F5_API int F5Fset_range ( F5Path * f,
const char * fragment_name,
const void * minmax )

Set the range of values within a dataset. The given min/max values must be of the same type as in the field.

Definition at line 1737 of file F5F.c.

1738{
1739hid_t type_id = F5Fget_type(f);
1740int check;
1741 if (type_id<=0)
1742 return 0;
1743
1744 check = F5Fset_attribute_byname(f,
1745 FIBER_FIELD_COMPONENT_RANGE, minmax, 2,
1746 type_id, fragment_name);
1747
1748 H5Tclose(type_id);
1749
1750 return check;
1751}
int F5Fset_attribute_byname(F5Path *f, const char *attribute_name, const void *data, hsize_t N, hid_t mem_type_id, const char *fragment_name)
Definition F5F.c:1680

References F5_API, F5Fget_type(), F5Fset_attribute_byname(), FIBER_FIELD_COMPONENT_RANGE, and H5Tclose().

Referenced by F5Rcreate_uniform_cartesian3D(), and F5Rcreate_uniform_cartesian3Dbbox().

◆ F5Fwrite_1D()

F5_API F5ErrorCode F5Fwrite_1D ( F5Path * fpath,
const char * fieldname,
hsize_t nElements,
hid_t fieldtype,
hid_t memtype,
const void * dataPtr,
hid_t property_id )

Definition at line 631 of file F5F.c.

634{
635hid_t file_type;
636 F5printf(40,"F5Fwrite1D(%s)", fieldname);
637 if (!fpath)
638 {
639 F5printf(41,"F5Fwrite1D(%s): no fpath given!", fieldname);
641 }
642 if (nElements<1)
643 {
644 F5printf(30,"F5Fwrite1D(%s): No elements given, field not created!",fieldname);
646 }
647 if (fpath->Representation_hid<0)
648 {
649 F5printf(30,"F5Fwrite1D(%s): INVALID Representation ID given!",fieldname);
651 }
652 if (fieldtype<0)
653 {
654 F5printf(30,"F5Fwrite1D(%s): INVALID field type ID given!",fieldname);
656 }
657
658 file_type = F5file_type(fpath, fieldtype);
659 if (file_type<0)
660 {
661 F5printf(30,"F5Fwrite1D(%s): CANNOT created file type from field type %d given!",
662 fieldname, (int)fieldtype );
664 }
665
666 F5Fclose(fpath);
667
668/* TODO: Check the consistency of the number of elements here */
669
670 fpath->Field_hid = F5Lwrite1D(fpath->Representation_hid, fieldname,
671 nElements,
672 file_type, memtype, dataPtr,
673 F5LTmake_enum_type(fpath),
674 property_id);
675
676 if (fpath->Field_hid < 0)
677 {
678 F5printf(30,"F5Fwrite1D(): F5Lwrite1D FAILED!");
680 }
681
683 F5I_add_field(fpath, fieldname);
684 F5printf(40,"F5Fwrite1D() ok");
685
686 return F5_SUCCESS;
687}
hid_t F5file_type(F5Path *fpath, hid_t fieldtype)
Definition F5Bchart.c:941
hid_t F5LTmake_enum_type(F5Path *fpath)
Definition F5LT.c:179
@ Contiguous
Definition F5defs.h:269
void F5I_add_field(F5Path *fpath, const char *fieldname)
Definition F5private.c:178
herr_t F5Tset_field_enum(hid_t loc_id, hid_t enum_type_id, ArrayType what)
Definition F5types.c:268
void F5Fclose(F5Path *f)
Definition F5F.c:92
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)
Definition F5L.c:408

References Contiguous, F5_API, F5_SUCCESS, F5ERROR_INCONSISTENT_DATASPACE, F5ERROR_INVALID_FPATH, F5ERROR_NONSPECIFIED, F5Fclose(), F5file_type(), F5I_add_field(), F5LTmake_enum_type(), F5Lwrite1D(), F5printf, F5Tset_field_enum(), F5Path::Field_hid, and F5Path::Representation_hid.

Referenced by F5Cwrite_triangular_surface_vc(), F5Flink_triangular_surface(), F5write_particle_cartesian3Dv(), F5write_particle_cartesian3DvU(), F5write_particle_double_cartesian3Dv(), and F5write_particle_positions().

◆ F5Fwrite_fraction_external()

F5_API F5ErrorCode F5Fwrite_fraction_external ( F5Path * fpath,
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 * fragment_dims,
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 property_id )

Definition at line 1001 of file F5F.c.

1012{
1013hid_t field_id;
1014int i;
1015hsize_t full_dims[FIBER_MAX_RANK], start_dims[FIBER_MAX_RANK], ldims[FIBER_MAX_RANK],
1016 sborder[FIBER_MAX_RANK], eborder[FIBER_MAX_RANK];
1017
1018 if (!fpath)
1019 return F5ERROR_INVALID_FPATH;
1020
1021 F5printf(30, "F5Fwrite_fraction_external(%s, rank=%d)", fieldname, rank);
1022 if (rank==3)
1023 F5printf(20, "F5Fwrite_fraction_external(%lux%lux%lu)",
1024 (int)fraction_dims[0], (int)fraction_dims[1], (int)fraction_dims[2]);
1025 else if(rank==2)
1026 F5printf(20, "F5Fwrite_fraction_external(%lux%lu)",
1027 (int)fraction_dims[0], (int)fraction_dims[1]);
1028 else if (rank==1)
1029 F5printf(20, "F5Fwrite_fraction_external(%lu)",
1030 (int)fraction_dims[0]);
1031
1033
1034 F5Tpermute_dimensions(fpath, rank, full_dims , Dims );
1035 F5Tpermute_dimensions(fpath, rank, start_dims, datastart );
1036 F5Tpermute_dimensions(fpath, rank, ldims , fraction_dims);
1037 F5Tpermute_dimensions(fpath, rank, sborder , start_border );
1038 F5Tpermute_dimensions(fpath, rank, eborder , end_border );
1040
1041 if (Dims) for(i=0; i<rank; i++)
1042 {
1043 if (datastart[i] >= Dims[i])
1044 {
1045 F5printf(-1, "F5Fwrite_fraction(%s): fragment starts beyond dataspace in dimension %d: %d (max %d allowed)!",
1046 fieldname, i, (int)datastart[i], (int)Dims[i] );
1048 }
1049 if (datastart[i]+fraction_dims[i] > Dims[i])
1050 {
1051 F5printf(-1, "F5Fwrite_fraction(%s): fragment extends beyond dataspace in dimension %d: %d (max %d allowed)!",
1052 fieldname, i, (int)(datastart[i]+fraction_dims[i]), (int)Dims[i] );
1054 }
1055 }
1056 //
1057 // closing the field in the FPath here
1058 // because it will be overwritten with a new field ID soon
1059 //
1060 F5Fclose( fpath );
1061
1062#ifdef DO_DATASPACE_CONSISTENCY_CHECK
1063 if (Dims)
1064 {
1065 if (!F5LTset_dataspace(fpath, rank, full_dims))
1066 {
1067 F5printf(-1, "F5Fwrite_fraction(%s): cannot create, inconsistent dataspace!", fieldname);
1068 return F5_SUCCESS; /* ??? */
1069 }
1070 }
1071#endif
1072 field_id = F5Lwrite_fraction_external(fpath->Representation_hid, fieldname,
1073
1074 target_file_name,
1075 target_obj_name,
1076 prefix,
1077
1078 rank, Dims ? full_dims : NULL, ldims,
1079 F5file_type(fpath, fieldtype), memtype, dataPtr,
1080 start_dims,
1081 start_border?sborder:NULL, end_border?eborder:NULL,
1082 fraction_name, F5LTmake_enum_type(fpath), property_id);
1083
1084 fpath->Field_hid = field_id;
1085
1086/* F5printf(10,"~F5Fwrite_fraction(%s) temporarily set type attribute...", fieldname);
1087 F5Dset_type_attribute(fpath->Field_hid, F5file_type(fpath, fieldtype) );
1088*/
1089#if 0
1090/*
1091 As with HDF5 1.8.14 - 1.8.17, 1.10.0 , saving attributes with a named type that
1092 has been committed to another file than the external file does not work.
1093 */
1095#else
1097#endif
1098
1099 F5I_add_field(fpath, fieldname);
1100
1101 F5printf(30, "~F5Fwrite_fraction(%s) wrote fragmented contigous field", fieldname);
1102 return F5_SUCCESS;
1103}
F5_API int F5LTset_dataspace(F5Path *f, int rank, hsize_t *dims)
Definition F5LT.c:43
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 F5L.c:738
hid_t F5Ttransient_F5field_Array_enum()
Definition F5types.c:189

References F5_SUCCESS, F5ERROR_INVALID_FPATH, F5ERROR_INVALID_FRAGMENT_END, F5ERROR_INVALID_FRAGMENT_START, F5Fclose(), F5file_type(), F5I_add_field(), F5LTmake_enum_type(), F5LTset_dataspace(), F5Lwrite_fraction_external(), F5printf, F5printf_indent, F5Tpermute_dimensions(), F5Tset_field_enum(), F5Ttransient_F5field_Array_enum(), FIBER_MAX_RANK, F5Path::Field_hid, FragmentedContiguous, and F5Path::Representation_hid.

◆ F5Fwrite_linear_fraction_overlap()

F5_API int F5Fwrite_linear_fraction_overlap ( F5Path * myPath,
int rank,
const hsize_t * start_border,
const hsize_t * end_border,
const char * fraction_name )

Write overlap attributes associated with linear fractions.

Definition at line 1383 of file F5F.c.

1388{
1389 if (!myPath ) return 0;
1390 if (!myPath->Field_hid) return 0;
1391 if (!fraction_name) return 0;
1392
1393hid_t B_id = H5Gopen2( myPath->Field_hid, fraction_name, H5P_DEFAULT);
1394 if (start_border)
1395 {
1396 hsize_t sborder[FIBER_MAX_RANK];
1397 if (!is_all_zero(rank, start_border))
1398 {
1399 F5Tpermute_dimensions(myPath, rank, sborder , start_border );
1401 }
1402 }
1403 if (end_border)
1404 {
1405 hsize_t eborder[FIBER_MAX_RANK];
1406 if (!is_all_zero(rank, end_border))
1407 {
1408 F5Tpermute_dimensions(myPath, rank, eborder , end_border );
1410 }
1411 }
1412 F5Xclose(B_id);
1413 return 1;
1414}
#define FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE
Definition F5defs.h:175
#define FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE
Definition F5defs.h:176
int F5LAsave_dimensions(hid_t Field_id, const char *aname, int rank, const hsize_t *dims)
Definition F5A.c:192

References F5LAsave_dimensions(), F5Tpermute_dimensions(), F5Xclose(), FIBER_FRAGMENT_NOOVERLAP_END_ATTRIBUTE, FIBER_FRAGMENT_NOOVERLAP_START_ATTRIBUTE, FIBER_MAX_RANK, and F5Path::Field_hid.

◆ F5Fwrites()

F5_API int F5Fwrites ( F5Path * fpath,
const char * fieldname,
int dimension,
hsize_t * dims,
hid_t fieldtype,
hid_t memtype,
const void ** dataPtr,
hid_t property_id )

Write an array of compound data type as separated components.

Parameters
dataPtrAn array of pointers to the respective arrays for each component
memtypeAn HDF5 compound data type that specifies how the data reside in memory.
Returns
0 if the entry could not be opened, non-zero otherwise.

Definition at line 690 of file F5F.c.

694{
695hsize_t save_dims[FIBER_MAX_RANK];
696hid_t file_type;
697
698 F5printf(40,"F5Fwrites()");
699 if (!fpath) return 0;
700
701 F5Fclose(fpath);
702
704 F5Tpermute_dimensions(fpath, rank, save_dims, dims);
706
707 if (!F5LTset_dataspace(fpath, rank, save_dims))
708 {
709 F5printf(-1, "F5Fwrites(%s): cannot create, inconsistent dataspace!", fieldname);
711 }
712
713 file_type = F5file_type(fpath, fieldtype);
714
715 fpath->Field_hid = F5Lwrites(fpath->Representation_hid, fieldname,
716 rank, save_dims,
717 file_type, memtype, dataPtr,
718 F5LTmake_enum_type(fpath),
719 property_id);
720
721 if (fpath->Field_hid <0)
722 F5printf(1, "**F5Fwrites(%s) could not write separated compound type!", fieldname);
723
724 switch( H5Tget_class(file_type ) )
725 {
726 case H5T_COMPOUND:
728 break;
729
730 case H5T_INTEGER:
731 case H5T_FLOAT:
733 break;
734
735 default:
737 break;
738 }
739
740 F5I_add_field(fpath, fieldname);
741
742 F5printf(40,"F5Fwrites() ok");
743 return F5_SUCCESS;
744}
@ SeparatedCompound
Definition F5defs.h:270
hid_t F5Lwrites(hid_t R_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)
Definition F5L.c:1096

References Contiguous, F5_API, F5_SUCCESS, F5ERROR_INCONSISTENT_DATASPACE, F5Fclose(), F5file_type(), F5I_add_field(), F5LTmake_enum_type(), F5LTset_dataspace(), F5Lwrites(), F5printf, F5printf_indent, F5Tpermute_dimensions(), F5Tset_field_enum(), FIBER_MAX_RANK, F5Path::Field_hid, F5Path::Representation_hid, and SeparatedCompound.

Referenced by F5Fwrite_uniform_cartesian3Ds(), and F5write_uniform_cartesian3Dvs().

◆ F5LTexpand_dataspace()

F5_API int F5LTexpand_dataspace ( F5Path * f,
int rank,
hsize_t * dims )

Definition at line 120 of file F5LT.c.

121{
122hsize_t current_dims[FIBER_MAX_RANK];
123int current_rank, Mrank;
124int i;
125
126 F5printf(30, "F5LTexpand_dataspace(,%d,)", rank);
127 if (!f)
128 return 1;
129
131 if (Mrank<0)
132 {
133 F5printf(30, "F5LTexpand_dataspace(,%d,): INVALID FILE: RANK attribute is not integer - cannot set dataspace!", rank);
134 return 0;
135 }
136 if (Mrank>=0)
137 {
138 if (Mrank != rank)
139 {
140 F5printf(30, "F5LTexpand_dataspace(,%d,): Dimensions incompatible with RANK attribute %d - inconsistent dataspace!", rank, Mrank);
141 puts("Set DATAPACE: Inconsistent rank!");
142 return 0;
143 }
144 }
145
146 current_rank = F5LAget_dimensions(f->Topology_hid,
148 current_dims);
149
150 if (current_rank>0)
151 {
152 if (rank != current_rank)
153 {
154 puts("Set DATAPACE: Inconsistent rank!");
155 return 0;
156 }
157
158 for(i=0; i<rank; i++)
159 {
160 if (current_dims[i] < dims[i])
161 current_dims[i] = dims[i];
162 }
163 }
164 else
165 for(i=0; i<rank; i++)
166 current_dims[i] = dims[i];
167
169 F5printf(30, "F5LTexpand_dataspace(,rank=%d,): expand dimensions of topology.", rank);
170
171 for(i=0; i<rank; i++)
172 dims[i] = current_dims[i];
173
174 return 1;
175}
long F5Aget_ints(hid_t loc_id, const char *name, int *data, hsize_t n)
Definition F5A.c:406
#define FIBER_FIELD_DATASPACE_DIMENSIONS_ATTRIBUTE
Definition F5defs.h:153
#define FIBER_HDF5_RANK_ATTRIBUTE
Definition F5defs.h:147
int F5LAget_dimensions(hid_t Field_id, const char *aname, hsize_t dims[FIBER_MAX_RANK])
Definition F5A.c:233
hid_t Topology_hid
Definition F5Path.h:57

References F5Aget_ints(), F5LAget_dimensions(), F5LAsave_dimensions(), F5printf, FIBER_FIELD_DATASPACE_DIMENSIONS_ATTRIBUTE, FIBER_HDF5_RANK_ATTRIBUTE, FIBER_MAX_RANK, and F5Path::Topology_hid.

Referenced by F5Fexpand_dataspace().

◆ F5LTget_skeleton_dimensionality()

F5_API int F5LTget_skeleton_dimensionality ( hid_t Top_hid)

Definition at line 34 of file F5LT.c.

35{
37 if (F5Aget_ints(Top_hid, FIBER_HDF5_SKELETON_DIMENSIONALITY_ATTRIB, &result, 1) <= 0)
38 F5printf(5," *Warning* F5LTget_F5LTget_skeleton_dimensionality() could not find skeleton dimensionality,setting unknown -1");
39
40 return result;
41}
#define FIBER_HDF5_SKELETON_DIMENSIONALITY_ATTRIB
Definition F5defs.h:256
#define FIBER_HDF5_INVALID_SKELETON_DIMENSIONALITY
Definition F5defs.h:261

References F5Aget_ints(), F5printf, FIBER_HDF5_INVALID_SKELETON_DIMENSIONALITY, and FIBER_HDF5_SKELETON_DIMENSIONALITY_ATTRIB.

Referenced by F5iterate_topologies().

◆ F5LTset_dataspace()

F5_API int F5LTset_dataspace ( F5Path * f,
int rank,
hsize_t * dims )

Definition at line 43 of file F5LT.c.

44{
45hsize_t current_dims[FIBER_MAX_RANK];
46int current_rank, Mrank = -1;
47
48 if (!f)
49 {
50 return 0;
51 }
52
53 F5printf(30, "F5LTset_dataspace(,rank=%d,)", rank);
54
56 if (Mrank<0)
57 {
58 F5printf(30, "F5LTset_dataspace(,%d,): INVALID FILE: RANK attribute is not integer - cannot set dataspace!", rank);
59 return 0;
60 }
61
62 if (Mrank>=1)
63 {
64 if (Mrank != rank)
65 {
66 if (rank==4)
67 F5printf(0, "F5LTset_dataspace(,%d,): Dimensions %dx%dx%dx%d incompatible with RANK attribute %d - inconsistent dataspace!",
68 rank, (int)dims[0],(int)dims[1],(int)dims[2],(int)dims[3],
69 Mrank);
70 else
71 F5printf(0, "F5LTset_dataspace(,%d,): Dimensions incompatible with RANK attribute %d - inconsistent dataspace!", rank, Mrank);
72
73 return 0;
74 }
75 }
76
77 current_rank = F5LAget_dimensions(f->Topology_hid,
79 current_dims);
80
81 if (current_rank>0)
82 {
83 int i;
84 if (rank != current_rank)
85 {
86 puts("F5LTset_dataspace(): Set DATAPACE: Inconsistent rank with DATASPACE_DIMENSIONS!");
87 return 0;
88 }
89
90 for(i=0; i<rank; i++)
91 {
92 if (current_dims[i] != dims[i])
93 {
94 F5printf(5, "F5LTset_dataspace(,rank=%d,): new dimensions[%d] is %d, but already set to %d in the file as %dx%dx%dx%d - aborting.",
95 rank, i, (int)(current_dims[i]), (int)(dims[i]),
96 rank>0?(int)dims[0]:1, rank>1?(int)dims[1]:1, rank>2?(int)dims[2]:1, rank>3?(int)dims[3]:1);
97 return 0;
98 }
99 }
100 F5printf(5, "F5LTset_dataspace(,rank=%d,): dimensions are ok.", rank);
101 return 1;
102 }
103 {int i;
104 for(i=0; i<rank; i++)
105 {
106 if (dims[i] < 1)
107 {
108 F5printf(10, "F5LTset_dataspace(,rank=%d,): do NOT set new topology dimensions, because dims[%d]=%d\n", rank, i, (int)dims[i] );
109 return 0;
110 }
111 }
112 }
113
115 F5printf(30, "F5LTset_dataspace(,rank=%d,): set new dimensions to skeleton as %dx%dx%dx%d.", rank,
116 rank>0?(int)dims[0]:1, rank>1?(int)dims[1]:1, rank>2?(int)dims[2]:1, rank>3?(int)dims[3]:1);
117 return 1;
118}

References F5Aget_ints(), F5LAget_dimensions(), F5LAsave_dimensions(), F5printf, FIBER_FIELD_DATASPACE_DIMENSIONS_ATTRIBUTE, FIBER_HDF5_RANK_ATTRIBUTE, FIBER_MAX_RANK, and F5Path::Topology_hid.

Referenced by F5Fcreate(), F5FSwrite_fraction(), F5Fwrite_flexible(), F5Fwrite_fraction(), F5Fwrite_fraction_external(), F5Fwrite_fractionS(), F5Fwrite_linear(), F5FwriteIMAGE(), F5Fwrites(), and F5FwriteX().

◆ F5Tget_extent()

F5_API int F5Tget_extent ( F5Path * f,
hsize_t * dims,
int maxDims )

Get the extent (number of elements in each dimension) for a given F5 field. This function is like getting the data space via F5Tget_space() and then performing a F5Tpermute_dimensions() on the result.

Parameters
dimsStorage place for the extension in each dimension.
maxDimsThe maximal number of storage available for the dims array
Returns
The dimension of the current topology.

It is recommended to allocate the storage as

hsize_t dims[FIBER_MAX_RANK];

where FIBER_MAX_RANK is a predefined integer constant from the F5 library which corresponds to the respective HDF5 value.

Todo
Add weblink here to HDF5 docu.

Definition at line 226 of file F5F.c.

227{
228hsize_t mdims[FIBER_MAX_RANK], Dims[FIBER_MAX_RANK];
229int mrank;
230hid_t space_id = F5Tget_space(f);
231
232
233 if (space_id<0)
234 return 0;
235
236 mrank = H5Sget_simple_extent_dims(space_id, mdims, NULL);
237
238 H5Sclose(space_id);
239
240 F5Tpermute_dimensions(f, mrank, Dims, mdims);
241
242 if (mrank>maxDims)
243 mrank = maxDims;
244
245
246 {int i;
247 for(i=0; i<mrank; i++)
248 dims[i] = Dims[i];
249 }
250
251 return mrank;
252}
hid_t F5Tget_space(F5Path *f)
Definition F5F.c:167

References F5Tget_space(), F5Tpermute_dimensions(), and FIBER_MAX_RANK.

◆ F5Tget_index_depth()

F5_API int F5Tget_index_depth ( F5Path * f,
int * result )
Parameters
resultpointer to integer which will contain the result value on return.
Returns
non-zero when attribute cold be read, zero if not.

Definition at line 255 of file F5F.c.

256{
257 F5printf(40, "F5Fget_index_depth()");
258
259 if (!f)
260 return 0;
261
262 if (f->Topology_hid<0)
263 return 0;
264
267 result, 1) != 1)
268 {
269 F5printf(40, "F5Fget_index_depth(): could not read index depth attribute");
270 return 0;
271 }
272
273 return 1;
274}
#define FIBER_HDF5_INDEXDEPTH_ATTRIB
Definition F5defs.h:228

References F5Aget_ints(), F5printf, FIBER_HDF5_INDEXDEPTH_ATTRIB, and F5Path::Topology_hid.

◆ F5Tget_refinement_level()

F5_API int F5Tget_refinement_level ( F5Path * f,
hsize_t * dims,
int maxDims )

References F5_API.

◆ F5Tpermute_dimensions()

F5_API hsize_t * F5Tpermute_dimensions ( F5Path * fpath,
int rank,
hsize_t * target_dims,
const hsize_t * source_dims )

Permute a given dimensions array according to the memory ordering of the current coordinate system.

Parameters
source_dimsThe source dimensions.
target_dimsThe target dimensions array, may be identical to the source dimensions array.
Returns
A pointer to the target dimensions array, if successfull, otherwise NULL.
Parameters
fpathAn F5Path object that must contain a valid coordinate system description, e.g. via some F5Rcreate() operation.

Definition at line 277 of file F5F.c.

281{
282int ChartDims;
283 F5printf(50, "F5Tpermute_dimensions()");
284
285 /* added by mr, not sure if this is good */
286 if( !target_dims || !source_dims)
287 {
288 F5printf(40, "F5Tpermute_dimensions() Invalid target or source");
289 return NULL;
290 }
291
292 {
293 int i = 0;
294 for(i=0; i<rank; i++)
295 if (source_dims[i]) break;
296
297 if (i==rank)
298 {
299 for(i=0; i<rank; i++)
300 target_dims[i] = source_dims[i];
301
302 F5printf(40, "F5Tpermute_dimensions() All source data are zero, skipping permutation...");
303 return target_dims;
304 }
305 }
306
307 if (!fpath || !fpath->myChart)
308 {
309 F5printf(50, "F5Tpermute_dimensions() No Chart given, assuming default (FORTRAN) index permutation!");
310 return F5B_permute_dimensions(target_dims, rank, source_dims, NULL, 0);
311 }
312 F5printf(50, "F5Tpermute_dimensions() params ok, rank=%d.", rank);
313 for(int i=0; i<rank; i++)
314 F5printf(50, "F5Tpermute_dimensions() source[%d]=%d.", i, source_dims[i] );
315
316/* cannot occur because perm_vector is static member
317 if (!fpath->myChart->perm_vector )
318 {
319 F5printf(10, "F5Tpermute_dimensions() has no permutation vector!");
320 return NULL;
321 }
322*/
323 ChartDims = F5Bget_chart_dims(fpath->myChart);
324
325 return F5B_permute_dimensions(target_dims, rank, source_dims, fpath->myChart->perm_vector, ChartDims );
326}
int F5Bget_chart_dims(const ChartDomain_IDs *IDs)
Definition F5Bchart.c:899
hsize_t * F5B_permute_dimensions(hsize_t *target_dims, int rank, const hsize_t *source_dims, int perm_vector[FIBER_MAX_RANK], int perm_vector_size)
Definition F5Bchart.c:72

References F5_API, F5B_permute_dimensions(), F5Bget_chart_dims(), F5printf, F5Path::myChart, and ChartDomain_IDs::perm_vector.

Referenced by F5Fexpand_dataspace(), F5Fread_linear(), F5Fread_linear_fragment(), F5FSwrite_fraction(), F5Fwrite_flexible(), F5Fwrite_fraction(), F5Fwrite_fraction_external(), F5Fwrite_fractionS(), F5Fwrite_linear(), F5Fwrite_linear_fraction(), F5Fwrite_linear_fraction_overlap(), F5FwriteIMAGE(), F5Fwrites(), F5FwriteX(), and F5Tget_extent().