kim-api 2.3.0+AppleClang.AppleClang.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
Loading...
Searching...
No Matches
kim_log_verbosity_module.f90
Go to the documentation of this file.
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-2.3.0 package.
28!
29
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
43 ! Constants
50 ! Routines
51 kim_known, &
52 operator(.lt.), &
53 operator(.gt.), &
54 operator(.le.), &
55 operator(.ge.), &
56 operator(.eq.), &
57 operator(.ne.), &
62
68 type, bind(c) :: kim_log_verbosity_type
74 integer(c_int) :: log_verbosity_id
76
82 type(kim_log_verbosity_type), protected, save, &
83 bind(c, name="KIM_LOG_VERBOSITY_silent") &
85
91 type(kim_log_verbosity_type), protected, save, &
92 bind(c, name="KIM_LOG_VERBOSITY_fatal") &
94
100 type(kim_log_verbosity_type), protected, save, &
101 bind(c, name="KIM_LOG_VERBOSITY_error") &
103
109 type(kim_log_verbosity_type), protected, save, &
110 bind(c, name="KIM_LOG_VERBOSITY_warning") &
112
118 type(kim_log_verbosity_type), protected, save, &
119 bind(c, name="KIM_LOG_VERBOSITY_information") &
121
127 type(kim_log_verbosity_type), protected, save, &
128 bind(c, name="KIM_LOG_VERBOSITY_debug") &
130
136 interface kim_known
137 module procedure kim_log_verbosity_known
138 end interface kim_known
139
145 interface operator(.lt.)
146 module procedure kim_log_verbosity_less_than
147 end interface operator(.lt.)
148
154 interface operator(.gt.)
155 module procedure kim_log_verbosity_greater_than
156 end interface operator(.gt.)
157
163 interface operator(.le.)
164 module procedure kim_log_verbosity_less_than_equal
165 end interface operator(.le.)
166
172 interface operator(.ge.)
173 module procedure kim_log_verbosity_greater_than_equal
174 end interface operator(.ge.)
175
181 interface operator(.eq.)
182 module procedure kim_log_verbosity_equal
183 end interface operator(.eq.)
184
190 interface operator(.ne.)
191 module procedure kim_log_verbosity_not_equal
192 end interface operator(.ne.)
193
201 module procedure kim_log_verbosity_from_string
202 end interface kim_from_string
203
210 module procedure kim_log_verbosity_to_string
211 end interface kim_to_string
212
213contains
219 logical recursive function kim_log_verbosity_known(log_verbosity)
220 implicit none
221 interface
222 integer(c_int) recursive function known(log_verbosity) &
223 bind(c, name="KIM_LogVerbosity_Known")
224 use, intrinsic :: iso_c_binding
226 implicit none
227 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
228 end function known
229 end interface
230 type(kim_log_verbosity_type), intent(in) :: log_verbosity
231
232 kim_log_verbosity_known = (known(log_verbosity) /= 0)
233 end function kim_log_verbosity_known
234
240 logical recursive function kim_log_verbosity_less_than(lhs, rhs)
241 implicit none
242 type(kim_log_verbosity_type), intent(in) :: lhs
243 type(kim_log_verbosity_type), intent(in) :: rhs
244
245 kim_log_verbosity_less_than &
246 = (lhs%log_verbosity_id < rhs%log_verbosity_id)
247 end function kim_log_verbosity_less_than
248
254 logical recursive function kim_log_verbosity_greater_than(lhs, rhs)
255 implicit none
256 type(kim_log_verbosity_type), intent(in) :: lhs
257 type(kim_log_verbosity_type), intent(in) :: rhs
258
259 kim_log_verbosity_greater_than &
260 = (lhs%log_verbosity_id >= rhs%log_verbosity_id)
261 end function kim_log_verbosity_greater_than
262
268 logical recursive function kim_log_verbosity_less_than_equal(lhs, rhs)
269 implicit none
270 type(kim_log_verbosity_type), intent(in) :: lhs
271 type(kim_log_verbosity_type), intent(in) :: rhs
272
273 kim_log_verbosity_less_than_equal &
274 = (lhs%log_verbosity_id <= rhs%log_verbosity_id)
275 end function kim_log_verbosity_less_than_equal
276
282 logical recursive function kim_log_verbosity_greater_than_equal(lhs, rhs)
283 implicit none
284 type(kim_log_verbosity_type), intent(in) :: lhs
285 type(kim_log_verbosity_type), intent(in) :: rhs
286
287 kim_log_verbosity_greater_than_equal &
288 = (lhs%log_verbosity_id >= rhs%log_verbosity_id)
289 end function kim_log_verbosity_greater_than_equal
290
296 logical recursive function kim_log_verbosity_equal(lhs, rhs)
297 implicit none
298 type(kim_log_verbosity_type), intent(in) :: lhs
299 type(kim_log_verbosity_type), intent(in) :: rhs
300
301 kim_log_verbosity_equal &
302 = (lhs%log_verbosity_id == rhs%log_verbosity_id)
303 end function kim_log_verbosity_equal
304
310 logical recursive function kim_log_verbosity_not_equal(lhs, rhs)
311 implicit none
312 type(kim_log_verbosity_type), intent(in) :: lhs
313 type(kim_log_verbosity_type), intent(in) :: rhs
314
315 kim_log_verbosity_not_equal = .not. (lhs == rhs)
316 end function kim_log_verbosity_not_equal
317
324 recursive subroutine kim_log_verbosity_from_string(string, log_verbosity)
325 implicit none
326 interface
327 type(kim_log_verbosity_type) recursive function from_string(string) &
328 bind(c, name="KIM_LogVerbosity_FromString")
329 use, intrinsic :: iso_c_binding
331 implicit none
332 character(c_char), intent(in) :: string(*)
333 end function from_string
334 end interface
335 character(len=*, kind=c_char), intent(in) :: string
336 type(kim_log_verbosity_type), intent(out) :: log_verbosity
337
338 log_verbosity = from_string(trim(string)//c_null_char)
339 end subroutine kim_log_verbosity_from_string
340
346 recursive subroutine kim_log_verbosity_to_string(log_verbosity, string)
347 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
348 implicit none
349 interface
350 type(c_ptr) recursive function get_string(log_verbosity) &
351 bind(c, name="KIM_LogVerbosity_ToString")
352 use, intrinsic :: iso_c_binding
354 implicit none
355 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
356 end function get_string
357 end interface
358 type(kim_log_verbosity_type), intent(in) :: log_verbosity
359 character(len=*, kind=c_char), intent(out) :: string
360
361 type(c_ptr) :: p
362
363 p = get_string(log_verbosity)
364 call kim_convert_c_char_ptr_to_string(p, string)
365 end subroutine kim_log_verbosity_to_string
366
373 recursive subroutine kim_get_number_of_log_verbosities( &
374 number_of_log_verbosities)
375 implicit none
376 interface
377 recursive subroutine get_number_of_log_verbosities( &
378 number_of_log_verbosities) &
379 bind(c, name="KIM_LOG_VERBOSITY_GetNumberOfLogVerbosities")
380 use, intrinsic :: iso_c_binding
381 implicit none
382 integer(c_int), intent(out) :: number_of_log_verbosities
383 end subroutine get_number_of_log_verbosities
384 end interface
385 integer(c_int), intent(out) :: number_of_log_verbosities
386
387 call get_number_of_log_verbosities(number_of_log_verbosities)
389
395 recursive subroutine kim_get_log_verbosity(index, log_verbosity, ierr)
396 implicit none
397 interface
398 integer(c_int) recursive function get_log_verbosity( &
399 index, log_verbosity) bind(c, name="KIM_LOG_VERBOSITY_GetLogVerbosity")
400 use, intrinsic :: iso_c_binding
402 implicit none
403 integer(c_int), intent(in), value :: index
404 type(kim_log_verbosity_type), intent(out) :: log_verbosity
405 end function get_log_verbosity
406 end interface
407 integer(c_int), intent(in) :: index
408 type(kim_log_verbosity_type), intent(out) :: log_verbosity
409 integer(c_int), intent(out) :: ierr
410
411 ierr = get_log_verbosity(index - 1, log_verbosity)
412 end subroutine kim_get_log_verbosity
Create a LogVerbosity object corresponding to the provided string. If the string does not match one o...
Determines if the object is a quantity known to the KIM API.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_warning"), public, protected kim_log_verbosity_warning
The standard warning verbosity.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_fatal"), public, protected kim_log_verbosity_fatal
The standard fatal verbosity.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_information"), public, protected kim_log_verbosity_information
The standard information verbosity.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_silent"), public, protected kim_log_verbosity_silent
The standard silent verbosity.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_debug"), public, protected kim_log_verbosity_debug
The standard debug verbosity.
type(kim_log_verbosity_type), save, bind(C, name="KIM_LOG_VERBOSITY_error"), public, protected kim_log_verbosity_error
The standard error verbosity.
recursive subroutine, public kim_get_log_verbosity(index, log_verbosity, ierr)
Get the identity of each defined standard LogVerbosity.
recursive subroutine, public kim_get_number_of_log_verbosities(number_of_log_verbosities)
Get the number of standard LogVerbosity's defined by the KIM API.
An Extensible Enumeration for the LogVerbosity's supported by the KIM API.