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

Functions

F5_API F5ErrorCode F5write_particle_positions (hid_t fileID, double time, const char *name, const F5_vec3_point_t *Coords, int nCoords, const char *coordinate_system)
F5_API int F5write_particle_cartesian3Dv (hid_t file_id, double time, const char *gridname, const F5_vec3_point_t *Coords, int nCoords, const char *coordinate_system,...)
F5_API int F5write_particle_double_cartesian3Dv (hid_t File_id, double time, const char *gridname, const F5_point3_double_t *Coords, int nCoords, const char *coordinate_system,...)
F5_API int F5write_particle_cartesian3DvU (hid_t File_id, double time, const char *gridname, const F5_vec3_point_t *Coords, const char *CoordUnit, int nCoords, const char *coordinate_system,...)
F5_API void F5write_particle_positions_with_field_d (hid_t fileID, double time, const char *name, const F5_vec3_point_t *Coords, int nCoords, const double *data)
F5_API void F5write_polar_particle_positions (hid_t fileID, double time, const char *name, const F5_polar_point3_float_t *Coords, int nCoords)
F5_API void F5write_particle_positions3fv (hid_t fileID, double time, const char *name, const float *x, const float *y, const float *z, int nCoords)

Detailed Description

Function Documentation

◆ F5write_particle_cartesian3Dv()

F5_API int F5write_particle_cartesian3Dv ( hid_t File_id,
double time,
const char * gridname,
const F5_vec3_point_t * Coords,
int nCoords,
const char * coordinate_system,
... )

Write a bunch of data fields given on the same uniform cartesian grid. This variation of the uniform grid writer function uses a variable number of arguments list. Each field is defined by a triple of

  const char *fieldname
  hid_t fieldtype
  const void  *dataPtr

If either the fieldname or the dataPtr are NULL, then the traversal of the argument is terminated.

Parameters
coordinate_systemThe coordinate system. May be NULL to refer to a standard chart.
Returns
The number of successfully written fields.

Creates a grid object of a point cloud (vertices) and additional fields. Additional fields can be added in the ellipses ( ... ) by specifying the field name, the data type and the pointer to the data array: e.g.: ( ... ,"Velocity", F5T_VEC3_FLOAT, V, ,"Acceleration", F5T_VEC3_FLOAT, A, ... )

Definition at line 38 of file F5particles.c.

