ComIn
0.5.1
ICON Community Interface
Loading...
Searching...
No Matches
comin_state.F90
Go to the documentation of this file.
1
!> @file comin_state.F90
2
!! @brief Data shared between host and plugins.
3
!
4
! @authors 10/2023 :: ICON Community Interface <comin@icon-model.org>
5
!
6
! SPDX-License-Identifier: BSD-3-Clause
7
!
8
! See LICENSES for license information.
9
! Where software is supplied by third parties, it is indicated in the
10
! headers of the routines.
11
!
12
MODULE
comin_state
13
14
USE
iso_c_binding,
ONLY
: c_bool, c_int, c_ptr, c_funptr, c_funloc
15
USE
comin_parallel_types
,
ONLY
:
t_comin_parallel_info
16
USE
comin_descrdata_types
,
ONLY
:
t_comin_descrdata_global_data
, &
17
&
t_comin_descrdata_domain_data
, &
18
&
comin_glb2loc_index_lookup_fct
19
20
IMPLICIT NONE
21
22
PRIVATE
23
PUBLIC
::
comin_state_set_num_plugins
24
PUBLIC
::
comin_state_get_num_plugins
25
PUBLIC
::
comin_setup_set_verbosity_level
26
PUBLIC
::
comin_setup_get_verbosity_level
27
PUBLIC
::
comin_current_get_ep
28
PUBLIC
::
comin_current_get_domain_id
29
PUBLIC
::
comin_current_set_plugin_id
30
PUBLIC
::
comin_current_get_plugin_id
31
PUBLIC
::
comin_state_is_primary_done
32
PUBLIC
::
comin_state_set_primary_done
33
PUBLIC
::
comin_state_get_error_code
34
PUBLIC
::
comin_state_set_error_code
35
PUBLIC
::
comin_state_get_output_unit
36
PUBLIC
::
comin_state_set_output_unit
37
PUBLIC
::
comin_state_get_lstdout
38
PUBLIC
::
comin_state_set_lstdout
39
PUBLIC
::
comin_state_get_var_list
40
PUBLIC
::
comin_descrdata_set_fct_glb2loc_cell
41
PUBLIC
::
comin_descrdata_set_fct_glb2loc_edge
42
PUBLIC
::
comin_descrdata_set_fct_glb2loc_vert
43
PUBLIC
::
comin_state_set_host_errhandler_fct
44
PUBLIC
::
comin_state_is_host_errhandler_set
45
46
#include "comin_global.inc"
47
48
TYPE
,
PUBLIC
::
t_comin_state
49
50
! (Non-public) data structure
51
TYPE
(
t_comin_parallel_info
) :: parallel_info
52
53
!> Create descriptive data structures
54
TYPE
(
t_comin_descrdata_global_data
) :: comin_descrdata_global_data
55
TYPE
(
t_comin_descrdata_domain_data
),
ALLOCATABLE
:: comin_descrdata_domain_data(:)
56
57
END TYPE
t_comin_state
58
59
! Global variable holding the ComIn state.
60
! The C++ part of the state is declared in comin_state.hpp.
61
TYPE
(
t_comin_state
),
PUBLIC
,
POINTER
::
state
=> null()
62
63
INTERFACE
64
65
SUBROUTINE
comin_state_set_num_plugins
(num_plugins)
BIND(C)
66
IMPORT
c_int
67
INTEGER(KIND=C_INT)
,
INTENT(IN)
,
VALUE
:: num_plugins
68
END SUBROUTINE
comin_state_set_num_plugins
69
70
FUNCTION
comin_state_get_num_plugins
()
BIND(C)
71
IMPORT
c_int
72
INTEGER(KIND=C_INT)
::
comin_state_get_num_plugins
73
END FUNCTION
comin_state_get_num_plugins
74
75
SUBROUTINE
comin_setup_set_verbosity_level
(iverbosity)
BIND(C)
76
IMPORT
c_int
77
INTEGER(KIND=C_INT)
,
INTENT(IN)
,
VALUE
:: iverbosity
78
END SUBROUTINE
comin_setup_set_verbosity_level
79
80
FUNCTION
comin_setup_get_verbosity_level
()
BIND(C)
81
IMPORT
c_int
82
INTEGER(KIND=C_INT)
::
comin_setup_get_verbosity_level
83
END FUNCTION
comin_setup_get_verbosity_level
84
85
SUBROUTINE
comin_state_set_error_code
(errcode)
BIND(C)
86
IMPORT
c_int
87
INTEGER(KIND=C_INT)
,
INTENT(IN)
,
VALUE
:: errcode
88
END SUBROUTINE
comin_state_set_error_code
89
90
FUNCTION
comin_state_get_error_code
()
BIND(C)
91
IMPORT
c_int
92
INTEGER(KIND=C_INT)
::
comin_state_get_error_code
93
END FUNCTION
comin_state_get_error_code
94
95
SUBROUTINE
comin_state_set_lstdout
(lstdout)
BIND(C)
96
IMPORT
c_bool
97
LOGICAL(KIND=C_BOOL)
,
INTENT(IN)
,
VALUE
:: lstdout
98
END SUBROUTINE
comin_state_set_lstdout
99
100
FUNCTION
comin_state_get_lstdout
()
BIND(C)
101
IMPORT
c_bool
102
LOGICAL(KIND=C_BOOL)
::
comin_state_get_lstdout
103
END FUNCTION
comin_state_get_lstdout
104
105
SUBROUTINE
comin_state_set_output_unit
(unit)
BIND(C)
106
IMPORT
c_int
107
INTEGER(KIND=C_INT)
,
INTENT(IN)
,
VALUE
:: unit
108
END SUBROUTINE
comin_state_set_output_unit
109
110
FUNCTION
comin_state_get_output_unit
()
BIND(C)
111
IMPORT
c_int
112
INTEGER(KIND=C_INT)
::
comin_state_get_output_unit
113
END FUNCTION
comin_state_get_output_unit
114
115
FUNCTION
comin_state_get_var_list
()
BIND(C)
116
IMPORT
c_ptr
117
TYPE
(c_ptr) ::
comin_state_get_var_list
118
END FUNCTION
comin_state_get_var_list
119
120
!> Get current entry point
121
!! @ingroup fortran_interface
122
FUNCTION
comin_current_get_ep
()
BIND(C)
123
IMPORT
c_int
124
INTEGER(c_int)
::
comin_current_get_ep
125
END FUNCTION
comin_current_get_ep
126
127
!> Returns the current domain ID if the entry point is called in a domain loop
128
!! @see COMIN_DOMAIN_OUTSIDE_LOOP
129
!! @ingroup fortran_interface
130
FUNCTION
comin_current_get_domain_id
()
BIND(C)
131
IMPORT
c_int
132
INTEGER(c_int)
::
comin_current_get_domain_id
133
END FUNCTION
comin_current_get_domain_id
134
135
SUBROUTINE
comin_current_set_plugin_id
(plugin_id)
BIND(C)
136
IMPORT
c_int
137
INTEGER(c_int)
,
VALUE
:: plugin_id
138
END SUBROUTINE
comin_current_set_plugin_id
139
140
FUNCTION
comin_current_get_plugin_id
()
BIND(C)
141
IMPORT
c_int
142
INTEGER(c_int)
::
comin_current_get_plugin_id
143
END FUNCTION
comin_current_get_plugin_id
144
145
FUNCTION
comin_state_is_primary_done
()
BIND(C)
146
IMPORT
c_bool
147
LOGICAL(c_bool)
::
comin_state_is_primary_done
148
END FUNCTION
comin_state_is_primary_done
149
150
SUBROUTINE
comin_state_set_primary_done
()
BIND(C)
151
END SUBROUTINE
comin_state_set_primary_done
152
153
SUBROUTINE
comin_descrdata_set_fct_glb2loc_cell_c(fct_ptr) bind(C, NAME='comin_descrdata_set_fct_glb2loc_cell')
154
IMPORT
:: c_funptr
155
TYPE
(c_funptr),
VALUE
,
INTENT(IN)
:: fct_ptr
156
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_cell_c
157
158
SUBROUTINE
comin_descrdata_set_fct_glb2loc_edge_c(fct_ptr) bind(C, NAME='comin_descrdata_set_fct_glb2loc_edge')
159
IMPORT
:: c_funptr
160
TYPE
(c_funptr),
VALUE
,
INTENT(IN)
:: fct_ptr
161
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_edge_c
162
163
SUBROUTINE
comin_descrdata_set_fct_glb2loc_vert_c(fct_ptr) bind(C, NAME='comin_descrdata_set_fct_glb2loc_vert')
164
IMPORT
:: c_funptr
165
TYPE
(c_funptr),
VALUE
,
INTENT(IN)
:: fct_ptr
166
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_vert_c
167
168
SUBROUTINE
comin_state_set_host_errhandler_fct
(fct_ptr) bind(C, NAME='comin_state_set_host_errhandler_fct')
169
IMPORT
:: c_funptr
170
TYPE
(c_funptr),
VALUE
,
INTENT(IN)
:: fct_ptr
171
END SUBROUTINE
comin_state_set_host_errhandler_fct
172
173
FUNCTION
comin_state_is_host_errhandler_set
()
BIND(C)
174
IMPORT
c_bool
175
LOGICAL(c_bool)
::
comin_state_is_host_errhandler_set
176
END FUNCTION
comin_state_is_host_errhandler_set
177
178
END INTERFACE
179
180
CONTAINS
181
182
!> Sets the "global-to-local" index lookup function.
183
SUBROUTINE
comin_descrdata_set_fct_glb2loc_cell
(fct)
184
PROCEDURE
(
comin_glb2loc_index_lookup_fct
) :: fct
!< index lookup function
185
TYPE
(c_funptr) :: fct_ptr
186
fct_ptr = c_funloc(fct)
187
CALL
comin_descrdata_set_fct_glb2loc_cell_c(fct_ptr)
188
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_cell
189
190
SUBROUTINE
comin_descrdata_set_fct_glb2loc_edge
(fct)
191
PROCEDURE
(
comin_glb2loc_index_lookup_fct
) :: fct
!< index lookup function
192
TYPE
(c_funptr) :: fct_ptr
193
fct_ptr = c_funloc(fct)
194
CALL
comin_descrdata_set_fct_glb2loc_edge_c(fct_ptr)
195
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_edge
196
197
SUBROUTINE
comin_descrdata_set_fct_glb2loc_vert
(fct)
198
PROCEDURE
(
comin_glb2loc_index_lookup_fct
) :: fct
!< index lookup function
199
TYPE
(c_funptr) :: fct_ptr
200
fct_ptr = c_funloc(fct)
201
CALL
comin_descrdata_set_fct_glb2loc_vert_c(fct_ptr)
202
END SUBROUTINE
comin_descrdata_set_fct_glb2loc_vert
203
204
END MODULE
comin_state
comin_descrdata_set_fct_glb2loc_cell
void comin_descrdata_set_fct_glb2loc_cell(t_comin_glb2loc_index_lookup_fct_ptr fct)
Definition
comin_state.cpp:164
comin_descrdata_set_fct_glb2loc_edge
void comin_descrdata_set_fct_glb2loc_edge(t_comin_glb2loc_index_lookup_fct_ptr fct)
Definition
comin_state.cpp:172
comin_descrdata_set_fct_glb2loc_vert
void comin_descrdata_set_fct_glb2loc_vert(t_comin_glb2loc_index_lookup_fct_ptr fct)
Definition
comin_state.cpp:180
comin_descrdata_types::t_comin_descrdata_global_data
Global data is invariant wrt the computational grid and never changed or updated.
Definition
comin_descrdata_types.F90:40
comin_descrdata_types::t_comin_descrdata_domain_data
Patch grid data structure, gathering information on grids.
Definition
comin_descrdata_types.F90:466
comin_state::comin_current_get_ep
Get current entry point.
Definition
comin_state.F90:122
comin_state::comin_current_get_domain_id
Returns the current domain ID if the entry point is called in a domain loop.
Definition
comin_state.F90:130
comin_descrdata_types::comin_glb2loc_index_lookup_fct
Definition
comin_descrdata_types.F90:513
comin_state::comin_current_get_plugin_id
Definition
comin_state.F90:140
comin_state::comin_current_set_plugin_id
Definition
comin_state.F90:135
comin_state::comin_setup_get_verbosity_level
Definition
comin_state.F90:80
comin_state::comin_setup_set_verbosity_level
Definition
comin_state.F90:75
comin_state::comin_state_get_error_code
Definition
comin_state.F90:90
comin_state::comin_state_get_lstdout
Definition
comin_state.F90:100
comin_state::comin_state_get_num_plugins
Definition
comin_state.F90:70
comin_state::comin_state_get_output_unit
Definition
comin_state.F90:110
comin_state::comin_state_get_var_list
Definition
comin_state.F90:115
comin_state::comin_state_is_host_errhandler_set
Definition
comin_state.F90:173
comin_state::comin_state_is_primary_done
Definition
comin_state.F90:145
comin_state::comin_state_set_error_code
Definition
comin_state.F90:85
comin_state::comin_state_set_host_errhandler_fct
Definition
comin_state.F90:168
comin_state::comin_state_set_lstdout
Definition
comin_state.F90:95
comin_state::comin_state_set_num_plugins
Definition
comin_state.F90:65
comin_state::comin_state_set_output_unit
Definition
comin_state.F90:105
comin_state::comin_state_set_primary_done
Definition
comin_state.F90:150
comin_descrdata_types
Definition
comin_descrdata_types.F90:12
comin_parallel_types
Definition
comin_parallel_types.F90:12
comin_parallel_types::t_comin_parallel_info
Definition
comin_parallel_types.F90:24
comin_state
Definition
comin_state.F90:12
comin_state::state
type(t_comin_state), pointer, public state
Definition
comin_state.F90:61
comin_state::t_comin_state
Definition
comin_state.F90:48
src
comin_state.F90
Generated by
1.13.2