Debian Codegraph @

fortran/include/kim_model_compute_arguments_destroy_module.f90

raw
1 !
2 ! KIM-API: An API for interatomic models
3 ! Copyright (c) 2013--2022, Regents of the University of Minnesota.
4 ! All rights reserved.
5 !
6 ! Contributors:
7 ! Ryan S. Elliott
8 !
9 ! SPDX-License-Identifier: LGPL-2.1-or-later
10 !
11 ! This library is free software; you can redistribute it and/or
12 ! modify it under the terms of the GNU Lesser General Public
13 ! License as published by the Free Software Foundation; either
14 ! version 2.1 of the License, or (at your option) any later version.
15 !
16 ! This library is distributed in the hope that it will be useful,
17 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ! Lesser General Public License for more details.
20 !
21 ! You should have received a copy of the GNU Lesser General Public License
22 ! along with this library; if not, write to the Free Software Foundation,
23 ! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 !
25
26 !
27 ! Release: This file is part of the kim-api.git repository.
28 !
29
30 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy
31 !!
32 !! \sa KIM::ModelComputeArgumentsDestroy, KIM_ModelComputeArgumentsDestroy
33 !!
34 !! \since 2.0
35 module kim_model_compute_arguments_destroy_module
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
42 kim_model_compute_arguments_destroy_handle_type, &
43 ! Constants
44 KIM_MODEL_COMPUTE_ARGUMENTS_DESTROY_NULL_HANDLE, &
45 ! Routines
46 operator(.eq.), &
47 operator(.ne.), &
48 kim_get_model_buffer_pointer, &
49 kim_log_entry, &
50 kim_to_string
51
52 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy
53 !!
54 !! \sa KIM::ModelComputeArgumentsDestroy, KIM_ModelComputeArgumentsDestroy
55 !!
56 !! \since 2.0
57 type, bind(c) :: kim_model_compute_arguments_destroy_handle_type
58 type(c_ptr) :: p = c_null_ptr
59 end type kim_model_compute_arguments_destroy_handle_type
60
61 !> \brief NULL handle for use in comparisons.
62 !!
63 !! \since 2.0
64 type(kim_model_compute_arguments_destroy_handle_type), protected, save &
65 :: KIM_MODEL_COMPUTE_ARGUMENTS_DESTROY_NULL_HANDLE
66
67 !> \brief Compares kim_model_compute_arguments_destroy_handle_type's for
68 !! equality.
69 !!
70 !! \since 2.0
71 interface operator(.eq.)
72 module procedure kim_model_compute_arguments_destroy_handle_equal
73 end interface operator(.eq.)
74
75 !> \brief Compares kim_model_compute_arguments_destroy_handle_type's for
76 !! inequality.
77 !!
78 !! \since 2.0
79 interface operator(.ne.)
80 module procedure kim_model_compute_arguments_destroy_handle_not_equal
81 end interface operator(.ne.)
82
83 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::<!--
84 !! -->GetModelBufferPointer
85 !!
86 !! \sa KIM::ModelComputeArgumentsDestroy::GetModelBufferPointer,
87 !! KIM_ModelComputeArgumentsDestroy_GetModelBufferPointer
88 !!
89 !! \since 2.0
90 interface kim_get_model_buffer_pointer
91 module procedure &
92 kim_model_compute_arguments_destroy_get_model_buffer_pointer
93 end interface kim_get_model_buffer_pointer
94
95 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::LogEntry
96 !!
97 !! \sa KIM::ModelComputeArgumentsDestroy::LogEntry,
98 !! KIM_ModelComputeArgumentsDestroy_LogEntry
99 !!
100 !! \since 2.0
101 interface kim_log_entry
102 module procedure kim_model_compute_arguments_destroy_log_entry
103 end interface kim_log_entry
104
105 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::ToString
106 !!
107 !! \sa KIM::ModelComputeArgumentsDestroy::ToString,
108 !! KIM_ModelComputeArgumentsDestroy_ToString
109 !!
110 !! \since 2.0
111 interface kim_to_string
112 module procedure kim_model_compute_arguments_destroy_to_string
113 end interface kim_to_string
114
115 contains
116 !> \brief Compares kim_model_compute_arguments_destroy_handle_type's for
117 !! equality.
118 !!
119 !! \since 2.0
120 logical recursive function kim_model_compute_arguments_destroy_handle_equal( &
121 lhs, rhs)
122 implicit none
123 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: lhs
124 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: rhs
125
126 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
127 kim_model_compute_arguments_destroy_handle_equal = .true.
128 else
129 kim_model_compute_arguments_destroy_handle_equal = c_associated(lhs%p, &
130 rhs%p)
131 end if
132 end function kim_model_compute_arguments_destroy_handle_equal
133
134 !> \brief Compares kim_model_compute_arguments_destroy_handle_type's for
135 !! inequality.
136 !!
137 !! \since 2.0
138 logical recursive function &
139 kim_model_compute_arguments_destroy_handle_not_equal(lhs, rhs)
140 implicit none
141 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: lhs
142 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: rhs
143
144 kim_model_compute_arguments_destroy_handle_not_equal = &
145 .not. (lhs == rhs)
146 end function kim_model_compute_arguments_destroy_handle_not_equal
147
148 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::<!--
149 !! -->GetModelBufferPointer
150 !!
151 !! \sa KIM::ModelComputeArgumentsDestroy::GetModelBufferPointer,
152 !! KIM_ModelComputeArgumentsDestroy_GetModelBufferPointer
153 !!
154 !! \since 2.0
155 recursive subroutine &
156 kim_model_compute_arguments_destroy_get_model_buffer_pointer( &
157 model_compute_arguments_destroy_handle, ptr)
158 use kim_interoperable_types_module, only: &
159 kim_model_compute_arguments_destroy_type
160 implicit none
161 interface
162 recursive subroutine get_model_buffer_pointer( &
163 model_compute_arguments_destroy, ptr) &
164 bind(c, name="KIM_ModelComputeArgumentsDestroy_GetModelBufferPointer")
165 use, intrinsic :: iso_c_binding
166 use kim_interoperable_types_module, only: &
167 kim_model_compute_arguments_destroy_type
168 implicit none
169 type(kim_model_compute_arguments_destroy_type), intent(in) :: &
170 model_compute_arguments_destroy
171 type(c_ptr), intent(out) :: ptr
172 end subroutine get_model_buffer_pointer
173 end interface
174 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: &
175 model_compute_arguments_destroy_handle
176 type(c_ptr), intent(out) :: ptr
177 type(kim_model_compute_arguments_destroy_type), pointer :: &
178 model_compute_arguments_destroy
179
180 call c_f_pointer(model_compute_arguments_destroy_handle%p, &
181 model_compute_arguments_destroy)
182 call get_model_buffer_pointer(model_compute_arguments_destroy, ptr)
183 end subroutine kim_model_compute_arguments_destroy_get_model_buffer_pointer
184
185 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::LogEntry
186 !!
187 !! \sa KIM::ModelComputeArgumentsDestroy::LogEntry,
188 !! KIM_ModelComputeArgumentsDestroy_LogEntry
189 !!
190 !! \since 2.0
191 recursive subroutine kim_model_compute_arguments_destroy_log_entry( &
192 model_compute_arguments_destroy_handle, log_verbosity, message)
193 use kim_log_verbosity_module, only: kim_log_verbosity_type
194 use kim_interoperable_types_module, only: &
195 kim_model_compute_arguments_destroy_type
196 implicit none
197 interface
198 recursive subroutine log_entry( &
199 model_compute_arguments_destroy, log_verbosity, message, line_number, &
200 file_name) bind(c, name="KIM_ModelComputeArgumentsDestroy_LogEntry")
201 use, intrinsic :: iso_c_binding
202 use kim_log_verbosity_module, only: kim_log_verbosity_type
203 use kim_interoperable_types_module, only: &
204 kim_model_compute_arguments_destroy_type
205 implicit none
206 type(kim_model_compute_arguments_destroy_type), intent(in) :: &
207 model_compute_arguments_destroy
208 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
209 character(c_char), intent(in) :: message(*)
210 integer(c_int), intent(in), value :: line_number
211 character(c_char), intent(in) :: file_name(*)
212 end subroutine log_entry
213 end interface
214 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: &
215 model_compute_arguments_destroy_handle
216 type(kim_log_verbosity_type), intent(in) :: log_verbosity
217 character(len=*, kind=c_char), intent(in) :: message
218 type(kim_model_compute_arguments_destroy_type), pointer :: &
219 model_compute_arguments_destroy
220
221 call c_f_pointer(model_compute_arguments_destroy_handle%p, &
222 model_compute_arguments_destroy)
223 call log_entry(model_compute_arguments_destroy, log_verbosity, &
224 trim(message)//c_null_char, 0, ""//c_null_char)
225 end subroutine kim_model_compute_arguments_destroy_log_entry
226
227 !> \brief \copybrief KIM::ModelComputeArgumentsDestroy::ToString
228 !!
229 !! \sa KIM::ModelComputeArgumentsDestroy::ToString,
230 !! KIM_ModelComputeArgumentsDestroy_ToString
231 !!
232 !! \since 2.0
233 recursive subroutine kim_model_compute_arguments_destroy_to_string( &
234 model_compute_arguments_destroy_handle, string)
235 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
236 use kim_interoperable_types_module, only: &
237 kim_model_compute_arguments_destroy_type
238 implicit none
239 interface
240 type(c_ptr) recursive function model_compute_arguments_destroy_string( &
241 model_compute_arguments_destroy) &
242 bind(c, name="KIM_ModelComputeArgumentsDestroy_ToString")
243 use, intrinsic :: iso_c_binding
244 use kim_interoperable_types_module, only: &
245 kim_model_compute_arguments_destroy_type
246 implicit none
247 type(kim_model_compute_arguments_destroy_type), intent(in) :: &
248 model_compute_arguments_destroy
249 end function model_compute_arguments_destroy_string
250 end interface
251 type(kim_model_compute_arguments_destroy_handle_type), intent(in) :: &
252 model_compute_arguments_destroy_handle
253 character(len=*, kind=c_char), intent(out) :: string
254 type(kim_model_compute_arguments_destroy_type), pointer :: &
255 model_compute_arguments_destroy
256
257 type(c_ptr) :: p
258
259 call c_f_pointer(model_compute_arguments_destroy_handle%p, &
260 model_compute_arguments_destroy)
261 p = model_compute_arguments_destroy_string(model_compute_arguments_destroy)
262 call kim_convert_c_char_ptr_to_string(p, string)
263 end subroutine kim_model_compute_arguments_destroy_to_string
264 end module kim_model_compute_arguments_destroy_module