42{
43const char* fieldname;
44hid_t fieldtype;
45const void* dataPtr;
46va_list vl;
47int NumOfWrittenFields = 0;
48 //const char* unittype;
49
50 /* Create the Field */
51F5Path*f = F5Rcreate_cartesian_nD(File_id, time, gridname, 0, coordinate_system);
52
53 assert(f);
54
55hid_t creator_hid = H5Pcreate(H5P_DATASET_CREATE);
57
58 F5printf(20, "F5write_particle_cartesian3Dv(): write positional information");
59
60 rv = F5Fwrite_1D( f, FIBER_HDF5_POSITIONS_STRING, nCoords, F5T_COORD3_FLOAT, F5T_COORD3_FLOAT, Coords, H5P_DEFAULT);
61
62 /* Init the step through the argument list */
63 va_start(vl, coordinate_system);
64
65 F5printf(20, "F5write_particle_cartesian3Dv(): Step through the argument list");
66 /* Step through the argument list */
67 for(;;)
68 {
69 hid_t file_type;
70
71 /* Get the Name of the field */
72 fieldname = va_arg(vl, const char*);
73 if (fieldname == NULL) break;
74
75 /* Get the type of the field */
76 fieldtype = va_arg(vl, hid_t);
77 /* Get the pointer to the field */
78 dataPtr = va_arg(vl, const void*);
79 /* Get the unit of the field*/
80 //unittype = va_arg(vl, const void*);
81 if (dataPtr == NULL) break;
82
83 F5printf(20, "F5write_particle_cartesian3Dv(): write data for field %s", fieldname);
84
85 file_type = F5file_type(f, fieldtype);
86
87 /* Write the stuff */
88
89 /* WHY NOT USE F5Fwrite here?? */
91 fieldname, nCoords, file_type, 0, dataPtr,
92 F5LTmake_enum_type(f), creator_hid);
93
94 F5I_add_field(f, fieldname);
95 H5Dclose(f->Field_hid);
96 f->Field_hid = 0;
97 NumOfWrittenFields++;
98 }
99
100 /* Close the Step through */
101 va_end(vl);
102
103 H5Pclose(creator_hid);
104
105 /* Close the field */
106 F5close(f);
107
108 return NumOfWrittenFields;
109}
hid_t F5file_type(F5Path *fpath, hid_t fieldtype)
Definition F5Bchart.c:941
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 F5F.c:631
enum F5ErrorCode_type F5ErrorCode
Definition F5F.h:267
hid_t F5LTmake_enum_type(F5Path *fpath)
Definition F5LT.c:179
#define F5T_COORD3_FLOAT
#define FIBER_HDF5_POSITIONS_STRING
Definition F5defs.h:63
void F5I_add_field(F5Path *fpath, const char *fieldname)
Definition F5private.c:178
#define F5printf(verbosity,...)
Definition F5private.h:60
void F5close(F5Path *f)
Definition F5B.c:186
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
F5Path * F5Rcreate_cartesian_nD(hid_t File_id, double time, const char *gridname, int Dims, const char *coordinate_system)
Definition F5R.c:116
hid_t Representation_hid
Definition F5Path.h:58
hid_t Field_hid
Definition F5Path.h:59

References F5close(), F5file_type(), F5Fwrite_1D(), F5I_add_field(), F5LTmake_enum_type(), F5Lwrite1D(), F5printf, F5Rcreate_cartesian_nD(), F5T_COORD3_FLOAT, FIBER_HDF5_POSITIONS_STRING, F5Path::Field_hid, and F5Path::Representation_hid.

◆ F5write_particle_cartesian3DvU()

F5_API int F5write_particle_cartesian3DvU ( hid_t File_id,
double time,
const char * gridname,
const F5_vec3_point_t * Coords,
const char * CoordUnit,
int nCoords,
const char * coordinate_system,
... )

added unit support in convenience function

Definition at line 188 of file F5particles.c.

