ASCOT5
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
error.h File Reference

Error module for ASCOT5. More...

#include <math.h>
#include <stdio.h>
#include "offload_acc_omp.h"

Go to the source code of this file.

Typedefs

typedef unsigned long int a5err
 Simulation error flag.
 
typedef enum error_file error_file
 Enum type for indicating which file error originated from.
 
typedef enum error_type error_type
 Enum type for indicating type of error.
 

Enumerations

enum  error_file {
  EF_MCCC_WIENER = 1 , EF_MCCC_PUSH = 2 , EF_MCCC_COEFS = 3 , EF_MCCC = 4 ,
  EF_STEP_FO_VPA = 5 , EF_STEP_GC_CASHKARP = 6 , EF_STEP_GC_RK4 = 7 , EF_N0_1D = 8 ,
  EF_N0_3D = 9 , EF_N0_ST = 10 , EF_B_3DS = 11 , EF_B_2DS = 12 ,
  EF_B_STS = 13 , EF_B_GS = 14 , EF_PLASMA_1D = 15 , EF_PLASMA_1DS = 16 ,
  EF_PLASMA = 17 , EF_E_FIELD = 18 , EF_NEUTRAL = 19 , EF_E_1DS = 20 ,
  EF_B_FIELD = 21 , EF_PARTICLE = 22 , EF_BOOZER = 23 , EF_MHD = 24 ,
  EF_ATOMIC = 25 , EF_ASIGMA = 26 , EF_ASIGMA_LOC = 27 , EF_SUZUKI = 28
}
 Enum type for indicating which file error originated from. More...
 
enum  error_type {
  ERR_INPUT_EVALUATION = 1 , ERR_UNKNOWN_INPUT = 2 , ERR_INPUT_UNPHYSICAL = 3 , ERR_MARKER_UNPHYSICAL = 4 ,
  ERR_INVALID_TIMESTEP = 5 , ERR_WIENER_ARRAY = 6 , ERR_INTEGRATION = 7 , ERR_ATOMIC_EVALUATION = 8
}
 Enum type for indicating type of error. More...
 

Functions

static DECLARE_TARGET_SIMD a5err error_raise (error_type type, int line, error_file file)
 Raise a new error.
 
void error_parse (a5err err, int *msg, int *line, int *file)
 Retrieve stored data from the error flag.
 
void error_parse2str (a5err err, char *msg, char *line, char *file)
 Convert error flag in string format.
 

Detailed Description

Error module for ASCOT5.

Contains error codes, their interpretation, and a function to raise errors.

Definition in file error.h.

Typedef Documentation

◆ a5err

typedef unsigned long int a5err

Simulation error flag.

Definition at line 17 of file error.h.

◆ error_file

typedef enum error_file error_file

Enum type for indicating which file error originated from.

Assign unique value for each type just in case. Do not use zero! Please use running numbering and put the latest entry last.

◆ error_type

typedef enum error_type error_type

Enum type for indicating type of error.

Assign unique value for each type just in case. Do not use zero! Please use running numbering and put the latest entry last.

Enumeration Type Documentation

◆ error_file

enum error_file

Enum type for indicating which file error originated from.

Assign unique value for each type just in case. Do not use zero! Please use running numbering and put the latest entry last.

Enumerator
EF_MCCC_WIENER 

Error is from mccc_wiener.c

EF_MCCC_PUSH 

Error is from mccc_push.c

EF_MCCC_COEFS 

Error is from mccc_coefs.c

EF_MCCC 

Error is from mccc.c

EF_STEP_FO_VPA 

Error is from step_fo_vpa.c

EF_STEP_GC_CASHKARP 

Error is from step_gc_cashkarp.c

EF_STEP_GC_RK4 

Error is from step_gc_rk4.c

EF_N0_1D 

Error is from N0_1D.c

EF_N0_3D 

Error is from N0_3D.c

EF_N0_ST 

Error is from N0_ST.c

EF_B_3DS 

Error is from B_3DS.c

EF_B_2DS 

Error is from B_2DS.c

EF_B_STS 

Error is from B_STS.c

EF_B_GS 

Error is from B_GS.c

EF_PLASMA_1D 

Error is from plasma_1DS.c

EF_PLASMA_1DS 

Error is from plasma_1DS.c

EF_PLASMA 

Error is from plasma.c

EF_E_FIELD 

Error is from E_field.c

EF_NEUTRAL 

Error is from neutral.c

EF_E_1DS 

Error is from E_1DS.c

EF_B_FIELD 

Error is from B_field.c

EF_PARTICLE 

Error is from particle.c

EF_BOOZER 

Error is from boozer.c

EF_MHD 

Error is from mhd.c

EF_ATOMIC 

Error is from atomic.c

EF_ASIGMA 

Error is from asigma.c

EF_ASIGMA_LOC 

Error is from asigma_loc.c

EF_SUZUKI 

Error is from suzuki.c

Definition at line 25 of file error.h.

◆ error_type

enum error_type

Enum type for indicating type of error.

Assign unique value for each type just in case. Do not use zero! Please use running numbering and put the latest entry last.

Enumerator
ERR_INPUT_EVALUATION 

Failure when evaluating input data

ERR_UNKNOWN_INPUT 

Input data type not regonizable

ERR_INPUT_UNPHYSICAL 

Input evaluation result is unphysical

ERR_MARKER_UNPHYSICAL 

Some of marker fields are unphysical

ERR_INVALID_TIMESTEP 

Time step is zero, NaN or too small

ERR_WIENER_ARRAY 

Wiener array is full or inconsistent

ERR_INTEGRATION 

Integrating marker coordinates yield unphysical results

ERR_ATOMIC_EVALUATION 

Failure when evaluating atomic reaction

Definition at line 62 of file error.h.

Function Documentation

◆ error_raise()

static DECLARE_TARGET_SIMD a5err error_raise ( error_type type,
int line,
error_file file )
inlinestatic

Raise a new error.

This is a SIMD function.

Parameters
typetype of error
lineline number this function is called from; use macro LINE here
filefile this function is called from
Returns
error containing info on error type and line and file error happened

Definition at line 86 of file error.h.

◆ error_parse()

void error_parse ( a5err err,
int * msg,
int * line,
int * file )

Retrieve stored data from the error flag.

The values of type and file corresponds to the ones that were in error_type and error_file enums that were used when error was thrown with error_raise().

This function is host only.

Parameters
errthe error flag
msgpointer for storing type of the error
linepointer for storing the line where error originated from
filepointer for storing the file where error originated from

Definition at line 44 of file error.c.

◆ error_parse2str()

void error_parse2str ( a5err err,
char * msg,
char * line,
char * file )

Convert error flag in string format.

This function is host only.

Parameters
errthe error flag
msgpointer for error message
linepointer for storing the line where error originated from
filepointer for storing the file where error originated from

Definition at line 62 of file error.c.