FiberBundleHDF5  FiberHDF5 Documentation, Revision 2026
High-Performance Fiber Bundle Data Model for Scientific Visualization
Loading...
Searching...
No Matches
F5AMR.c
Go to the documentation of this file.
1#include "F5AMR.h"
2#include "F5B.h"
3#include "F5X.h"
4#include "F5defs.h"
5#include "F5L.h"
6#include "F5F.h"
7#include "F5R.h"
8#include "F5private.h"
9#include "F5coordinates.h"
10
11#include <assert.h>
12
13/*TODO: Implement these functions.
14
15AMRInfo*F5AMRopen(hid_t fileID,
16 const int rank,
17 double rootOrigin[3],
18 double rootDelta[3],
19 const char*description);
20
21void F5AMRclose(AMRInfo*);
22*/
23
24
25/*TODO: rewrite these function to use the F5Path/F5F interfaces */
26
27#if 0
28herr_t F5AMRwrite_block( AMRInfo*AI,
29 const int timestep,
30 const double physTime,
31 const char* fieldname,
32 const int level,
33 int dimension,
34 const int *location,
35 const int *size,
36 hid_t fieldtype,
37 const void* dataPtr,
38 int Centering,
39 const char*blockname,
40 const char*coordinate_system,
41 hid_t property_id)
42{
43hid_t S_id, G_id, T_id, R_id, F_id, B_id;
44char Tname[1024];
45int i;
46hsize_t dims[FIBER_MAX_RANK], start[FIBER_MAX_RANK];
47hsize_t levels[3];
48
49 if (!coordinate_system)
50 coordinate_system = FIBER_HDF5_DEFAULT_CHART;
51
52 assert(AI);
53
54 /* /T=0.345/ */
55 S_id = F5Bappend_slice(AI->fileID, &physTime);
56
57 /* /T=0.345/"mydata" */
58 G_id = F5Gappend(S_id, AI->description, 0);
59
60 levels[0] = levels[1] = levels[2] = level;
61 assert(levels);
62 TopologyName(Tname, sizeof(Tname), levels, Centering, dimension);
63
64 /* /T=0.345/"mydata"/VertexLevel 23/ */
65 T_id = F5Gappend(G_id, Tname, 0);
66 R_id = F5Gappend(T_id, coordinate_system, 0) ;
67
68 assert(dimension<=32);
69 for(i=0; i<dimension; i++)
70 {
71 start[i] = location[i];
72 dims[i] = size[i];
73 }
74
75
76 B_id = F5Lwrite_fraction(R_id, fieldname, dimension,
77 NULL, /* full grid dimension !? */
78 dims,
79 fieldtype, 0, /* memory field types not supported here yet. */
80 dataPtr, start,
81 0, 0, /* Ghostzones/ border information */
82 blockname,
84 property_id);
85
86 /* TODO: Add attributes and relative positional information (parent level/child level information) */
87
88 H5Dclose(B_id);
89/* H5Gclose(F_id); */
90 H5Gclose(R_id);
91 H5Gclose(T_id);
92 H5Gclose(G_id);
93 H5Gclose(S_id);
94 return 0;
95}
96
97/**
98@todo Need to adjust this function to the modernized F5Path
99 interface, or remove it.
100 */
101herr_t F5CAMRwrite_block_v(AMRInfo*AI,
102 const int timestep,
103 const double physTime,
104 const char* fieldname,
105 const int level,
106 int dimension,
107 const int *location,
108 const int *size,
109 hid_t fieldtype,
110 const void**dataPtr,
111 int Centering,
112 const char*blockname,
113 const char*coordinate_system,
114 hid_t property_id)
115{
116hid_t S_id, G_id, T_id, R_id, F_id, B_id;
117char Tname[1024];
118int i;
119hsize_t dims[32];
120
121 assert(AI);
122
123 /* /T=0.345/ */
124 S_id = F5Bappend_slice(AI->fileID, &physTime);
125
126 /* /T=0.345/"mydata" */
127 G_id = F5Gappend(S_id, AI->description, 0);
128
129 {
130 hsize_t levels[3];
131 levels[0] = levels[1] = levels[2] = level;
132 TopologyName(Tname, sizeof(Tname), levels, Centering, dimension);
133 }
134
135 /* /T=0.345/"mydata"/VertexLevel 23/ */
136 T_id = F5Gappend(G_id, Tname, 0);
137 /* /T=0.345/"mydata"/VertexLevel 23/Cartesian Chart 3D/ */
138 R_id = F5Gappend(T_id, coordinate_system, 0) ;
139
140 assert(dimension<=32);
141 for(i=0; i<dimension; i++)
142 {
143 dims[i] = size[i];
144 }
145
146 /* /T=0.345/"mydata"/VertexLevel 23/Cartesian Chart 3D/"density"/ */
147 F_id = F5Gappend(R_id, fieldname, 0) ;
148
149 /* TODO: Add reference to field type here */
150
151 /* write field data block-wise */
152
153 /* /T=0.345/"mydata"/VertexLevel 23/Cartesian Chart 3D/"density"/block-000/ */
154 B_id = F5Lwrites(F_id, blockname, dimension, dims, fieldtype, 0, dataPtr,
156 property_id);
157
158
159#if 0
160 B_id = H5Gcreate(F_id, blockname, 0);
161
162 /* write the data into the dataset */
163 {
164 hid_t ds_id = H5Screate_simple(dimension, dims, NULL);
165 hid_t creator_id = H5Pcreate(H5P_DATASET_CREATE);
166
167 int Ncomponents = H5Tget_nmembers(fieldtype);
168 int comp;
169 for(comp=0; comp<Ncomponents; comp++)
170 {
171 hid_t id, ComponentType;
172 char * ComponentName;
173 const void * data = dataPtr[comp];
174
175 if (!data) continue;
176 ComponentName = H5Tget_member_name(fieldtype, comp);
177 ComponentType = H5Tget_member_type(fieldtype, comp);
178
179 id = H5Dcreate(B_id, ComponentName, fieldtype, ds_id, creator_id);
180 H5Dwrite(id, fieldtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
181 H5Dclose(id);
182
183 free(ComponentName);
184 H5Tclose(ComponentType);
185 }
186
187 H5Sclose(ds_id);
188 H5Pclose(creator_id);
189 }
190#endif
191 H5Gclose(B_id);
192 /* TODO: Add attributes and relative positional information (parent level/child level information) */
193
194 H5Gclose(F_id);
195 H5Gclose(R_id);
196 H5Gclose(T_id);
197 H5Gclose(G_id);
198 H5Gclose(S_id);
199 return 0;
200}
201#endif
202
H5Tclose(type_id)
free(name)
void TopologyName(char *name, int nlength, const hsize_t *level, int Centering, int dims)
Definition F5R.c:300
#define FIBER_MAX_RANK
Definition F5defs.h:105
#define FIBER_HDF5_DEFAULT_CHART
Definition F5defs.h:74
hid_t F5Tsave_F5field_enum(hid_t loc_id)
Definition F5types.c:222
F5_API herr_t F5AMRwrite_block(AMRInfo *AI, const int timestep, const double physTime, const char *fieldname, const int level, int dimension, const int *location, const int *size, hid_t fieldtype, const void *dataPtr, int Centering, const char *blockname, const char *coordinate_system, hid_t property_id)
hid_t F5Lwrite_fraction(hid_t R_id, const char *fieldname, 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:631
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
F5_API hid_t F5Bappend_slice(hid_t file_id, const double *time)
Definition F5Bslice.c:140
#define H5Gclose(x)
Definition F5X.h:144
hid_t F5Gappend(hid_t loc_id, const char *name)
Definition F5X.c:59
const char * description
Definition F5AMR.h:26
hid_t fileID
Definition F5AMR.h:25