192{
193 const char* fieldname;
194 hid_t fieldtype;
195 const void* dataPtr;
196 va_list vl;
197 int NumOfWrittenFields = 0;
198 const char* unittype;
199
200
201 /* Create the Field */
202F5Path*f = F5Rcreate_cartesian_nD(File_id, time, gridname, 0, coordinate_system);
203
204hid_t creator_hid = H5Pcreate(H5P_DATASET_CREATE);
205
206 F5printf(20, "F5write_particle_cartesian3DvU(): write positional information");
207 F5Fwrite_1D( f, FIBER_HDF5_POSITIONS_STRING, nCoords, F5T_COORD3_FLOAT, F5T_COORD3_FLOAT, Coords, H5P_DEFAULT );
208
209 F5Fset_metric_unit_description(f, CoordUnit );
210
211#if 0
212 /* write the positional information.
213 yack. should use F5F functions here...!
214 */
215{
216hsize_t dims = nCoords;
217hid_t coord_ds = H5Screate_simple(1, &dims, NULL);
218hid_t id = F5Dappend(f->Representation_hid, FIBER_HDF5_POSITIONS_STRING, f->FileIDs->Point_hid_t, coord_ds, creator_hid);
219 H5Dwrite(id, f->FileIDs->Point_hid_t, H5S_ALL, H5S_ALL, H5P_DEFAULT, Coords);
220
221 f->Field_hid = id;
222 F5I_add_field(f, FIBER_HDF5_POSITIONS_STRING, FIBER_HDF5_SIMPLE_FIELD);
223 f->Field_hid = 0;
224 H5Dclose(id);
225 H5Sclose(coord_ds);
226}
227#endif
228
229 /* Init the step through the argument list */
230 va_start(vl, coordinate_system);
231
232 F5printf(20, "F5write_particle_cartesian3DvU(): Step through the argument list");
233 /* Step through the argument list */
234
235 for(;;)
236 {
237 hid_t file_type; // MSVC wants it to be at the beginning of the scope
238
239 F5printf(20, "F5write_particle_cartesian3DvU(): Step %d", NumOfWrittenFields);
240
241
242 /* Get the Name of the field */
243 fieldname = va_arg(vl, const char*);
244 /* Get the type of the field */
245 fieldtype = va_arg(vl, hid_t);
246 /* Get the pointer to the field */
247 dataPtr = va_arg(vl, const void*);
248 /* Get the unit of the field*/
249 unittype = (const char*)va_arg(vl, const void*);
250
251 /* Break? */
252 if ( (fieldname == NULL) || (dataPtr == NULL) || unittype == NULL )
253 break;
254
255 F5printf(20, "F5write_particle_cartesian3DvU(): write data");
256
257 file_type = F5file_type(f, fieldtype);
258
259 /* Write the stuff */
260
261 /* WHY NOT USE F5Fwrite here?? */
263 fieldname, nCoords, file_type, 0, dataPtr,
264 F5LTmake_enum_type(f), creator_hid);
265
266 F5I_add_field(f, fieldname);
267
268 F5Fset_metric_unit_description(f, unittype );
269
270 H5Dclose(f->Field_hid);
271
272
273
274 f->Field_hid = 0;
275
276 F5printf(20, "F5write_particle_cartesian3DvU():4 fieldid=%d", (int)f->Field_hid );
277 NumOfWrittenFields++;
278 }
279
280 /* Close the Step through */
281 va_end(vl);
282
283 H5Pclose(creator_hid);
284
285 /* Close the field */
286 F5close(f);
287
288 return NumOfWrittenFields;
289}
F5_API int F5Fset_metric_unit_description(F5Path *f, const char *unit)
Definition F5Fmeta.c:967
hid_t F5Dappend(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist_id)
Definition F5X.c:239
ChartDomain_IDs * FileIDs
Definition F5Path.h:35

References F5close(), F5Dappend(), F5file_type(), F5Fset_metric_unit_description(), F5Fwrite_1D(), F5I_add_field(), F5LTmake_enum_type(), F5Lwrite1D(), F5printf, F5Rcreate_cartesian_nD(), F5T_COORD3_FLOAT, FIBER_HDF5_POSITIONS_STRING, F5Path::Field_hid, F5Path::FileIDs, and F5Path::Representation_hid.

◆ F5write_particle_double_cartesian3Dv()

F5_API int F5write_particle_double_cartesian3Dv ( hid_t File_id,
double time,
const char * gridname,
const F5_point3_double_t * Coords,
int nCoords,
const char * coordinate_system,
... )

Definition at line 111 of file F5particles.c.

