FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
Iterator Functions

Typedefs

typedef herr_t F5_iterate_representations_t(F5Path *Representation, void *operator_data, const char *Representer_name, F5Path *RepresentationTarget)
typedef herr_t F5_iterate_timeslices_t(F5Path *path, double time, void *user_data)
typedef herr_t F5_iterate_grids_t(F5Path *F5Grid, const char *gridname, void *user_data)
typedef herr_t F5_iterate_topologies_t(F5Path *field, const char *topologyname, int index_depth, int topological_dimension, void *operator_data)
typedef herr_t F5_iterate_fields_t(F5Path *field, const char *fieldname, void *operator_data, const char *representer_name)
typedef int F5_fieldtype_t(hid_t type_id)
typedef herr_t F5_iterate_grid_atlas_t(F5Path *grid, const char *coordinate_name, hid_t global_chart_hid, hid_t domain_group_hid, void *operator_data)
typedef herr_t F5_iterate_grids_per_bundle_t(hid_t file_id, hid_t gridinfo_id, const char *gridname, void *user_data)
typedef herr_t F5_iterate_gridevolution_per_bundle_t(hid_t file_id, const char *gridname, double time, const char *slicename, void *user_data)
F5_API int F5Iignore (const char *s)
F5_API int F5iterate_paramspace (hid_t file_id, int *idx, const F5ParameterSpace *selection, F5_iterate_paramspace_t *callback, void *user_data)
F5_API int F5iterate_timeslices (hid_t file_id, hsize_t *idx, F5_iterate_timeslices_t *callback, void *user_data)
F5_API int F5iterate_grids (F5Path *F5Slice, int *idx, F5_iterate_grids_t *callback, void *operator_data, F5_gridproperty_t **gridtypes, const char *coordinate_system)
F5_API int F5iterate_topologies (F5Path *grid, int *idx, F5_iterate_topologies_t *callback, void *operator_data)
F5_API int F5iterate_representations (F5Path *skeleton, int *idx, F5_iterate_representations_t *callback, void *operator_data)
F5_API int F5iterate_fields (F5Path *representation, int *idx, const char *representer_name, F5_iterate_fields_t *callback, void *operator_data)
F5_API int F5iterate_vertex_fields (F5Path *grid, int *idx, F5_iterate_fields_t *callback, void *operator_data, const char *coordinate_system, F5_fieldtype_t *what)
F5_API int F5iterate_topology_fields (F5Path *skeleton, int *idx, F5_iterate_fields_t *callback, void *operator_data, const char *coordinate_system, F5_fieldtype_t *what)
F5_API int F5has_standard_vertex_fields (F5Path *grid)
F5_API int F5iterate_grids_per_bundle (hid_t file_id, int *idx, F5_iterate_grids_per_bundle_t *callback, void *user_data)
F5_API int F5iterate_gridevolution (hid_t file_id, int *idx, F5_iterate_gridevolution_per_bundle_t *callback, void *user_data, F5_iterate_grids_per_bundle_t *gridinfo)

Detailed Description

Synopsis:

  1. Open a file
  2. Call F5iterate_timeslices() on it
  3. Let the timeslice callback function call F5iterate_grids()
  4. Let the grid callback function call F5iterate_vertex_fields() if you are interested in all available vertex-related fields.

The current implementation status only allows to scan all fields given on the default Topology of Grid objects.

Typedef Documentation

◆ F5_fieldtype_t

typedef int F5_fieldtype_t(hid_t type_id)

Prototype of a function that allows only certain types.

Definition at line 164 of file F5iterate.h.

◆ F5_iterate_fields_t

typedef herr_t F5_iterate_fields_t(F5Path *field, const char *fieldname, void *operator_data, const char *representer_name)

Called per grid function.

Parameters
field_idThe HDF5 ID of the respective field. Note that it may be an HDF5 group ID or a dataset ID. Call H5Gclose() or H5Dclose() in the iterator function.
representer_nameThe name of the containing group where this field resides.

Definition at line 145 of file F5iterate.h.

◆ F5_iterate_grid_atlas_t

typedef herr_t F5_iterate_grid_atlas_t(F5Path *grid, const char *coordinate_name, hid_t global_chart_hid, hid_t domain_group_hid, void *operator_data)
Parameters
gridAn F5Path pointing to the current grid with its members myChart and FileIDs being defined.

