kim-api  2.1.2+v2.1.2.GNU
An Application Programming Interface (API) for the Knowledgebase of Interatomic Models (KIM).
kim_model_routine_name_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--2019, 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.1.2 package.
31 !
32 
33 
40  use, intrinsic :: iso_c_binding
41  implicit none
42  private
43 
44  public &
45  ! Derived types
46  kim_model_routine_name_type, &
47 
48  ! Constants
57 
58  ! Routines
59  kim_known, &
60  operator (.eq.), &
61  operator (.ne.), &
62  kim_from_string, &
63  kim_to_string, &
66 
67 
73  type, bind(c) :: kim_model_routine_name_type
80  integer(c_int) model_routine_name_id
81  end type kim_model_routine_name_type
82 
88  type(kim_model_routine_name_type), protected, save, &
89  bind(c, name="KIM_MODEL_ROUTINE_NAME_Create") &
91 
98  type(kim_model_routine_name_type), protected, save, &
99  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate") &
101 
107  type(kim_model_routine_name_type), protected, save, &
108  bind(c, name="KIM_MODEL_ROUTINE_NAME_Compute") &
110 
116  type(kim_model_routine_name_type), protected, save, &
117  bind(c, name="KIM_MODEL_ROUTINE_NAME_Extension") &
119 
125  type(kim_model_routine_name_type), protected, save, &
126  bind(c, name="KIM_MODEL_ROUTINE_NAME_Refresh") &
128 
135  type(kim_model_routine_name_type), protected, save, &
136  bind(c, name="KIM_MODEL_ROUTINE_NAME_WriteParameterizedModel") &
138 
145  type(kim_model_routine_name_type), protected, save, &
146  bind(c, name="KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy") &
148 
154  type(kim_model_routine_name_type), protected, save, &
155  bind(c, name="KIM_MODEL_ROUTINE_NAME_Destroy") &
157 
163  interface kim_known
164  module procedure kim_model_routine_name_known
165  end interface kim_known
166 
172  interface operator (.eq.)
173  module procedure kim_model_routine_name_equal
174  end interface operator (.eq.)
175 
181  interface operator (.ne.)
182  module procedure kim_model_routine_name_not_equal
183  end interface operator (.ne.)
184 
192  interface kim_from_string
193  module procedure kim_model_routine_name_from_string
194  end interface kim_from_string
195 
201  interface kim_to_string
202  module procedure kim_model_routine_name_to_string
203  end interface kim_to_string
204 
205 contains
211  logical recursive function kim_model_routine_name_known(model_routine_name)
212  implicit none
213  interface
214  integer(c_int) recursive function known(model_routine_name) &
215  bind(c, name="KIM_ModelRoutineName_Known")
216  use, intrinsic :: iso_c_binding
217  import kim_model_routine_name_type
218  implicit none
219  type(kim_model_routine_name_type), intent(in), value :: &
220  model_routine_name
221  end function known
222  end interface
223  type(kim_model_routine_name_type), intent(in) :: model_routine_name
224 
225  kim_model_routine_name_known = (known(model_routine_name) /= 0)
226  end function kim_model_routine_name_known
227 
233  logical recursive function kim_model_routine_name_equal(lhs, rhs)
234  implicit none
235  type(kim_model_routine_name_type), intent(in) :: lhs
236  type(kim_model_routine_name_type), intent(in) :: rhs
237 
238  kim_model_routine_name_equal &
239  = (lhs%model_routine_name_id .eq. rhs%model_routine_name_id)
240  end function kim_model_routine_name_equal
241 
247  logical recursive function kim_model_routine_name_not_equal(lhs, rhs)
248  implicit none
249  type(kim_model_routine_name_type), intent(in) :: lhs
250  type(kim_model_routine_name_type), intent(in) :: rhs
251 
252  kim_model_routine_name_not_equal = .not. (lhs .eq. rhs)
253  end function kim_model_routine_name_not_equal
254 
262  recursive subroutine kim_model_routine_name_from_string(string, &
263  model_routine_name)
264  implicit none
265  interface
266  type(kim_model_routine_name_type) recursive function from_string(string) &
267  bind(c, name="KIM_ModelRoutineName_FromString")
268  use, intrinsic :: iso_c_binding
269  import kim_model_routine_name_type
270  implicit none
271  character(c_char), intent(in) :: string(*)
272  end function from_string
273  end interface
274  character(len=*, kind=c_char), intent(in) :: string
275  type(kim_model_routine_name_type), intent(out) :: model_routine_name
276 
277  model_routine_name = from_string(trim(string)//c_null_char)
278  end subroutine kim_model_routine_name_from_string
279 
285  recursive subroutine kim_model_routine_name_to_string(model_routine_name, &
286  string)
287  use kim_convert_string_module, only : kim_convert_c_char_ptr_to_string
288  implicit none
289  interface
290  type(c_ptr) recursive function get_string(model_routine_name) &
291  bind(c, name="KIM_ModelRoutineName_ToString")
292  use, intrinsic :: iso_c_binding
293  import kim_model_routine_name_type
294  implicit none
295  type(kim_model_routine_name_type), intent(in), value :: &
296  model_routine_name
297  end function get_string
298  end interface
299  type(kim_model_routine_name_type), intent(in) :: &
300  model_routine_name
301  character(len=*, kind=c_char), intent(out) :: string
302 
303  type(c_ptr) :: p
304 
305  p = get_string(model_routine_name)
306  call kim_convert_c_char_ptr_to_string(p, string)
307  end subroutine kim_model_routine_name_to_string
308 
315  recursive subroutine kim_get_number_of_model_routine_names( &
316  number_of_model_routine_names)
317  implicit none
318  interface
319  recursive subroutine get_number_of_model_routine_names( &
320  number_of_model_routine_names) &
321  bind(c, &
322  name="KIM_MODEL_ROUTINE_NAME_GetNumberOfModelRoutineNames")
323  use, intrinsic :: iso_c_binding
324  integer(c_int), intent(out) :: number_of_model_routine_names
325  end subroutine get_number_of_model_routine_names
326  end interface
327  integer(c_int), intent(out) :: number_of_model_routine_names
328 
329  call get_number_of_model_routine_names(number_of_model_routine_names)
331 
338  recursive subroutine kim_get_model_routine_name(index, &
339  model_routine_name, ierr)
340  implicit none
341  interface
342  integer(c_int) recursive function get_model_routine_name(index, &
343  model_routine_name) &
344  bind(c, name="KIM_MODEL_ROUTINE_NAME_GetModelRoutineName")
345  use, intrinsic :: iso_c_binding
346  import kim_model_routine_name_type
347  implicit none
348  integer(c_int), intent(in), value :: index
349  type(kim_model_routine_name_type), intent(out) :: &
350  model_routine_name
351  end function get_model_routine_name
352  end interface
353  integer(c_int), intent(in) :: index
354  type(kim_model_routine_name_type), intent(out) :: model_routine_name
355  integer(c_int), intent(out) :: ierr
356 
357  ierr = get_model_routine_name(index-1, model_routine_name)
358  end subroutine kim_get_model_routine_name
recursive subroutine, public kim_get_number_of_model_routine_names(number_of_model_routine_names)
Get the number of standard ModelRoutineName's defined by the KIM API.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute_arguments_create
An Extensible Enumeration for the ModelRoutineName's supported by the KIM API.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_refresh
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_destroy
recursive subroutine, public kim_get_model_routine_name(index, model_routine_name, ierr)
Get the identity of each defined standard ModelRoutineName.
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_compute_arguments_destroy
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_extension
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_create
type(kim_model_routine_name_type), save, public, protected kim_model_routine_name_write_parameterized_model