kim-api  2.2.1+v2.2.1.GNU.GNU.
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_log_verbosity_module.f90
Go to the documentation of this file.
1 !
2 ! CDDL HEADER START
3 !
4 ! The contents of this file are subject to the terms of the Common Development
5 ! and Distribution License Version 1.0 (the "License").
6 !
7 ! You can obtain a copy of the license at
8 ! http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 ! specific language governing permissions and limitations under the License.
10 !
11 ! When distributing Covered Code, include this CDDL HEADER in each file and
12 ! include the License file in a prominent location with the name LICENSE.CDDL.
13 ! If applicable, add the following below this CDDL HEADER, with the fields
14 ! enclosed by brackets "[]" replaced with your own identifying information:
15 !
16 ! Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 !
18 ! CDDL HEADER END
19 !
20 
21 !
22 ! Copyright (c) 2016--2020, Regents of the University of Minnesota.
23 ! All rights reserved.
24 !
25 ! Contributors:
26 ! Ryan S. Elliott
27 !
28 
29 !
30 ! Release: This file is part of the kim-api-2.2.1 package.
31 !
32 
39  use, intrinsic :: iso_c_binding
40  implicit none
41  private
42 
43  public &
44  ! Derived types
45  kim_log_verbosity_type, &
46  ! Constants
53  ! Routines
54  kim_known, &
55  operator(.lt.), &
56  operator(.gt.), &
57  operator(.le.), &
58  operator(.ge.), &
59  operator(.eq.), &
60  operator(.ne.), &
61  kim_from_string, &
62  kim_to_string, &
65 
71  type, bind(c) :: kim_log_verbosity_type
77  integer(c_int) :: log_verbosity_id
78  end type kim_log_verbosity_type
79 
85  type(kim_log_verbosity_type), protected, save, &
86  bind(c, name="KIM_LOG_VERBOSITY_silent") &
88 
94  type(kim_log_verbosity_type), protected, save, &
95  bind(c, name="KIM_LOG_VERBOSITY_fatal") &
97 
103  type(kim_log_verbosity_type), protected, save, &
104  bind(c, name="KIM_LOG_VERBOSITY_error") &
106 
112  type(kim_log_verbosity_type), protected, save, &
113  bind(c, name="KIM_LOG_VERBOSITY_warning") &
115 
121  type(kim_log_verbosity_type), protected, save, &
122  bind(c, name="KIM_LOG_VERBOSITY_information") &
124 
130  type(kim_log_verbosity_type), protected, save, &
131  bind(c, name="KIM_LOG_VERBOSITY_debug") &
133 
139  interface kim_known
140  module procedure kim_log_verbosity_known
141  end interface kim_known
142 
148  interface operator(.lt.)
149  module procedure kim_log_verbosity_less_than
150  end interface operator(.lt.)
151 
157  interface operator(.gt.)
158  module procedure kim_log_verbosity_greater_than
159  end interface operator(.gt.)
160 
166  interface operator(.le.)
167  module procedure kim_log_verbosity_less_than_equal
168  end interface operator(.le.)
169 
175  interface operator(.ge.)
176  module procedure kim_log_verbosity_greater_than_equal
177  end interface operator(.ge.)
178 
184  interface operator(.eq.)
185  module procedure kim_log_verbosity_equal
186  end interface operator(.eq.)
187 
193  interface operator(.ne.)
194  module procedure kim_log_verbosity_not_equal
195  end interface operator(.ne.)
196 
203  interface kim_from_string
204  module procedure kim_log_verbosity_from_string
205  end interface kim_from_string
206 
212  interface kim_to_string
213  module procedure kim_log_verbosity_to_string
214  end interface kim_to_string
215 
216 contains
222  logical recursive function kim_log_verbosity_known(log_verbosity)
223  implicit none
224  interface
225  integer(c_int) recursive function known(log_verbosity) &
226  bind(c, name="KIM_LogVerbosity_Known")
227  use, intrinsic :: iso_c_binding
228  import kim_log_verbosity_type
229  implicit none
230  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
231  end function known
232  end interface
233  type(kim_log_verbosity_type), intent(in) :: log_verbosity
234 
235  kim_log_verbosity_known = (known(log_verbosity) /= 0)
236  end function kim_log_verbosity_known
237 
243  logical recursive function kim_log_verbosity_less_than(lhs, rhs)
244  implicit none
245  type(kim_log_verbosity_type), intent(in) :: lhs
246  type(kim_log_verbosity_type), intent(in) :: rhs
247 
248  kim_log_verbosity_less_than &
249  = (lhs%log_verbosity_id < rhs%log_verbosity_id)
250  end function kim_log_verbosity_less_than
251 
257  logical recursive function kim_log_verbosity_greater_than(lhs, rhs)
258  implicit none
259  type(kim_log_verbosity_type), intent(in) :: lhs
260  type(kim_log_verbosity_type), intent(in) :: rhs
261 
262  kim_log_verbosity_greater_than &
263  = (lhs%log_verbosity_id >= rhs%log_verbosity_id)
264  end function kim_log_verbosity_greater_than
265 
271  logical recursive function kim_log_verbosity_less_than_equal(lhs, rhs)
272  implicit none
273  type(kim_log_verbosity_type), intent(in) :: lhs
274  type(kim_log_verbosity_type), intent(in) :: rhs
275 
276  kim_log_verbosity_less_than_equal &
277  = (lhs%log_verbosity_id <= rhs%log_verbosity_id)
278  end function kim_log_verbosity_less_than_equal
279 
285  logical recursive function kim_log_verbosity_greater_than_equal(lhs, rhs)
286  implicit none
287  type(kim_log_verbosity_type), intent(in) :: lhs
288  type(kim_log_verbosity_type), intent(in) :: rhs
289 
290  kim_log_verbosity_greater_than_equal &
291  = (lhs%log_verbosity_id >= rhs%log_verbosity_id)
292  end function kim_log_verbosity_greater_than_equal
293 
299  logical recursive function kim_log_verbosity_equal(lhs, rhs)
300  implicit none
301  type(kim_log_verbosity_type), intent(in) :: lhs
302  type(kim_log_verbosity_type), intent(in) :: rhs
303 
304  kim_log_verbosity_equal &
305  = (lhs%log_verbosity_id == rhs%log_verbosity_id)
306  end function kim_log_verbosity_equal
307 
313  logical recursive function kim_log_verbosity_not_equal(lhs, rhs)
314  implicit none
315  type(kim_log_verbosity_type), intent(in) :: lhs
316  type(kim_log_verbosity_type), intent(in) :: rhs
317 
318  kim_log_verbosity_not_equal = .not. (lhs == rhs)
319  end function kim_log_verbosity_not_equal
320 
327  recursive subroutine kim_log_verbosity_from_string(string, log_verbosity)
328  implicit none
329  interface
330  type(kim_log_verbosity_type) recursive function from_string(string) &
331  bind(c, name="KIM_LogVerbosity_FromString")
332  use, intrinsic :: iso_c_binding
333  import kim_log_verbosity_type
334  implicit none
335  character(c_char), intent(in) :: string(*)
336  end function from_string
337  end interface
338  character(len=*, kind=c_char), intent(in) :: string
339  type(kim_log_verbosity_type), intent(out) :: log_verbosity
340 
341  log_verbosity = from_string(trim(string)//c_null_char)
342  end subroutine kim_log_verbosity_from_string
343 
349  recursive subroutine kim_log_verbosity_to_string(log_verbosity, string)
350  use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
351  implicit none
352  interface
353  type(c_ptr) recursive function get_string(log_verbosity) &
354  bind(c, name="KIM_LogVerbosity_ToString")
355  use, intrinsic :: iso_c_binding
356  import kim_log_verbosity_type
357  implicit none
358  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
359  end function get_string
360  end interface
361  type(kim_log_verbosity_type), intent(in) :: log_verbosity
362  character(len=*, kind=c_char), intent(out) :: string
363 
364  type(c_ptr) :: p
365 
366  p = get_string(log_verbosity)
367  call kim_convert_c_char_ptr_to_string(p, string)
368  end subroutine kim_log_verbosity_to_string
369 
376  recursive subroutine kim_get_number_of_log_verbosities( &
377  number_of_log_verbosities)
378  implicit none
379  interface
380  recursive subroutine get_number_of_log_verbosities( &
381  number_of_log_verbosities) &
382  bind(c, name="KIM_LOG_VERBOSITY_GetNumberOfLogVerbosities")
383  use, intrinsic :: iso_c_binding
384  implicit none
385  integer(c_int), intent(out) :: number_of_log_verbosities
386  end subroutine get_number_of_log_verbosities
387  end interface
388  integer(c_int), intent(out) :: number_of_log_verbosities
389 
390  call get_number_of_log_verbosities(number_of_log_verbosities)
391  end subroutine kim_get_number_of_log_verbosities
392 
398  recursive subroutine kim_get_log_verbosity(index, log_verbosity, ierr)
399  implicit none
400  interface
401  integer(c_int) recursive function get_log_verbosity( &
402  index, log_verbosity) bind(c, name="KIM_LOG_VERBOSITY_GetLogVerbosity")
403  use, intrinsic :: iso_c_binding
404  import kim_log_verbosity_type
405  implicit none
406  integer(c_int), intent(in), value :: index
407  type(kim_log_verbosity_type), intent(out) :: log_verbosity
408  end function get_log_verbosity
409  end interface
410  integer(c_int), intent(in) :: index
411  type(kim_log_verbosity_type), intent(out) :: log_verbosity
412  integer(c_int), intent(out) :: ierr
413 
414  ierr = get_log_verbosity(index - 1, log_verbosity)
415  end subroutine kim_get_log_verbosity
416 end module kim_log_verbosity_module
recursive subroutine, public kim_get_number_of_log_verbosities(number_of_log_verbosities)
Get the number of standard LogVerbosity&#39;s defined by the KIM API.
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_debug
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_silent
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_warning
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_fatal
recursive subroutine, public kim_get_log_verbosity(index, log_verbosity, ierr)
Get the identity of each defined standard LogVerbosity.
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_error
An Extensible Enumeration for the LogVerbosity&#39;s supported by the KIM API.
type(kim_log_verbosity_type), save, public, protected kim_log_verbosity_information