Definition at line 186 of file F5iterate.h.

◆ F5_iterate_gridevolution_per_bundle_t

typedef herr_t F5_iterate_gridevolution_per_bundle_t(hid_t file_id, const char *gridname, double time, const char *slicename, void *user_data)

Callback function type for F5iterate_gridevolution().

Parameters
file_idThe HDF5 file ID.
gridnameThe name of the current grid under investigation.
timeThe time at which this grid exists.
slicenameThe name of the time slice group where this grid resides in.

Definition at line 229 of file F5iterate.h.

◆ F5_iterate_grids_per_bundle_t

typedef herr_t F5_iterate_grids_per_bundle_t(hid_t file_id, hid_t gridinfo_id, const char *gridname, void *user_data)

The iterator function that is called for each grid that is found in the file.

See also
F5iterate_grids_per_bundle().

Definition at line 212 of file F5iterate.h.

◆ F5_iterate_grids_t

typedef herr_t F5_iterate_grids_t(F5Path *F5Grid, const char *gridname, void *user_data)

The iterator callback function that is called for each grid of a time slice that fullfills the specified grid property.

See also
F5iterate_grids().
Parameters
F5GridAn F5 path with a valid Grid identifier.

Definition at line 81 of file F5iterate.h.

◆ F5_iterate_representations_t

typedef herr_t F5_iterate_representations_t(F5Path *Representation, void *operator_data, const char *Representer_name, F5Path *RepresentationTarget)
Parameters
RepresentationThe F5Path to the currently traversed Represention
RepresentationTargetThe location of the Representer if its from another Grid. ()

Definition at line 432 of file F5iterate.c.

◆ F5_iterate_timeslices_t

typedef herr_t F5_iterate_timeslices_t(F5Path *path, double time, void *user_data)

The iterator function that is called for each time slice.

See also
F5iterate_timeslices().
Parameters
slice_idAn HDF5 group identifier. Call H5Gclose() in the iterater function.

Definition at line 66 of file F5iterate.h.

◆ F5_iterate_topologies_t

typedef herr_t F5_iterate_topologies_t(F5Path *field, const char *topologyname, int index_depth, int topological_dimension, void *operator_data)

The call back function that will be invoked by F5iterate_topologies(). It traverses all Skeletons of a Grid object.

Parameters
index_depthThe number of "hops" that are required to go from the elements described in this group to vertex coordinates in a chart.
topological_dimensionThe dimension of the k-cells that are stored within this Skeleton group.

Definition at line 106 of file F5iterate.h.

Function Documentation

◆ F5has_standard_vertex_fields()

F5_API int F5has_standard_vertex_fields ( F5Path * grid)

Check whether this grid object has some fields in the standard vertex topology, i.e. an Points/ entry.

Definition at line 278 of file F5iterate.c.

279{
280hid_t Gid;
281 if (!grid) return 0;
282
283 H5E_BEGIN_TRY
284 Gid = H5Gopen2(grid->Grid_hid, FIBER_HDF5_POINTS, H5P_DEFAULT);
285 H5E_END_TRY
286
287 if (Gid>0)
288 {
289 H5Gclose(Gid);
290 return 1;
291 }
292 return 0;
293}
#define FIBER_HDF5_POINTS
Definition F5defs.h:55
#define H5Gclose(x)
Definition F5X.h:144
hid_t Grid_hid
Definition F5Path.h:53

References FIBER_HDF5_POINTS, F5Path::Grid_hid, and H5Gclose.

◆ F5Iignore()

F5_API int F5Iignore ( const char * s)

Simple (mostly internal) helper function to detect which attributes or groups shall be ignored generally. F5 ignores all groups starting with a dot or underline. Normally this function will not be used by application code.

Returns
non-zero if the string shall be ignored.
Note
returns true if the string is invalid (i.e.: "ignore invalid strings")

Definition at line 18 of file F5iterate.c.

19{
20 if (!s) return 1;
21 if (*s == '.') return 1;
22 if (*s == '_') return 1;
23 return 0;
24}

◆ F5iterate_fields()

F5_API int F5iterate_fields ( F5Path * representation,
int * idx,
const char * representer_name,
F5_iterate_fields_t * callback,
void * operator_data )

