| 1 |
/* |
| 2 |
* This is my modified H5PartAttribF.c for use in SPLASH |
| 3 |
* Main changes are that the strings are now passed |
| 4 |
* directly from Fortran, already with the null character appended |
| 5 |
* |
| 6 |
* Modified from the original H5Part Fortran interface |
| 7 |
* by Daniel Price 08/04/10 |
| 8 |
*/ |
| 9 |
#include "H5Part.h" |
| 10 |
|
| 11 |
h5part_int64_t |
| 12 |
h5ptc_writefileattrib_r8 ( |
| 13 |
h5part_int64_t *f, |
| 14 |
const char *name, |
| 15 |
const h5part_float64_t *data, |
| 16 |
const h5part_float64_t *nelem |
| 17 |
) { |
| 18 |
|
| 19 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 20 |
|
| 21 |
h5part_int64_t herr = H5PartWriteFileAttrib ( |
| 22 |
filehandle, name, H5PART_FLOAT64, data, *nelem); |
| 23 |
|
| 24 |
return herr; |
| 25 |
} |
| 26 |
|
| 27 |
h5part_int64_t |
| 28 |
h5ptc_readfileattrib_r8 ( |
| 29 |
h5part_int64_t *f, |
| 30 |
const char *name, |
| 31 |
const h5part_float64_t *data |
| 32 |
) { |
| 33 |
|
| 34 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 35 |
|
| 36 |
h5part_int64_t herr = H5PartReadFileAttrib ( |
| 37 |
filehandle, name, (void*)data); |
| 38 |
|
| 39 |
return herr; |
| 40 |
} |
| 41 |
|
| 42 |
h5part_int64_t |
| 43 |
h5ptc_writefileattrib_r4 ( |
| 44 |
h5part_int64_t *f, |
| 45 |
const char *name, |
| 46 |
const h5part_float32_t *data, |
| 47 |
const h5part_float32_t *nelem |
| 48 |
) { |
| 49 |
|
| 50 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 51 |
|
| 52 |
h5part_int64_t herr = H5PartWriteFileAttrib ( |
| 53 |
filehandle, name, H5PART_FLOAT32, data, *nelem); |
| 54 |
|
| 55 |
return herr; |
| 56 |
} |
| 57 |
|
| 58 |
h5part_int64_t |
| 59 |
h5ptc_readfileattrib_r4 ( |
| 60 |
h5part_int64_t *f, |
| 61 |
const char *name, |
| 62 |
const h5part_float32_t *data |
| 63 |
) { |
| 64 |
|
| 65 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 66 |
|
| 67 |
h5part_int64_t herr = H5PartReadFileAttrib ( |
| 68 |
filehandle, name, (void*)data); |
| 69 |
|
| 70 |
return herr; |
| 71 |
} |
| 72 |
|
| 73 |
h5part_int64_t |
| 74 |
h5ptc_writefileattrib_i8 ( |
| 75 |
h5part_int64_t *f, |
| 76 |
const char *name, |
| 77 |
const h5part_int64_t *data, |
| 78 |
const h5part_int64_t *nelem |
| 79 |
) { |
| 80 |
|
| 81 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 82 |
|
| 83 |
h5part_int64_t herr = H5PartWriteFileAttrib ( |
| 84 |
filehandle, name, H5PART_INT64, data, *nelem); |
| 85 |
|
| 86 |
return herr; |
| 87 |
} |
| 88 |
|
| 89 |
h5part_int64_t |
| 90 |
h5ptc_readfileattrib_i8 ( |
| 91 |
h5part_int64_t *f, |
| 92 |
const char *name, |
| 93 |
const h5part_int64_t *data |
| 94 |
) { |
| 95 |
|
| 96 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 97 |
|
| 98 |
h5part_int64_t herr = H5PartReadFileAttrib ( |
| 99 |
filehandle, name, (void*)data); |
| 100 |
|
| 101 |
return herr; |
| 102 |
} |
| 103 |
|
| 104 |
h5part_int64_t |
| 105 |
h5ptc_writefileattrib_i4 ( |
| 106 |
h5part_int64_t *f, |
| 107 |
const char *name, |
| 108 |
const h5part_int32_t *data, |
| 109 |
const h5part_int32_t *nelem |
| 110 |
) { |
| 111 |
|
| 112 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 113 |
|
| 114 |
h5part_int64_t herr = H5PartWriteFileAttrib ( |
| 115 |
filehandle, name, H5PART_INT32, data, *nelem); |
| 116 |
|
| 117 |
return herr; |
| 118 |
} |
| 119 |
|
| 120 |
h5part_int64_t |
| 121 |
h5ptc_readfileattrib_i4 ( |
| 122 |
h5part_int64_t *f, |
| 123 |
const char *name, |
| 124 |
const h5part_int32_t *data |
| 125 |
) { |
| 126 |
|
| 127 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 128 |
|
| 129 |
h5part_int64_t herr = H5PartReadFileAttrib ( |
| 130 |
filehandle, name, (void*)data); |
| 131 |
|
| 132 |
return herr; |
| 133 |
} |
| 134 |
|
| 135 |
h5part_int64_t |
| 136 |
h5ptc_writestepattrib_r8 ( |
| 137 |
h5part_int64_t *f, |
| 138 |
const char *name, |
| 139 |
const h5part_float64_t *data, |
| 140 |
const h5part_float64_t *nelem |
| 141 |
) { |
| 142 |
|
| 143 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 144 |
|
| 145 |
h5part_int64_t herr = H5PartWriteStepAttrib ( |
| 146 |
filehandle, name, H5PART_FLOAT64, data, *nelem); |
| 147 |
|
| 148 |
return herr; |
| 149 |
} |
| 150 |
|
| 151 |
h5part_int64_t |
| 152 |
h5ptc_readstepattrib_r8 ( |
| 153 |
h5part_int64_t *f, |
| 154 |
const char *name, |
| 155 |
const h5part_float64_t *data |
| 156 |
) { |
| 157 |
|
| 158 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 159 |
|
| 160 |
h5part_int64_t herr = H5PartReadStepAttrib ( |
| 161 |
filehandle, name, (void*)data); |
| 162 |
|
| 163 |
return herr; |
| 164 |
} |
| 165 |
|
| 166 |
h5part_int64_t |
| 167 |
h5ptc_writestepattrib_r4 ( |
| 168 |
h5part_int64_t *f, |
| 169 |
const char *name, |
| 170 |
const h5part_float32_t *data, |
| 171 |
const h5part_float32_t *nelem |
| 172 |
) { |
| 173 |
|
| 174 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 175 |
|
| 176 |
h5part_int64_t herr = H5PartWriteStepAttrib ( |
| 177 |
filehandle, name, H5PART_FLOAT32, data, *nelem); |
| 178 |
|
| 179 |
return herr; |
| 180 |
} |
| 181 |
|
| 182 |
h5part_int64_t |
| 183 |
h5ptc_readstepattrib_r4 ( |
| 184 |
h5part_int64_t *f, |
| 185 |
const char *name, |
| 186 |
const h5part_float32_t *data |
| 187 |
) { |
| 188 |
|
| 189 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 190 |
|
| 191 |
h5part_int64_t herr = H5PartReadStepAttrib ( |
| 192 |
filehandle, name, (void*)data); |
| 193 |
|
| 194 |
return herr; |
| 195 |
} |
| 196 |
|
| 197 |
h5part_int64_t |
| 198 |
h5ptc_writestepattrib_i8 ( |
| 199 |
h5part_int64_t *f, |
| 200 |
const char *name, |
| 201 |
const h5part_int64_t *data, |
| 202 |
const h5part_int64_t *nelem |
| 203 |
) { |
| 204 |
|
| 205 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 206 |
|
| 207 |
h5part_int64_t herr = H5PartWriteStepAttrib ( |
| 208 |
filehandle, name, H5PART_INT64, data, *nelem); |
| 209 |
|
| 210 |
return herr; |
| 211 |
} |
| 212 |
|
| 213 |
h5part_int64_t |
| 214 |
h5ptc_readstepattrib_i8 ( |
| 215 |
h5part_int64_t *f, |
| 216 |
const char *name, |
| 217 |
const h5part_int64_t *data |
| 218 |
) { |
| 219 |
|
| 220 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 221 |
|
| 222 |
h5part_int64_t herr = H5PartReadStepAttrib ( |
| 223 |
filehandle, name, (void*)data); |
| 224 |
|
| 225 |
return herr; |
| 226 |
} |
| 227 |
|
| 228 |
h5part_int64_t |
| 229 |
h5ptc_writestepattrib_i4 ( |
| 230 |
h5part_int64_t *f, |
| 231 |
const char *name, |
| 232 |
const h5part_int32_t *data, |
| 233 |
const h5part_int32_t *nelem |
| 234 |
) { |
| 235 |
|
| 236 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 237 |
|
| 238 |
h5part_int64_t herr = H5PartWriteStepAttrib ( |
| 239 |
filehandle, name, H5PART_INT32, data, *nelem); |
| 240 |
|
| 241 |
return herr; |
| 242 |
} |
| 243 |
|
| 244 |
h5part_int64_t |
| 245 |
h5ptc_readstepattrib_i4 ( |
| 246 |
h5part_int64_t *f, |
| 247 |
const char *name, |
| 248 |
const h5part_int32_t *data |
| 249 |
) { |
| 250 |
|
| 251 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 252 |
|
| 253 |
h5part_int64_t herr = H5PartReadStepAttrib ( |
| 254 |
filehandle, name, (void*)data); |
| 255 |
|
| 256 |
return herr; |
| 257 |
} |
| 258 |
|
| 259 |
/*=================== Attributes ================*/ |
| 260 |
|
| 261 |
h5part_int64_t |
| 262 |
h5ptc_writefileattrib_string ( |
| 263 |
const h5part_int64_t *f, |
| 264 |
const char *attrib_name, |
| 265 |
const char *attrib_value |
| 266 |
) { |
| 267 |
|
| 268 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 269 |
|
| 270 |
h5part_int64_t herr = H5PartWriteFileAttribString ( |
| 271 |
filehandle, attrib_name, attrib_value ); |
| 272 |
|
| 273 |
return herr; |
| 274 |
} |
| 275 |
|
| 276 |
h5part_int64_t |
| 277 |
h5ptc_writestepattrib_string ( |
| 278 |
const h5part_int64_t *f, |
| 279 |
const char *attrib_name, |
| 280 |
const char *attrib_value |
| 281 |
) { |
| 282 |
|
| 283 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 284 |
|
| 285 |
h5part_int64_t herr = H5PartWriteStepAttribString ( |
| 286 |
filehandle, attrib_name, attrib_value ); |
| 287 |
|
| 288 |
return herr; |
| 289 |
} |
| 290 |
|
| 291 |
/* Reading attributes ************************* */ |
| 292 |
|
| 293 |
h5part_int64_t |
| 294 |
h5ptc_getnstepattribs ( |
| 295 |
const h5part_int64_t *f |
| 296 |
) { |
| 297 |
|
| 298 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 299 |
|
| 300 |
return H5PartGetNumStepAttribs ( filehandle ); |
| 301 |
} |
| 302 |
|
| 303 |
h5part_int64_t |
| 304 |
h5ptc_getnfileattribs ( |
| 305 |
const h5part_int64_t *f |
| 306 |
) { |
| 307 |
|
| 308 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 309 |
|
| 310 |
return H5PartGetNumFileAttribs ( filehandle ); |
| 311 |
} |
| 312 |
|
| 313 |
h5part_int64_t |
| 314 |
h5ptc_getstepattribinfo ( |
| 315 |
const h5part_int64_t *f, |
| 316 |
const h5part_int64_t *idx, |
| 317 |
char *name, |
| 318 |
h5part_int64_t *nelem, |
| 319 |
const h5part_int64_t *l_name |
| 320 |
) { |
| 321 |
|
| 322 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 323 |
h5part_int64_t type; |
| 324 |
|
| 325 |
h5part_int64_t herr = H5PartGetStepAttribInfo ( |
| 326 |
filehandle, *idx, name, *l_name, &type, nelem); |
| 327 |
|
| 328 |
return herr; |
| 329 |
} |
| 330 |
|
| 331 |
h5part_int64_t |
| 332 |
h5ptc_getfileattribinfo ( |
| 333 |
const h5part_int64_t *f, |
| 334 |
const h5part_int64_t *idx, |
| 335 |
char *name, |
| 336 |
h5part_int64_t *nelem, |
| 337 |
const h5part_int64_t *l_name ) { |
| 338 |
|
| 339 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 340 |
h5part_int64_t type; |
| 341 |
|
| 342 |
h5part_int64_t herr = H5PartGetFileAttribInfo ( |
| 343 |
filehandle, *idx, name, *l_name, &type, nelem); |
| 344 |
|
| 345 |
return herr; |
| 346 |
} |
| 347 |
|
| 348 |
h5part_int64_t |
| 349 |
h5ptc_readstepattrib_string ( |
| 350 |
const h5part_int64_t *f, |
| 351 |
const char *attrib_name, |
| 352 |
char *attrib_value |
| 353 |
) { |
| 354 |
|
| 355 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 356 |
|
| 357 |
h5part_int64_t herr = H5PartReadStepAttrib ( |
| 358 |
filehandle, attrib_name, attrib_value ); |
| 359 |
|
| 360 |
return herr; |
| 361 |
} |
| 362 |
|
| 363 |
h5part_int64_t |
| 364 |
h5ptc_readfileattrib_string ( |
| 365 |
const h5part_int64_t *f, |
| 366 |
const char *attrib_name, |
| 367 |
char *attrib_value |
| 368 |
) { |
| 369 |
|
| 370 |
H5PartFile *filehandle = (H5PartFile*)(size_t)*f; |
| 371 |
|
| 372 |
h5part_int64_t herr = H5PartReadFileAttrib ( |
| 373 |
filehandle, attrib_name, attrib_value ); |
| 374 |
|
| 375 |
return herr; |
| 376 |
} |