14 USE iso_c_binding,
ONLY: c_int, c_char, c_bool, c_funptr, c_funloc
25 & comin_severity_warning, comin_severity_error
44#include "comin_global.inc"
49 TYPE,
BIND(C) :: t_comin_setup_version_info
51 INTEGER(kind=c_int) :: version_no_major, version_no_minor, &
56 TYPE,
BIND(C) :: t_comin_plugin_description_c
57 CHARACTER(c_char),
DIMENSION(COMIN_MAX_LEN_PLUGIN_NAME+1) :: name
58 CHARACTER(c_char),
DIMENSION(COMIN_MAX_LEN_PLUGIN_LIBRARY+1) :: plugin_library
59 CHARACTER(c_char),
DIMENSION(COMIN_MAX_LEN_PRIMARY_CONSTRUCTOR+1) :: primary_constructor
60 CHARACTER(c_char),
DIMENSION(COMIN_MAX_LEN_OPTIONS+1) :: options
61 CHARACTER(c_char),
DIMENSION(COMIN_MAX_LEN_COMM+1) :: comm
62 INTEGER(c_int) :: log_severity
63 END TYPE t_comin_plugin_description_c
67 & bind(c, name=
'comin_plugin_primaryconstructor')
68 IMPORT t_comin_plugin_description_c, c_int
69 TYPE(t_comin_plugin_description_c),
INTENT(IN) :: plugin_list(*)
70 INTEGER(c_int),
VALUE,
INTENT(IN) :: len
74#include "comin_version.inc"
91 TYPE(t_comin_plugin_description_c) :: plugin_list_c(size(plugin_list))
94 DO i = 1,
SIZE(plugin_list)
95 IF (plugin_list(i)%log_debug)
THEN
96 plugin_list_c(i)%log_severity = comin_severity_debug
97 ELSE IF (plugin_list(i)%log_info)
THEN
98 plugin_list_c(i)%log_severity = comin_severity_info
99 ELSE IF (plugin_list(i)%log_warning)
THEN
100 plugin_list_c(i)%log_severity = comin_severity_warning
102 plugin_list_c(i)%log_severity = comin_severity_error
105 CALL convert_f_string(plugin_list(i)%name, plugin_list_c(i)%name)
106 CALL convert_f_string(plugin_list(i)%options, plugin_list_c(i)%options)
107 CALL convert_f_string(plugin_list(i)%plugin_library, plugin_list_c(i)%plugin_library)
108 CALL convert_f_string(plugin_list(i)%primary_constructor, plugin_list_c(i)%primary_constructor)
109 CALL convert_f_string(plugin_list(i)%comm, plugin_list_c(i)%comm)
118 CHARACTER(LEN=*),
INTENT(IN) :: plugin_str
119 INTEGER,
INTENT(IN) :: wp_check
127 IF (wp /= wp_check)
THEN
130 CALL comin_message(
" " // plugin_str //
": working precision test successful.", 0)
138 LOGICAL(KIND=C_BOOL),
INTENT(IN) :: lstdout
139 INTEGER,
INTENT(IN),
OPTIONAL :: output_unit
140 IF (
ASSOCIATED(state))
THEN
142 CALL comin_error_set(comin_error_setup_comin_already_initialized);
RETURN
147 IF(
PRESENT(output_unit))
THEN
155 CALL comin_parallel_free_mpi_comms()
178 PROCEDURE(comin_host_errhandler_fct) :: error_handler
180 TYPE(c_funptr) :: fct_ptr
181 fct_ptr = c_funloc(error_handler)
184 CALL comin_error_set(comin_error_setup_errhandler_not_associated);
RETURN
void comin_error_set(t_comin_error_code error_code)
void comin_setup_get_version(unsigned int *major, unsigned int *minor, unsigned int *patch)
void comin_plugin_primaryconstructor(const t_comin_plugin_description *plugin_list, int num_plugins)
void comin_state_set_output_unit(int unit)
bool comin_state_is_host_errhandler_set()
void comin_state_set_lstdout(bool lstdout)
void comin_state_set_host_errhandler_fct(t_comin_host_errhandler_fct_ptr fct)
The elements of this derived data type describe the current community interface.
integer, parameter wp
working precision
In order to be C-compliant, the following interface is incompatible with ICON finish; it requires a w...
subroutine, public convert_f_string(string, arr)
Convert Fortran string into C-style character array.
@ comin_error_setup_errhandler_not_associated
@ comin_error_setup_errhandler_not_set
@ comin_error_setup_comin_already_initialized
@ comin_error_setup_precision_test_failed
subroutine, public comin_message(message, lvl)
Prints a message on rank 0 if the global verbosity level larger than lvl.
subroutine, public comin_parallel_free_mpi_comms()
subroutine, public comin_setup_finalize()
Destructor.
subroutine, public comin_setup_errhandler(error_handler)
Sets the global error handler procedure pointer.
subroutine, public comin_setup_init(lstdout, output_unit)
Initialize the comin state This routine needs to be called by the host before any other comin call.
subroutine, public comin_setup_check(plugin_str, wp_check)
Performs basic compatibility checks.
type(t_comin_state), pointer, public state