Traverses all fields per representation. Typically invoked by the callback function of F5iterate_representations().

See also
Higher level functionality provided by F5iterate_vertex_fields() and F5iterate_topology_fields().
Parameters
representer_nameThe name of the representation group, as come callbacks want to know this.

Definition at line 582 of file F5iterate.c.

585{
586struct VertexFieldParams That;
587 That.callback = callback;
588 That.operator_data = operator_data;
589 That.path = representation;
590 That.what = 0;
591 That.coordinate_system = representer_name;
592
593 return H5Giterate(representation->Representation_hid, ".", idx, H5G_iterate_vertex_fields, &That);
594}
hid_t Representation_hid
Definition F5Path.h:58
F5_iterate_fields_t * callback
Definition F5iterate.c:224

References VertexFieldParams::callback, VertexFieldParams::coordinate_system, VertexFieldParams::operator_data, VertexFieldParams::path, F5Path::Representation_hid, and VertexFieldParams::what.

◆ F5iterate_gridevolution()

F5_API int F5iterate_gridevolution ( hid_t file_id,
int * idx,
F5_iterate_gridevolution_per_bundle_t * callback,
void * user_data,
F5_iterate_grids_per_bundle_t * gridinfo )
Parameters
gridinfoOptional per-grid callback function. May be just NULL.

Definition at line 1372 of file F5iterate.c.

1374{
1376 That.callback = callback;
1377 That.user_data = user_data;
1378 That.file_id = file_id;
1379 That.gridinfo = gridinfo;
1380
1381 F5printf(100, "F5iterate_gridevolution() before F5iterate_grids");
1382int ok = F5iterate_grids_per_bundle(file_id, idx, my_grids_per_bundle, &That);
1383 F5printf(100, "F5iterate_gridevolution() after F5iterate_grids");
1384 return ok;
1385}
return ok
Definition F5P.c:95
#define F5printf(verbosity,...)
Definition F5private.h:60
int F5iterate_grids_per_bundle(hid_t file_id, int *idx, F5_iterate_grids_per_bundle_t *callback, void *user_data)
Definition F5iterate.c:1145
F5_iterate_grids_per_bundle_t * gridinfo
Definition F5iterate.c:1183
F5_iterate_gridevolution_per_bundle_t * callback
Definition F5iterate.c:1182

References F5iterate_gridevolution_struct::callback, F5iterate_grids_per_bundle(), F5printf, F5iterate_gridevolution_struct::file_id, F5iterate_gridevolution_struct::gridinfo, ok, my_grids_per_bundle_emulate_via_timeslice_struct::That, and F5iterate_gridevolution_struct::user_data.

◆ F5iterate_grids()

F5_API int F5iterate_grids ( F5Path * F5Slice,
int * idx,
F5_iterate_grids_t * callback,
void * operator_data,
F5_gridproperty_t ** gridtypes,
const char * coordinate_system )

Iterate over all grids within a slice.

Parameters
gridtypesNULL-terminated array of grid property functions. May be NULL to retrieve all grids.
coordinate_systemThe coordinate system in which to check for grid properties. E.g. a grid may be uniform in one coordinate system, but is just regular in another one. May be NULL to specify the default cartesian coordinate system.
F5SliceAn F5 path with a valid slice identifier.

Definition at line 206 of file F5iterate.c.

208{
209struct IterateGrids That;
210 That.callback = callback;
211 That.operator_data = operator_data;
212 That.gridtypes = gridtypes;
214 That.path = slice;
215
216 F5printf(100, "F5iterate_grids()");
217 return H5Giterate(slice->Slice_hid, ".", idx, H5G_iterate_grids, &That);
218}
#define FIBER_HDF5_DEFAULT_CHART
Definition F5defs.h:74
F5_gridproperty_t ** gridtypes
Definition F5iterate.c:164
const char * coordinate_system
Definition F5iterate.c:166
F5_iterate_grids_t * callback
Definition F5iterate.c:162
void * operator_data
Definition F5iterate.c:163

References IterateGrids::callback, IterateGrids::coordinate_system, F5printf, FIBER_HDF5_DEFAULT_CHART, IterateGrids::gridtypes, IterateGrids::operator_data, IterateGrids::path, and F5Path::Slice_hid.

◆ F5iterate_grids_per_bundle()

