ASCOT5
|
Module for reading magnetic field data from HDF5 file. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <hdf5.h>
#include <hdf5_hl.h>
#include "../ascot5.h"
#include "../print.h"
#include "../consts.h"
#include "../B_field.h"
#include "../Bfield/B_2DS.h"
#include "../Bfield/B_3DS.h"
#include "../Bfield/B_STS.h"
#include "../Bfield/B_TC.h"
#include "../Bfield/B_GS.h"
#include "hdf5_helpers.h"
#include "hdf5_bfield.h"
Go to the source code of this file.
Macros | |
#define | BPATH |
#define | BPATH "/bfield/B_2DS_XXXXXXXXXX/" |
#define | BPATH "/bfield/B_3DS_XXXXXXXXXX/" |
#define | BPATH "/bfield/B_STS_XXXXXXXXXX/" |
#define | BPATH "/bfield/B_TC_XXXXXXXXXX/" |
#define | BPATH "/bfield/B_GS_XXXXXXXXXX/" |
Functions | |
int | hdf5_bfield_read_2DS (hid_t f, B_2DS_offload_data *offload_data, real **offload_array, char *qid) |
Read magnetic field data of type B_2DS. | |
int | hdf5_bfield_read_3DS (hid_t f, B_3DS_offload_data *offload_data, real **offload_array, char *qid) |
Read magnetic field data of type B_3DS. | |
int | hdf5_bfield_read_STS (hid_t f, B_STS_offload_data *offload_data, real **offload_array, char *qid) |
Read magnetic field data of type B_STS. | |
int | hdf5_bfield_read_TC (hid_t f, B_TC_offload_data *offload_data, real **offload_array, char *qid) |
Read magnetic field data of type B_TC. | |
int | hdf5_bfield_read_GS (hid_t f, B_GS_offload_data *offload_data, real **offload_array, char *qid) |
Read magnetic field data of type B_GS. | |
int | hdf5_bfield_init_offload (hid_t f, B_field_offload_data *offload_data, real **offload_array, char *qid) |
Initialize magnetic field offload data from HDF5 file. | |
Module for reading magnetic field data from HDF5 file.
This module contains routines to read magnetic field data from ASCOT5 HDF5 file. The reading is done by calling hdf5_bfield_init_offload() which reads the data and uses that to initialize the offload data.
Note: the routines within this module that read the data from HDF5 file may use the offload data struct and offload arrays as (temporary) storage. However, the actual initialization is done at the specific B_field_init_offload() function the magnetic field data corresponds to. Check from that function what the offload data and the offload array are expected to contain. As a rule of thumb, the reading routines here should only read the data and maybe do some trivial computations but nothing complicated.
Definition in file hdf5_bfield.c.
#define BPATH |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
#define BPATH "/bfield/B_2DS_XXXXXXXXXX/" |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
#define BPATH "/bfield/B_3DS_XXXXXXXXXX/" |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
#define BPATH "/bfield/B_STS_XXXXXXXXXX/" |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
#define BPATH "/bfield/B_TC_XXXXXXXXXX/" |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
#define BPATH "/bfield/B_GS_XXXXXXXXXX/" |
Macro that is used to store paths to data groups
Definition at line 35 of file hdf5_bfield.c.
int hdf5_bfield_read_2DS | ( | hid_t | f, |
B_2DS_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Read magnetic field data of type B_2DS.
The B_2DS data is stored in HDF5 file under the group /bfield/B_2DS_XXXXXXXXXX/ where X's mark the QID.
This function assumes the group holds the following datasets:
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is allocated here |
offload_array | pointer to offload array which is allocated here and used to store psi, B_R, B_phi, and B_z values as required by B_2DS_init_offload() |
qid | QID of the B_2DS field that is to be read |
Definition at line 157 of file hdf5_bfield.c.
int hdf5_bfield_read_3DS | ( | hid_t | f, |
B_3DS_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Read magnetic field data of type B_3DS.
The B_3DS data is stored in HDF5 file under the group /bfield/B_3DS-XXXXXXXXXX/ where X's mark the QID.
This function assumes the group holds the following datasets: (B data refers to , , and and psi data to .)
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is allocated here |
offload_array | pointer to offload array which is allocated here and used to store psi, B_R, B_phi, and B_z values as required by B_3DS_init_offload() |
qid | QID of the B_3DS field that is to be read |
Definition at line 256 of file hdf5_bfield.c.
int hdf5_bfield_read_STS | ( | hid_t | f, |
B_STS_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Read magnetic field data of type B_STS.
The B_STS data is stored in HDF5 file under the group /bfield/B_STS_XXXXXXXXXX/ where X's mark the QID.
This function assumes the group holds the following datasets: (B data refers to , , and and psi data to .)
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is allocated here |
offload_array | pointer to offload array which is allocated here and used to store psi, B_R, B_phi, B_z, axis_r, and axis_z values as required by B_STS_init_offload() |
qid | QID of the B_STS field that is to be read |
Definition at line 395 of file hdf5_bfield.c.
int hdf5_bfield_read_TC | ( | hid_t | f, |
B_TC_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Read magnetic field data of type B_TC.
The B_TC data is stored in HDF5 file under the group /bfield/B_TC_XXXXXXXXXX/ where X's mark the QID.
This function assumes the group holds the following datasets:
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is allocated here |
offload_array | pointer to offload array but no data is stored there so it is not allocated and NULL pointer is returned instead |
qid | QID of the B_TC field that is to be read |
Definition at line 533 of file hdf5_bfield.c.
int hdf5_bfield_read_GS | ( | hid_t | f, |
B_GS_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Read magnetic field data of type B_GS.
The B_GS data is stored in HDF5 file under the group /bfield/B_GS_XXXXXXXXXX/ where X's mark the QID.
This function assumes the group holds the following datasets:
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is allocated here |
offload_array | pointer to offload array but no data is stored there so it is not allocated and NULL pointer is returned instead |
qid | QID of the B_GS field that is to be read |
Definition at line 584 of file hdf5_bfield.c.
int hdf5_bfield_init_offload | ( | hid_t | f, |
B_field_offload_data * | offload_data, | ||
real ** | offload_array, | ||
char * | qid ) |
Initialize magnetic field offload data from HDF5 file.
This function determines to which type of magnetic field the given QID corresponds to, and calls the corresponding reading routine. The read data is then used to initialize the offload data by calling B_field_init_offload().
The magnetic field data is stored under /bfield/ group in ASCOT5 HDF5 file. Several magnetic fields of same or different type maybe stored there in their respective groups as long as the group name contains QID as an identifier.
f | HDF5 file identifier for a file which is opened and closed outside of this function |
offload_data | pointer to offload data struct which is initialized here |
offload_array | pointer to offload array which is allocated and initialized here |
qid | QID of the data that is to be read |
Definition at line 69 of file hdf5_bfield.c.