ASCOT5
Loading...
Searching...
No Matches
Macros | Functions
hdf5_efield.c File Reference

Module for reading electric field data from HDF5 file. More...

#include <stdio.h>
#include <stdlib.h>
#include <hdf5.h>
#include <hdf5_hl.h>
#include "../ascot5.h"
#include "../E_field.h"
#include "../Efield/E_TC.h"
#include "../Efield/E_1DS.h"
#include "../print.h"
#include "hdf5_helpers.h"
#include "hdf5_efield.h"

Go to the source code of this file.

Macros

#define EPATH
 
#define EPATH   "/efield/E_1DS_XXXXXXXXXX/"
 
#define EPATH   "/efield/E_TC_XXXXXXXXXX/"
 

Functions

int hdf5_efield_read_1DS (hid_t f, E_1DS_offload_data *offload_data, real **offload_array, char *qid)
 Read E1DS electric field data from HDF5 file.
 
int hdf5_efield_read_TC (hid_t f, E_TC_offload_data *offload_data, real **offload_array, char *qid)
 Read magnetic field data of type E_TC.
 
int hdf5_efield_init_offload (hid_t f, E_field_offload_data *offload_data, real **offload_array, char *qid)
 Read electric field data from HDF5 file.
 

Detailed Description

Module for reading electric field data from HDF5 file.

Electric field must be read by calling hdf5_efield_init_offload() contained in this module. This module contains reading routines for all electric field types.

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 E_field_init_offload() function the electric 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_efield.c.

Macro Definition Documentation

◆ EPATH [1/3]

#define EPATH

Macro that is used to store paths to data groups

Definition at line 29 of file hdf5_efield.c.

◆ EPATH [2/3]

#define EPATH   "/efield/E_1DS_XXXXXXXXXX/"

Macro that is used to store paths to data groups

Definition at line 29 of file hdf5_efield.c.

◆ EPATH [3/3]

#define EPATH   "/efield/E_TC_XXXXXXXXXX/"

Macro that is used to store paths to data groups

Definition at line 29 of file hdf5_efield.c.

Function Documentation

◆ hdf5_efield_read_1DS()

int hdf5_efield_read_1DS ( hid_t f,
E_1DS_offload_data * offload_data,
real ** offload_array,
char * qid )

Read E1DS electric field data from HDF5 file.

Parameters
fHDF5 file from which data is read
offload_datapointer to offload data
offload_arraypointer to offload array
qidQID of the data
Returns
Zero if reading succeeded

Definition at line 96 of file hdf5_efield.c.

◆ hdf5_efield_read_TC()

int hdf5_efield_read_TC ( hid_t f,
E_TC_offload_data * offload_data,
real ** offload_array,
char * qid )

Read magnetic field data of type E_TC.

The E_TC data is stored in HDF5 file under the group /efield/E_TC-XXXXXXXXXX/ where X's mark the QID.

This function assumes the group holds the following datasets:

  • double Exyz Electric field values [E_x, E_y, E_z] [V/m]
Parameters
fHDF5 file identifier for a file which is opened and closed outside of this function
offload_datapointer to offload data struct which is allocated here
offload_arraypointer to offload array but no data is stored there so it is not allocated and NULL pointer is returned instead
qidQID of the B_TC field that is to be read
Returns
zero if reading succeeded

Definition at line 146 of file hdf5_efield.c.

◆ hdf5_efield_init_offload()

int hdf5_efield_init_offload ( hid_t f,
E_field_offload_data * offload_data,
real ** offload_array,
char * qid )

Read electric field data from HDF5 file.

This function reads electric field data with given qid while also initializing offload data and allocating and filling offload array. The file is opened and closed outside this function.

The electric field data is stored under /efield/ group in ASCOT5 HDF5 file. Several electric fields of same or different type maybe stored there in their respective groups as long as the group name contains QID as an identifier.

Parameters
fHDF5 file identifier for a file which is opened and closed outside of this function
offload_datapointer to offload data struct which is initialized here
offload_arraypointer to offload array which is allocated and initialized here
qidQID of the data that is to be read
Returns
zero if reading and initialization succeeded

Definition at line 57 of file hdf5_efield.c.