F5_API int F5iterate_grids_per_bundle ( hid_t file_id,
int * idx,
F5_iterate_grids_per_bundle_t * callback,
void * user_data )

Iterate over all grids slices within a file.

Definition at line 1145 of file F5iterate.c.

1146{
1147hid_t TableOfContents, Grids;
1148int nGrids = 0;
1150
1151 That.callback = callback;
1152 That.operator_data = user_data;
1153 That.file_id = file_id;
1154
1155 TableOfContents = F5Gtry_to_open(file_id, FIBER_CONTENTS );
1156 if (TableOfContents < 1)
1157 {
1158 F5printf(1, "No table of contents? This must be an ancient file...");
1159#ifdef F5_BACKWARD_COMPATIBILITY
1160 return H5Giterate(file_id, "/", idx, H5G_iterate_grids_per_bundle_via_timeslices, &That);
1161#else
1162 return -1;
1163#endif
1164 }
1165
1166 Grids = F5Gtry_to_open( TableOfContents, FIBER_CONTENT_GRIDS );
1167 H5Gclose( TableOfContents );
1168
1169 if (Grids < 0)
1170 return 0;
1171
1172 F5printf(100, "F5iterate_grid_per_bundle()");
1173 nGrids = H5Giterate(Grids, ".", idx, H5G_iterate_grids_per_bundle, &That);
1174 H5Gclose( Grids );
1175 F5printf(100, "after H5Giterate");
1176
1177 return nGrids;
1178}
#define FIBER_CONTENTS
Definition F5defs.h:23
#define FIBER_CONTENT_GRIDS
Definition F5defs.h:24
hid_t F5Gtry_to_open(hid_t location, const char *name)
Definition F5X.c:297
F5_iterate_grids_per_bundle_t * callback
Definition F5iterate.c:1099

References H5G_iterate_grids_per_bundle_struct::callback, F5Gtry_to_open(), F5printf, FIBER_CONTENT_GRIDS, FIBER_CONTENTS, H5G_iterate_grids_per_bundle_struct::file_id, H5Gclose, and H5G_iterate_grids_per_bundle_struct::operator_data.

Referenced by F5iterate_gridevolution().

◆ F5iterate_paramspace()

F5_API int F5iterate_paramspace ( hid_t file_id,
int * idx,
const F5ParameterSpace * selection,
F5_iterate_paramspace_t * callback,
void * user_data )
Todo
Implement, and reformulate F5iterate_timeslices() via this function.

References F5_API.

◆ F5iterate_representations()

F5_API int F5iterate_representations ( F5Path * skeleton,
int * idx,
F5_iterate_representations_t * callback,
void * operator_data )

Traverses all Representations per skeleton. Typically invoked by the callback function of F5iterate_topologies() .

Definition at line 465 of file F5iterate.c.