115{
116const char* fieldname;
117hid_t fieldtype;
118const void* dataPtr;
119va_list vl;
120int NumOfWrittenFields = 0;
121 //const char* unittype;
122
123 /* Create the Field */
124F5Path*f = F5Rcreate_cartesian_nD(File_id, time, gridname, 0, coordinate_system);
125
126 assert(f);
127
128hid_t creator_hid = H5Pcreate(H5P_DATASET_CREATE);
129F5ErrorCode rv;
130
131 F5printf(20, "F5write_particle_cartesian3Dv(): write positional information");
132
133 rv = F5Fwrite_1D( f, FIBER_HDF5_POSITIONS_STRING, nCoords, F5T_COORD3_DOUBLE, F5T_COORD3_DOUBLE, Coords, H5P_DEFAULT);
134
135 /* Init the step through the argument list */
136 va_start(vl, coordinate_system);
137
138 F5printf(20, "F5write_particle_cartesian3Dv(): Step through the argument list");
139 /* Step through the argument list */
140 for(;;)
141 {
142 hid_t file_type;
143
144 /* Get the Name of the field */
145 fieldname = va_arg(vl, const char*);
146 /* Get the type of the field */
147 fieldtype = va_arg(vl, hid_t);
148 /* Get the pointer to the field */
149 dataPtr = va_arg(vl, const void*);
150 /* Get the unit of the field*/
151 //unittype = va_arg(vl, const void*);
152
153 /* Break? */
154 if ( (fieldname == NULL) || (dataPtr == NULL) )
155 break;
156
157 F5printf(20, "F5write_particle_cartesian3Dv(): write data");
158
159 file_type = F5file_type(f, fieldtype);
160
161 /* Write the stuff */
162
163 /* WHY NOT USE F5Fwrite here?? */
165 fieldname, nCoords, file_type, 0, dataPtr,
166 F5LTmake_enum_type(f), creator_hid);
167
168 F5I_add_field(f, fieldname);
169 H5Dclose(f->Field_hid);
170 f->Field_hid = 0;
171 NumOfWrittenFields++;
172 }
173
174 /* Close the Step through */
175 va_end(vl);
176
177 H5Pclose(creator_hid);
178
179 /* Close the field */
180 F5close(f);
181
182 return NumOfWrittenFields;
183}
#define F5T_COORD3_DOUBLE

References F5close(), F5file_type(), F5Fwrite_1D(), F5I_add_field(), F5LTmake_enum_type(), F5Lwrite1D(), F5printf, F5Rcreate_cartesian_nD(), F5T_COORD3_DOUBLE, FIBER_HDF5_POSITIONS_STRING, F5Path::Field_hid, and F5Path::Representation_hid.

◆ F5write_particle_positions()

F5_API F5ErrorCode F5write_particle_positions ( hid_t fileID,
double time,
const char * name,
const F5_vec3_point_t * Coords,
int nCoords,
const char * coordinate_system )

Write positions of some particles to the Fiber HDF5 file.

Parameters
fileIDSome HDF5 id corresponding to some already opened HDF5 file.
timeThe physical time for this data set.
nameSome textual description of this particle set; should be simple (avoid spaces, special characters and extensively long names). It is used to identify surfaces over multiple timesteps, so must be identical for subsequent calls on evolving surfaces.
CoordsThe cartesian coordinates of the points
nCoordsHow many points are there
coordinate_systemThe coordinate system. May be NULL to refer to a standard chart.

Definition at line 16 of file F5particles.c.

20{
21F5Path*f = F5Rcreate_cartesian_nD(File_id, time, gridname, 0, coordinate_system);
22 assert(f);
23
25
26 F5close(f);
27
28 return rv;
29}

References F5close(), F5Fwrite_1D(), F5Rcreate_cartesian_nD(), F5T_COORD3_FLOAT, and FIBER_HDF5_POSITIONS_STRING.

◆ F5write_particle_positions3fv()

F5_API void F5write_particle_positions3fv ( hid_t fileID,
double time,
const char * name,
const float * x,
const float * y,
const float * z,
int nCoords )

Like F5write_particle_positions(), but particle positions are given in separate memory arrays.

Todo
Implement.
Note
Naming convention is inspired by OpenGL
Todo
use newer field interface

References F5_API, and name.

◆ F5write_particle_positions_with_field_d()

F5_API void F5write_particle_positions_with_field_d ( hid_t fileID,
double time,
const char * name,
const F5_vec3_point_t * Coords,
int nCoords,
const double * data )

Write particle field with data given on each element.

Todo

Implement

use newer field interface

References F5_API, and name.

◆ F5write_polar_particle_positions()

F5_API void F5write_polar_particle_positions ( hid_t fileID,
double time,
const char * name,
const F5_polar_point3_float_t * Coords,
int nCoords )

Write particle position in polar coordinates.

Todo
Implement.

References F5_API, and name.