466{
467/*hid_t local_chart_hid = 0;*/
468struct DomainParams That;
469
471 {
472 F5printf(10, "F5iterate_representations(): No Topology ID!");
473 return 0;
474 }
476 {
477 F5printf(10, "F5iterate_representations(): No Representation ID!");
478 return 0;
479 }
480
481
482 F5printf(30, "F5iterate_representations()");
483
484 That.callback = callback;
485 That.operator_data = operator_data;
486 That.skeleton = skeleton;
487
488 return H5Giterate(skeleton->Topology_hid, ".", idx, H5G_iterate_representations, &That);
489
490#if 0
491 if (!coordinate_system) coordinate_system = FIBER_HDF5_DEFAULT_CHART;
492 That.what = what;
493
494 F5printf(40, "F5iterate_topology_fields(coordinate_system=%s)\n", coordinate_system);
495
496 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
497 if (grid->Representation_hid<0)
498 {
499 if (strcmp(coordinate_system, FIBER_HDF5_DEFAULT_CHART)==0)
500 {
501 coordinate_system = FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART;
502 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
503 }
504 if (grid->Representation_hid<0)
505 {
506 if (strcmp(coordinate_system, FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART)==0)
507 {
508 coordinate_system = "CartesianChart3D";
509 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
510 }
511 if (grid->Representation_hid<0)
512 {
513 F5printf(10, "F5iterate_topology_fields(): Open Coordinate system `%s' failed!",
514 coordinate_system );
515
516 /*
517 // Reset representation ID to zero, indicating that it is not open in the F5Path
518 // Alternatively, we could check for negative values also in F5close() and use
519 // negative values for allowing to detect errors more specifically. Currently,
520 // we don't distinguish among not-yet-opened and not-opened-due-to-error cases.
521 // Then, application code can just check for zero, makes things easier.
522 // More future-safe could would check for positiveness.
523 */
524 grid->Representation_hid = 0;
525 return 0;
526 }
527 }
528 }
529
530 /* check if charts per grid are already available? */
531 if (grid->Charts_hid)
532 Cgrids = grid->Charts_hid;
533 else
534 {
535 grid->Charts_hid = H5Gopen2(grid->Grid_hid , FIBER_HDF5_CHARTS_PER_GRID, H5P_DEFAULT);
536 if (grid->Charts_hid <0)
537 {
538 puts("ERROR: F5iterate_topology_fields(): Opening charts per grid (\""FIBER_HDF5_CHARTS_PER_GRID"\" FAILED");
539 }
540 }
541
542 local_chart_hid = grid->Chart_hid;
543 grid->Chart_hid = F5Gtry_to_open(grid->Charts_hid , coordinate_system);
544 if (grid->Chart_hid < 0 && strcmp(coordinate_system, FIBER_HDF5_DEFAULT_CHART)==0)
545 {
546 grid->Chart_hid = F5Gtry_to_open(grid->Charts_hid, FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART);
547 }
548 if (grid->Chart_hid < 0)
549 {
550 F5printf(10, "F5iterate_topology_fields(): Could not open chart description for `%s'!",
551 coordinate_system );
552 }
553
554 F5printf(100, " F5iterate_topology_fields() --> iterate vertex fields");
555 That.coordinate_system = coordinate_system;
556 retval = H5Giterate(grid->Representation_hid, ".", idx, H5G_iterate_vertex_fields, &That);
557 H5Gclose( grid->Representation_hid );
558 /* if we had no charts per grid opened, close them here again. */
559 if (!Cgrids)
560 {
561 H5Gclose(grid->Charts_hid);
562 grid->Charts_hid = 0;
563 }
564 if (grid->Chart_hid> 0)
565 H5Gclose( grid->Chart_hid );
566
567 grid->Representation_hid = 0;
568 grid->Chart_hid = local_chart_hid;
569
570/*
571 if (retval<0)
572 {
573 fprintf(stderr, "F5iterate_topology_fields(): Iteration error\n");
574 }
575*/
576 return retval;
577#endif
578}
#define FIBER_HDF5_CHARTS_PER_GRID
Definition F5defs.h:110
#define FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART
Definition F5defs.h:88
F5_iterate_representations_t * callback
Definition F5iterate.c:439
F5Path * skeleton
Definition F5iterate.c:441
void * operator_data
Definition F5iterate.c:440
hid_t Topology_hid
Definition F5Path.h:57

References DomainParams::callback, F5Gtry_to_open(), F5printf, FIBER_HDF5_CHARTS_PER_GRID, FIBER_HDF5_DEFAULT_CHART, FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART, H5Gclose, DomainParams::operator_data, F5Path::Representation_hid, DomainParams::skeleton, and F5Path::Topology_hid.

◆ F5iterate_timeslices()

F5_API int F5iterate_timeslices ( hid_t file_id,
hsize_t * idx,
F5_iterate_timeslices_t * callback,
void * user_data )

Iterate over all time slices within a file.

Definition at line 105 of file F5iterate.c.

106{
108F5Path *myPath = F5Binitialize_path(file_id);
109int retval;
110
111 if (!myPath)
112 {
113 F5printf(1, "*F5iterate_timeslices(): Could not initialize F5 Path!");
114 return -1;
115 }
116
117 That.callback = callback;
118 That.operator_data = operator_data;
119 That.path = myPath;
120
121 F5printf(100, "F5iterate_timeslices()");
122
123#if 1
124 {
125 if (idx)
126 {
127 int Idx = *idx;
128 retval = H5Giterate(file_id, "/", &Idx, H5G_iterate_timeslices, &That);
129 *idx = Idx;
130 }
131 else
132 retval = H5Giterate(file_id, "/", 0, H5G_iterate_timeslices, &That);
133 }
134#else
135 {
136// herr_t herr = H5Literate(file_id, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE,
137 herr_t herr = H5Literate(file_id, H5_INDEX_NAME, H5_ITER_NATIVE,
138 idx, H5L_iterate_timeslices, &That);
139
140 if (herr<0)
141 {
142 F5printf(0, "F5iterate_timeslices(): iteration error");
143 retval = -1;
144 }
145 else
146 retval = 0;
147 }
148#endif
149 F5printf(100, "F5iterate_timeslices: H5iterate done.\n" );
150
151 F5close(myPath);
152 F5printf(100, "F5iterate_timeslices: F5close() done.\n" );
153 return retval;
154}
void F5close(F5Path *f)
Definition F5B.c:186
F5Path * F5Binitialize_path(hid_t File_id)
Definition F5B.c:156
F5_iterate_timeslices_t * callback
Definition F5iterate.c:28

References H5G_iterate_timeslices_struct::callback, F5Binitialize_path(), F5close(), F5printf, H5G_iterate_timeslices_struct::operator_data, and H5G_iterate_timeslices_struct::path.

◆ F5iterate_topologies()

F5_API int F5iterate_topologies ( F5Path * grid,
int * idx,
F5_iterate_topologies_t * callback,
void * operator_data )

Traverses all Skeletons of a Grid object. Usually it is invoked via F5iterate_grids() and invokes F5iterate_topology_fields();

Definition at line 689 of file F5iterate.c.

690{
691hid_t PointsID;
692int retval;
693struct TopologyParams That;
694
695 That.callback = callback;
696 That.operator_data = operator_data;
697 That.path = grid;
698 That.points_done = 0;
699 That.cells_done = 0;
700
701 assert( grid->Representation_hid == 0 );
702 assert( grid->Topology_hid == 0);
703 assert( grid->Charts_hid == 0 );
704 assert( grid->Chart_hid == 0 );
705
706 if (grid->Charts_hid) H5Gclose(grid->Charts_hid);
707
708 grid->Charts_hid = H5Gopen2(grid->Grid_hid , FIBER_HDF5_CHARTS_PER_GRID, H5P_DEFAULT);
709 if (grid->Charts_hid < 0)
710 {
711 F5printf(10, "F5iterate_topologies(): Opening Charts per Grid FAILED!");
712 puts("ERROR: Opening Charts Per Grid FAILED!");
713 }
714
715 H5E_BEGIN_TRY
716 PointsID = H5Gopen2(grid->Grid_hid, FIBER_HDF5_POINTS, H5P_DEFAULT);
717 H5E_END_TRY
718 // Backward compatibility
719 if (PointsID>0)
720 {
721 int skeleton_dimensionality = F5LTget_skeleton_dimensionality( PointsID );
722 if (FIBER_HDF5_INVALID_SKELETON_DIMENSIONALITY == skeleton_dimensionality)
723 {
724 F5printf(10, "F5iterate_topologies(): BACKWARD COMPATIBILITY MODE: Considering POINTS without skeleton dimensionality.");
725
726 That.path->Topology_hid = PointsID;
727 retval = That.callback(That.path, FIBER_HDF5_POINTS, 0, -1, That.operator_data);
728 That.path->Topology_hid = 0;
729 H5Gclose(PointsID);
730 That.points_done = 1;
731
732 H5E_BEGIN_TRY
733 PointsID = H5Gopen2(grid->Grid_hid, FIBER_HDF5_CELLS, H5P_DEFAULT);
734 H5E_END_TRY
735 if (PointsID>0)
736 {
737 F5printf(10, "F5iterate_topology_fields(): BACKWARD COMPATIBILITY MODE: Considering CELLS without skeleton dimensionality.");
738
739 That.path->Topology_hid = PointsID;
740 retval = That.callback(That.path, FIBER_HDF5_CELLS, 1, 2, That.operator_data);
741 That.path->Topology_hid = 0;
742 H5Gclose(PointsID);
743 That.cells_done = 1;
744 }
745 }
746 else
747 {
748 H5Gclose(PointsID);
749 }
750 }
751
752 F5printf(20, " F5iterate_topologies(): Iterate over all possible index depths on grid %d ", (int)grid->Grid_hid );
753
754 /* iterate over possible index depths */
755 for(That.do_index_depth = F5_MIN_INDEX_DEPTH; That.do_index_depth < F5_MAX_INDEX_DEPTH;
756 That.do_index_depth++)
757 {
758 F5printf(20, " F5iterate_topologies(): Checking skeletons of depth %d on grid %d ",
759 That.do_index_depth, (int)grid->Grid_hid );
760 retval = H5Giterate(grid->Grid_hid, ".", idx, H5G_iterate_topologies, &That);
761 }
762
763 if (grid->Charts_hid!=0)
764 H5Gclose( grid->Charts_hid );
765
766 grid->Charts_hid = 0;
767
768/*
769 if (retval<0)
770 {
771 fprintf(stderr, "F5iterate_topologies(): Iteration error\n");
772 }
773*/
774
775 return retval;
776}
F5_API int F5LTget_skeleton_dimensionality(hid_t Top_hid)
Definition F5LT.c:34
#define FIBER_HDF5_INVALID_SKELETON_DIMENSIONALITY
Definition F5defs.h:261
#define F5_MAX_INDEX_DEPTH
Definition F5defs.h:245
#define FIBER_HDF5_CELLS
Definition F5defs.h:57
#define F5_MIN_INDEX_DEPTH
Definition F5defs.h:239
hid_t Charts_hid
Definition F5Path.h:55
hid_t Chart_hid
Definition F5Path.h:56
void * operator_data
Definition F5iterate.c:608
F5_iterate_topologies_t * callback
Definition F5iterate.c:607

References TopologyParams::callback, TopologyParams::cells_done, F5Path::Chart_hid, F5Path::Charts_hid, TopologyParams::do_index_depth, F5_MAX_INDEX_DEPTH, F5_MIN_INDEX_DEPTH, F5LTget_skeleton_dimensionality(), F5printf, FIBER_HDF5_CELLS, FIBER_HDF5_CHARTS_PER_GRID, FIBER_HDF5_INVALID_SKELETON_DIMENSIONALITY, FIBER_HDF5_POINTS, F5Path::Grid_hid, H5Gclose, TopologyParams::operator_data, TopologyParams::path, TopologyParams::points_done, F5Path::Representation_hid, and F5Path::Topology_hid.

◆ F5iterate_topology_fields()

F5_API int F5iterate_topology_fields ( F5Path * skeleton,
int * idx,
F5_iterate_fields_t * callback,
void * operator_data,
const char * coordinate_system,
F5_fieldtype_t * what )

Iterate over an arbitrary topology group. The group ID grid->Topology_id must be a valid group ID when calling this function.

Definition at line 296 of file F5iterate.c.

298{
299int retval;
300hid_t Cgrids = 0;
301hid_t local_chart_hid = 0;
302struct VertexFieldParams That;
303
304 if (!grid->Topology_hid)
305 {
306 F5printf(10, "F5iterate_topology_fields(): No Topology ID!");
307 return 0;
308 }
309
310 F5printf(100, "F5iterate_topology_fields()");
311
312 That.callback = callback;
313 That.operator_data = operator_data;
314 That.path = grid;
316 That.what = what;
317
318 F5printf(40, "F5iterate_topology_fields(coordinate_system=%s)", coordinate_system);
319
320 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
321 if (grid->Representation_hid<0)
322 {
324 {
326 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
327 }
328 if (grid->Representation_hid<0)
329 {
331 {
332 coordinate_system = "CartesianChart3D";
333 grid->Representation_hid = F5Gtry_to_open(grid->Topology_hid, coordinate_system);
334 }
335 if (grid->Representation_hid<0)
336 {
337 F5printf(10, "F5iterate_topology_fields(): Open Coordinate system `%s' failed!",
339
340 /*
341 // Reset representation ID to zero, indicating that it is not open in the F5Path
342 // Alternatively, we could check for negative values also in F5close() and use
343 // negative values for allowing to detect errors more specifically. Currently,
344 // we don't distinguish among not-yet-opened and not-opened-due-to-error cases.
345 // Then, application code can just check for zero, makes things easier.
346 // More future-safe could would check for positiveness.
347 */
348 grid->Representation_hid = 0;
349 return 0;
350 }
351 }
352 }
353
354 /* check if charts per grid are already available? */
355 if (grid->Charts_hid)
356 Cgrids = grid->Charts_hid;
357 else
358 {
359 grid->Charts_hid = H5Gopen2(grid->Grid_hid , FIBER_HDF5_CHARTS_PER_GRID, H5P_DEFAULT);
360 if (grid->Charts_hid <0)
361 {
362 puts("ERROR: F5iterate_topology_fields(): Opening charts per grid (\""FIBER_HDF5_CHARTS_PER_GRID"\" FAILED");
363 }
364 }
365
366 local_chart_hid = grid->Chart_hid;
367 grid->Chart_hid = F5Gtry_to_open(grid->Charts_hid , coordinate_system);
368 if (grid->Chart_hid < 0 && strcmp(coordinate_system, FIBER_HDF5_DEFAULT_CHART)==0)
369 {
370 grid->Chart_hid = F5Gtry_to_open(grid->Charts_hid, FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART);
371 }
372 if (grid->Chart_hid < 0)
373 {
374 F5printf(10, "F5iterate_topology_fields(): Could not open chart description for `%s', no chart info available, but still iterating...!",
376 }
377
378 F5printf(30, " F5iterate_topology_fields() --> iterate vertex fields");
379 That.coordinate_system = coordinate_system;
380 retval = H5Giterate(grid->Representation_hid, ".", idx, H5G_iterate_vertex_fields, &That);
381 H5Gclose( grid->Representation_hid );
382 /* if we had no charts per grid opened, close them here again. */
383 if (!Cgrids)
384 {
385 if (grid->Charts_hid>0)
386 H5Gclose(grid->Charts_hid);
387 grid->Charts_hid = 0;
388 }
389 if (grid->Chart_hid> 0)
390 H5Gclose( grid->Chart_hid );
391
392 grid->Representation_hid = 0;
393 grid->Chart_hid = local_chart_hid;
394
395
396 if (retval<0)
397 {
398 F5printf(10, " F5iterate_topology_fields() --> Iteration error\n");
399 }
400
401
402 return retval;
403}
const char * coordinate_system
Definition F5iterate.c:228
F5_fieldtype_t * what
Definition F5iterate.c:226

References VertexFieldParams::callback, F5Path::Chart_hid, F5Path::Charts_hid, VertexFieldParams::coordinate_system, F5Gtry_to_open(), F5printf, FIBER_HDF5_CHARTS_PER_GRID, FIBER_HDF5_DEFAULT_CHART, FIBER_HDF5_DEPRECATED_OLD_DEFAULT_CHART, F5Path::Grid_hid, H5Gclose, VertexFieldParams::operator_data, VertexFieldParams::path, F5Path::Representation_hid, F5Path::Topology_hid, and VertexFieldParams::what.

Referenced by F5iterate_vertex_fields().

◆ F5iterate_vertex_fields()

F5_API int F5iterate_vertex_fields ( F5Path * grid,
int * idx,
F5_iterate_fields_t * callback,
void * operator_data,
const char * coordinate_system,
F5_fieldtype_t * what )

Iterate over all fields given on the vertices per grid in the specified coordinate system.

Parameters
whatFunction to select which field types are allowed. May be a NULL pointer to retrieve all fields on the grid.

Definition at line 405 of file F5iterate.c.

407{
408int retval;
409 if (!grid) return -1;
410
411 assert(grid->Topology_hid == 0);
412
413 H5E_BEGIN_TRY
414 grid->Topology_hid = H5Gopen2(grid->Grid_hid, FIBER_HDF5_POINTS, H5P_DEFAULT);
415 H5E_END_TRY
416
417 if (grid->Topology_hid<0)
418 {
419 grid->Topology_hid = 0;
420 return 0;
421 }
422 retval = F5iterate_topology_fields(grid, idx, callback, operator_data, coordinate_system, what);
423 H5Gclose( grid->Topology_hid );
424 grid->Topology_hid = 0;
425
426 return retval;
427}
int F5iterate_topology_fields(F5Path *grid, int *idx, F5_iterate_fields_t *callback, void *operator_data, const char *coordinate_system, F5_fieldtype_t *what)
Definition F5iterate.c:296

References VertexFieldParams::callback, VertexFieldParams::coordinate_system, F5iterate_topology_fields(), FIBER_HDF5_POINTS, F5Path::Grid_hid, H5Gclose, VertexFieldParams::operator_data, F5Path::Topology_hid, and VertexFieldParams::what.