Debian Codegraph @

fortran/include/kim_collections_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::Collections
31 !!
32 !! \sa KIM::Collections, KIM_Collections
33 !!
34 !! \since 2.1
35 module kim_collections_module
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
42 kim_collections_handle_type, &
43 ! Constants
44 KIM_COLLECTIONS_NULL_HANDLE, &
45 ! Routines
46 operator(.eq.), &
47 operator(.ne.), &
48 kim_collections_create, &
49 kim_collections_destroy, &
50 kim_get_item_type, &
51 kim_get_item_library_file_name_and_collection, &
52 kim_cache_list_of_item_metadata_files, &
53 kim_get_item_metadata_file_length, &
54 kim_get_item_metadata_file_values, &
55 kim_cache_list_of_item_names_by_type, &
56 kim_get_item_name_by_type, &
57 kim_cache_list_of_item_names_by_collection_and_type, &
58 kim_get_item_name_by_collection_and_type, &
59 kim_get_item_library_file_name_by_collection_and_type, &
60 kim_cache_list_of_item_metadata_files_by_collection_and_type, &
61 kim_get_item_metadata_file_length_by_collection_and_type, &
62 kim_get_item_metadata_file_values_by_collection_and_type, &
63 kim_get_project_name_and_sem_ver, &
64 kim_get_environment_variable_name, &
65 kim_get_configuration_file_environment_variable, &
66 kim_get_configuration_file_name, &
67 kim_cache_list_of_directory_names, &
68 kim_get_directory_name, &
69 kim_set_log_id, &
70 kim_push_log_verbosity, &
71 kim_pop_log_verbosity
72
73 !> \brief \copybrief KIM::Collections
74 !!
75 !! \sa KIM::Collections, KIM_Collections
76 !!
77 !! \since 2.1
78 type, bind(c) :: kim_collections_handle_type
79 type(c_ptr) :: p = c_null_ptr
80 end type kim_collections_handle_type
81
82 !> \brief NULL handle for use in comparisons.
83 !!
84 !! \since 2.1
85 type(kim_collections_handle_type), protected, save &
86 :: KIM_COLLECTIONS_NULL_HANDLE
87
88 !> \brief Compares kim_collections_handle_type's for equality.
89 !!
90 !! \since 2.1
91 interface operator(.eq.)
92 module procedure kim_collections_handle_equal
93 end interface operator(.eq.)
94
95 !> \brief Compares kim_collections_handle_type's for inequality.
96 !!
97 !! \since 2.1
98 interface operator(.ne.)
99 module procedure kim_collections_handle_not_equal
100 end interface operator(.ne.)
101
102 !> \brief \copybrief KIM::Collections::GetItemType
103 !!
104 !! \sa KIM::Collections::GetItemType, KIM_Collections_GetItemType
105 !!
106 !! \since 2.1
107 interface kim_get_item_type
108 module procedure kim_collections_get_item_type
109 end interface kim_get_item_type
110
111 !> \brief \copybrief KIM::Collections::GetItemLibraryFileNameAndCollection
112 !!
113 !! \sa KIM::Collections::GetItemLibraryFileNameAndCollection,
114 !! KIM_Collections_GetItemLibraryFileNameAndCollection
115 !!
116 !! \since 2.1
117 interface kim_get_item_library_file_name_and_collection
118 module procedure kim_collections_get_item_library_file_name_and_collection
119 end interface kim_get_item_library_file_name_and_collection
120
121 !> \brief \copybrief KIM::Collections::CacheListOfItemMetadataFiles
122 !!
123 !! \sa KIM::Collections::CacheListOfItemMetadataFiles,
124 !! KIM_Collections_CacheListOfItemMetadataFiles
125 !!
126 !! \since 2.1
127 interface kim_cache_list_of_item_metadata_files
128 module procedure kim_collections_cache_list_of_item_metadata_files
129 end interface kim_cache_list_of_item_metadata_files
130
131 !> \brief Get item metadata file length and determine if the file is
132 !! available as a string.
133 !!
134 !! \sa KIM::Collections::GetItemMetadataFile,
135 !! KIM_Collections_GetItemMetadataFile
136 !!
137 !! \since 2.1
138 interface kim_get_item_metadata_file_length
139 module procedure kim_collections_get_item_metadata_file_length
140 end interface kim_get_item_metadata_file_length
141
142 !> \brief Get the item's metadata file values.
143 !!
144 !! \sa KIM::Collections::GetItemMetadataFile,
145 !! KIM_Collections_GetItemMetadataFile
146 !!
147 !! \since 2.1
148 interface kim_get_item_metadata_file_values
149 module procedure kim_collections_get_item_metadata_file_values
150 end interface kim_get_item_metadata_file_values
151
152 !> \brief \copybrief KIM::Collections::CacheListOfItemNamesByType
153 !!
154 !! \sa KIM::Collections::CacheListOfItemNamesByType,
155 !! KIM_Collections_CacheListOfItemNamesByType
156 !!
157 !! \since 2.1
158 interface kim_cache_list_of_item_names_by_type
159 module procedure kim_collections_cache_list_of_item_names_by_type
160 end interface kim_cache_list_of_item_names_by_type
161
162 !> \brief \copybrief KIM::Collections::GetItemNameByType
163 !!
164 !! \sa KIM::Collections::GetItemNameByType, KIM_Collections_GetItemNameByType
165 !!
166 !! \since 2.1
167 interface kim_get_item_name_by_type
168 module procedure kim_collections_get_item_name_by_type
169 end interface kim_get_item_name_by_type
170
171 !> \brief \copybrief KIM::Collections::CacheListOfItemNamesByCollectionAndType
172 !!
173 !! \sa KIM::Collections::CacheListOfItemNamesByCollectionAndType,
174 !! KIM_Collections_CacheListOfItemNamesByCollectionAndType
175 !!
176 !! \since 2.1
177 interface kim_cache_list_of_item_names_by_collection_and_type
178 module procedure &
179 kim_collections_cache_list_of_item_names_by_collection_and_type
180 end interface kim_cache_list_of_item_names_by_collection_and_type
181
182 !> \brief \copybrief KIM::Collections::GetItemNameByCollectionAndType
183 !!
184 !! \sa KIM::Collections::GetItemNameByCollectionAndType,
185 !! KIM_Collections_GetItemNameByCollectionAndType
186 !!
187 !! \since 2.1
188 interface kim_get_item_name_by_collection_and_type
189 module procedure kim_collections_get_item_name_by_collection_and_type
190 end interface kim_get_item_name_by_collection_and_type
191
192 !> \brief \copybrief <!--
193 !! -->KIM::Collections::GetItemLibraryFileNameByCollectionAndType
194 !!
195 !! \sa KIM::Collections::GetItemLibraryFileNameByCollectionAndType,
196 !! KIM_Collections_GetItemLibraryFileNameByCollectionAndType
197 !!
198 !! \since 2.1
199 interface kim_get_item_library_file_name_by_collection_and_type
200 module procedure &
201 kim_collections_get_item_library_file_name_by_coll_and_type
202 end interface kim_get_item_library_file_name_by_collection_and_type
203
204 !> \brief \copybrief <!--
205 !! -->KIM::Collections::CacheListOfItemMetadataFilesByCollectionAndType
206 !!
207 !! \sa KIM::Collections::CacheListOfItemMetadataFilesByCollectionAndType,
208 !! KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType
209 !!
210 !! \since 2.1
211 interface kim_cache_list_of_item_metadata_files_by_collection_and_type
212 module procedure &
213 kim_colls_cache_list_of_item_metadata_files_by_coll_and_type
214 end interface kim_cache_list_of_item_metadata_files_by_collection_and_type
215
216 !> \brief Get item metadata file length and determine if the file is
217 !! available as a string.
218 !!
219 !! \sa KIM::Collections::GetItemMetadataFileByCollectionAndType,
220 !! KIM_Collections_GetItemMetadataFileByCollectionAndType
221 !!
222 !! \since 2.1
223 interface kim_get_item_metadata_file_length_by_collection_and_type
224 module procedure &
225 kim_collections_get_item_metadata_file_length_by_coll_and_type
226 end interface kim_get_item_metadata_file_length_by_collection_and_type
227
228 !> \brief Get the item's metadata file values.
229 !!
230 !! \sa KIM::Collections::GetItemMetadataFileByCollectionAndType,
231 !! KIM_Collections_GetItemMetadataFileByCollectionAndType
232 !!
233 !! \since 2.1
234 interface kim_get_item_metadata_file_values_by_collection_and_type
235 module procedure &
236 kim_collections_get_item_metadata_file_values_by_coll_and_type
237 end interface kim_get_item_metadata_file_values_by_collection_and_type
238
239 !> \brief \copybrief KIM::Collections::GetProjectNameAndSemVer
240 !!
241 !! \sa KIM::Collections::GetProjectNameAndSemVer,
242 !! KIM_Collections_GetProjectNameAndSemVer
243 !!
244 !! \since 2.1
245 interface kim_get_project_name_and_sem_ver
246 module procedure kim_collections_get_project_name_and_sem_ver
247 end interface kim_get_project_name_and_sem_ver
248
249 !> \brief \copybrief KIM::Collections::GetEnvironmentVariableName
250 !!
251 !! \sa KIM::Collections::GetEnvironmentVariableName,
252 !! KIM_Collections_GetEnvironmentVariableName
253 !!
254 !! \since 2.1
255 interface kim_get_environment_variable_name
256 module procedure kim_collections_get_environment_variable_name
257 end interface kim_get_environment_variable_name
258
259 !> \brief \copybrief KIM::Collections::GetConfigurationFileEnvironmentVariable
260 !!
261 !! \sa KIM::Collections::GetConfigurationFileEnvironmentVariable,
262 !! KIM_Collections_GetConfigurationFileEnvironmentVariable
263 !!
264 !! \since 2.1
265 interface kim_get_configuration_file_environment_variable
266 module procedure kim_collections_get_configuration_file_environment_variable
267 end interface kim_get_configuration_file_environment_variable
268
269 !> \brief \copybrief KIM::Collections::GetConfigurationFileName
270 !!
271 !! \sa KIM::Collections::GetConfigurationFileName,
272 !! KIM_Collections_GetConfigurationFileName
273 !!
274 !! \since 2.1
275 interface kim_get_configuration_file_name
276 module procedure kim_collections_get_configuration_file_name
277 end interface kim_get_configuration_file_name
278
279 !> \brief \copybrief KIM::Collections::CacheListOfDirectoryNames
280 !!
281 !! \sa KIM::Collections::CacheListOfDirectoryNames,
282 !! KIM_Collections_CacheListOfDirectoryNames
283 !!
284 !! \since 2.1
285 interface kim_cache_list_of_directory_names
286 module procedure kim_collections_cache_list_of_directory_names
287 end interface kim_cache_list_of_directory_names
288
289 !> \brief \copybrief KIM::Collections::GetDirectoryName
290 !!
291 !! \sa KIM::Collections::GetDirectoryName, KIM_Collections_GetDirectoryName
292 !!
293 !! \since 2.1
294 interface kim_get_directory_name
295 module procedure kim_collections_get_directory_name
296 end interface kim_get_directory_name
297
298 !> \brief \copybrief KIM::Collections::SetLogID
299 !!
300 !! \sa KIM::Collections::SetLogID, KIM_Collections_SetLogID
301 !!
302 !! \since 2.1
303 interface kim_set_log_id
304 module procedure kim_collections_set_log_id
305 end interface kim_set_log_id
306
307 !> \brief \copybrief KIM::Collections::PushLogVerbosity
308 !!
309 !! \sa KIM::Collections::PushLogVerbosity, KIM_Collections_PushLogVerbosity
310 !!
311 !! \since 2.1
312 interface kim_push_log_verbosity
313 module procedure kim_collections_push_log_verbosity
314 end interface kim_push_log_verbosity
315
316 !> \brief \copybrief KIM::Collections::PopLogVerbosity
317 !!
318 !! \sa KIM::Collections::, KIM_Collections_PopLogVerbosity
319 !!
320 !! \since 2.1
321 interface kim_pop_log_verbosity
322 module procedure kim_collections_pop_log_verbosity
323 end interface kim_pop_log_verbosity
324
325 contains
326 !> \brief Compares kim_collections_handle_type's for equality.
327 !!
328 !! \since 2.1
329 logical recursive function kim_collections_handle_equal(lhs, rhs)
330 implicit none
331 type(kim_collections_handle_type), intent(in) :: lhs
332 type(kim_collections_handle_type), intent(in) :: rhs
333
334 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
335 kim_collections_handle_equal = .true.
336 else
337 kim_collections_handle_equal = c_associated(lhs%p, rhs%p)
338 end if
339 end function kim_collections_handle_equal
340
341 !> \brief Compares kim_collections_handle_type's for inequality.
342 !!
343 !! \since 2.1
344 logical recursive function kim_collections_handle_not_equal(lhs, rhs)
345 implicit none
346 type(kim_collections_handle_type), intent(in) :: lhs
347 type(kim_collections_handle_type), intent(in) :: rhs
348
349 kim_collections_handle_not_equal = .not. (lhs == rhs)
350 end function kim_collections_handle_not_equal
351
352 !> \brief \copybrief KIM::Collections::Create
353 !!
354 !! \sa KIM::Collections::Create, KIM_Collections_Create
355 !!
356 !! \since 2.1
357 recursive subroutine kim_collections_create(collections_handle, ierr)
358 implicit none
359 interface
360 integer(c_int) recursive function create(collections) &
361 bind(c, name="KIM_Collections_Create")
362 use, intrinsic :: iso_c_binding
363 implicit none
364 type(c_ptr), intent(out) :: collections
365 end function create
366 end interface
367 type(kim_collections_handle_type), intent(out) :: collections_handle
368 integer(c_int), intent(out) :: ierr
369
370 type(c_ptr) :: pcollections
371
372 ierr = create(pcollections)
373 collections_handle%p = pcollections
374 end subroutine kim_collections_create
375
376 !> \brief \copybrief KIM::Collections::Destroy
377 !!
378 !! \sa KIM::Collections::Destroy, KIM_Collections_Destroy
379 !!
380 !! \since 2.1
381 recursive subroutine kim_collections_destroy(collections_handle)
382 implicit none
383 interface
384 recursive subroutine destroy(collections) &
385 bind(c, name="KIM_Collections_Destroy")
386 use, intrinsic :: iso_c_binding
387 implicit none
388 type(c_ptr), intent(inout) :: collections
389 end subroutine destroy
390 end interface
391 type(kim_collections_handle_type), intent(inout) :: collections_handle
392
393 type(c_ptr) :: pcollections
394 pcollections = collections_handle%p
395 call destroy(pcollections)
396 collections_handle%p = c_null_ptr
397 end subroutine kim_collections_destroy
398
399 !> \brief \copybrief KIM::Collections::GetItemType
400 !!
401 !! \sa KIM::Collections::GetItemType, KIM_Collections_GetItemType
402 !!
403 !! \since 2.1
404 recursive subroutine kim_collections_get_item_type(collections_handle, &
405 item_name, item_type, ierr)
406 use kim_interoperable_types_module, only: kim_collections_type
407 use kim_collection_item_type_module, only: kim_collection_item_type_type
408 implicit none
409 interface
410 integer(c_int) recursive function get_item_type( &
411 collections, item_name, item_type) &
412 bind(c, name="KIM_Collections_GetItemType")
413 use, intrinsic :: iso_c_binding
414 use kim_interoperable_types_module, only: kim_collections_type
415 use kim_collection_item_type_module, only: &
416 kim_collection_item_type_type
417 implicit none
418 type(kim_collections_type), intent(in) :: collections
419 character(c_char), intent(in) :: item_name(*)
420 type(kim_collection_item_type_type), intent(out) :: item_type
421 end function get_item_type
422 end interface
423 type(kim_collections_handle_type), intent(in) :: collections_handle
424 character(len=*, kind=c_char), intent(in) :: item_name
425 type(kim_collection_item_type_type), intent(out) :: item_type
426 integer(c_int), intent(out) :: ierr
427 type(kim_collections_type), pointer :: collections
428
429 call c_f_pointer(collections_handle%p, collections)
430 ierr = get_item_type(collections, trim(item_name)//c_null_char, item_type)
431 end subroutine kim_collections_get_item_type
432
433 !> \brief \copybrief KIM::Collections::GetItemLibraryFileNameAndCollection
434 !!
435 !! \sa KIM::Collections::GetItemLibraryFileNameAndCollection,
436 !! KIM_Collections_GetItemLibraryFileNameAndCollection
437 !!
438 !! \since 2.1
439 recursive subroutine &
440 kim_collections_get_item_library_file_name_and_collection( &
441 collections_handle, item_type, item_name, file_name, collection, ierr)
442 use kim_interoperable_types_module, only: kim_collections_type
443 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
444 use kim_collection_module, only: kim_collection_type
445 use kim_collection_item_type_module, only: kim_collection_item_type_type
446 implicit none
447 interface
448 integer(c_int) recursive function &
449 get_item_library_file_name_and_collection( &
450 collections, item_type, item_name, file_name, collection) &
451 bind(c, name="KIM_Collections_GetItemLibraryFileNameAndCollection")
452 use, intrinsic :: iso_c_binding
453 use kim_interoperable_types_module, only: kim_collections_type
454 use kim_collection_module, only: kim_collection_type
455 use kim_collection_item_type_module, only: &
456 kim_collection_item_type_type
457 implicit none
458 type(kim_collections_type), intent(in) :: collections
459 type(kim_collection_item_type_type), intent(in), value :: item_type
460 character(c_char), intent(in) :: item_name(*)
461 type(c_ptr), intent(out) :: file_name
462 type(kim_collection_type), intent(out) :: collection
463 end function get_item_library_file_name_and_collection
464 end interface
465 type(kim_collections_handle_type), intent(in) :: collections_handle
466 type(kim_collection_item_type_type), intent(in) :: item_type
467 character(len=*, kind=c_char), intent(in) :: item_name
468 character(len=*, kind=c_char), intent(out) :: file_name
469 type(kim_collection_type), intent(out) :: collection
470 integer(c_int), intent(out) :: ierr
471 type(kim_collections_type), pointer :: collections
472
473 type(c_ptr) :: pfile_name
474
475 call c_f_pointer(collections_handle%p, collections)
476 ierr = get_item_library_file_name_and_collection( &
477 collections, &
478 item_type, &
479 trim(item_name)//c_null_char, &
480 pfile_name, &
481 collection)
482 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
483 end subroutine kim_collections_get_item_library_file_name_and_collection
484
485 !> \brief \copybrief KIM::Collections::CacheListOfItemMetadataFiles
486 !!
487 !! \sa KIM::Collections::CacheListOfItemMetadataFiles,
488 !! KIM_Collections_CacheListOfItemMetadataFiles
489 !!
490 !! \since 2.1
491 recursive subroutine kim_collections_cache_list_of_item_metadata_files( &
492 collections_handle, item_type, item_name, extent, ierr)
493 use kim_interoperable_types_module, only: kim_collections_type
494 use kim_collection_item_type_module, only: kim_collection_item_type_type
495 implicit none
496 interface
497 integer(c_int) recursive function cache_list_of_item_metadata_files( &
498 collections, item_type, item_name, extent) &
499 bind(c, name="KIM_Collections_CacheListOfItemMetadataFiles")
500 use, intrinsic :: iso_c_binding
501 use kim_interoperable_types_module, only: kim_collections_type
502 use kim_collection_item_type_module, only: &
503 kim_collection_item_type_type
504 implicit none
505 type(kim_collections_type), intent(in) :: collections
506 type(kim_collection_item_type_type), intent(in), value :: item_type
507 character(c_char), intent(in) :: item_name(*)
508 integer(c_int), intent(out) :: extent
509 end function cache_list_of_item_metadata_files
510 end interface
511 type(kim_collections_handle_type), intent(in) :: collections_handle
512 type(kim_collection_item_type_type), intent(in) :: item_type
513 character(len=*, kind=c_char), intent(in) :: item_name
514 integer(c_int), intent(out) :: extent
515 integer(c_int), intent(out) :: ierr
516 type(kim_collections_type), pointer :: collections
517
518 call c_f_pointer(collections_handle%p, collections)
519 ierr = cache_list_of_item_metadata_files(collections, item_type, &
520 trim(item_name)//c_null_char, &
521 extent)
522 end subroutine kim_collections_cache_list_of_item_metadata_files
523
524 !> \brief Get item metadata file length and determine if the file is
525 !! available as a string.
526 !!
527 !! \sa KIM::Collections::GetItemMetadataFile,
528 !! KIM_Collections_GetItemMetadataFile
529 !!
530 !! \since 2.1
531 recursive subroutine kim_collections_get_item_metadata_file_length( &
532 collections_handle, index, file_length, available_as_string, ierr)
533 use kim_interoperable_types_module, only: kim_collections_type
534 implicit none
535 interface
536 integer(c_int) recursive function get_item_metadata_file( &
537 collections, index, file_name, file_length, file_raw_data, &
538 available_as_string, file_string) &
539 bind(c, name="KIM_Collections_GetItemMetadataFile_fortran")
540 use, intrinsic :: iso_c_binding
541 use kim_interoperable_types_module, only: kim_collections_type
542 implicit none
543 type(kim_collections_type), intent(in) :: collections
544 integer(c_int), intent(in), value :: index
545 type(c_ptr), intent(out) :: file_name
546 integer(c_long), intent(out) :: file_length
547 type(c_ptr), intent(out) :: file_raw_data
548 integer(c_int), intent(out) :: available_as_string
549 type(c_ptr), intent(out) :: file_string
550 end function get_item_metadata_file
551 end interface
552 type(kim_collections_handle_type), intent(in) :: collections_handle
553 integer(c_int), intent(in) :: index
554 integer(c_long), intent(out) :: file_length
555 integer(c_int), intent(out) :: available_as_string
556 integer(c_int), intent(out) :: ierr
557 type(kim_collections_type), pointer :: collections
558
559 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
560
561 call c_f_pointer(collections_handle%p, collections)
562 ierr = get_item_metadata_file(collections, &
563 index - 1, &
564 pfile_name, &
565 file_length, &
566 pfile_raw_data, &
567 available_as_string, &
568 pfile_string)
569 end subroutine kim_collections_get_item_metadata_file_length
570
571 !> \brief Get the item's metadata file values.
572 !!
573 !! \sa KIM::Collections::GetItemMetadataFile,
574 !! KIM_Collections_GetItemMetadataFile
575 !!
576 !! \since 2.1
577 recursive subroutine kim_collections_get_item_metadata_file_values( &
578 collections_handle, index, file_name, file_raw_data, file_string, ierr)
579 use kim_interoperable_types_module, only: kim_collections_type
580 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
581 implicit none
582 interface
583 integer(c_int) recursive function get_item_metadata_file( &
584 collections, index, file_name, file_length, file_raw_data, &
585 available_as_string, file_string) &
586 bind(c, name="KIM_Collections_GetItemMetadataFile_fortran")
587 use, intrinsic :: iso_c_binding
588 use kim_interoperable_types_module, only: kim_collections_type
589 implicit none
590 type(kim_collections_type), intent(in) :: collections
591 integer(c_int), intent(in), value :: index
592 type(c_ptr), intent(out) :: file_name
593 integer(c_long), intent(out) :: file_length
594 type(c_ptr), intent(out) :: file_raw_data
595 integer(c_int), intent(out) :: available_as_string
596 type(c_ptr), intent(out) :: file_string
597 end function get_item_metadata_file
598 end interface
599 type(kim_collections_handle_type), intent(in) :: collections_handle
600 integer(c_int), intent(in) :: index
601 character(len=*, kind=c_char), intent(out) :: file_name
602 integer(c_signed_char), intent(out) :: file_raw_data(:)
603 character(len=*, kind=c_char), intent(out) :: file_string
604 integer(c_int), intent(out) :: ierr
605 type(kim_collections_type), pointer :: collections
606
607 integer(c_long) file_length
608 integer(c_int) available_as_string
609 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
610 integer(c_signed_char), pointer :: file_raw_data_fpointer(:)
611
612 call c_f_pointer(collections_handle%p, collections)
613 ierr = get_item_metadata_file(collections, &
614 index - 1, &
615 pfile_name, &
616 file_length, &
617 pfile_raw_data, &
618 available_as_string, &
619 pfile_string)
620 if (ierr == 0) then
621 if (size(file_raw_data) < file_length) then
622 ierr = 1
623 return
624 end if
625 if (available_as_string == 1) then
626 if (len(file_string) < file_length) then
627 ierr = 1
628 return
629 end if
630 end if
631
632 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
633 if (c_associated(pfile_raw_data)) then
634 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
635 else
636 nullify (file_raw_data_fpointer)
637 end if
638 file_raw_data = file_raw_data_fpointer(1:file_length)
639
640 if (available_as_string == 1) then
641 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
642 end if
643 end if
644 end subroutine kim_collections_get_item_metadata_file_values
645
646 !> \brief \copybrief KIM::Collections::CacheListOfItemNamesByType
647 !!
648 !! \sa KIM::Collections::CacheListOfItemNamesByType,
649 !! KIM_Collections_CacheListOfItemNamesByType
650 !!
651 !! \since 2.1
652 recursive subroutine kim_collections_cache_list_of_item_names_by_type( &
653 collections_handle, item_type, extent, ierr)
654 use kim_interoperable_types_module, only: kim_collections_type
655 use kim_collection_item_type_module, only: kim_collection_item_type_type
656 implicit none
657 interface
658 integer(c_int) recursive function cache_list_of_item_names_by_type( &
659 collections, item_type, extent) &
660 bind(c, name="KIM_Collections_CacheListOfItemNamesByType")
661 use, intrinsic :: iso_c_binding
662 use kim_interoperable_types_module, only: kim_collections_type
663 use kim_collection_item_type_module, only: &
664 kim_collection_item_type_type
665 implicit none
666 type(kim_collections_type), intent(in) :: collections
667 type(kim_collection_item_type_type), intent(in), value :: item_type
668 integer(c_int), intent(out) :: extent
669 end function cache_list_of_item_names_by_type
670 end interface
671 type(kim_collections_handle_type), intent(in) :: collections_handle
672 type(kim_collection_item_type_type), intent(in) :: item_type
673 integer(c_int), intent(out) :: extent
674 integer(c_int), intent(out) :: ierr
675 type(kim_collections_type), pointer :: collections
676
677 call c_f_pointer(collections_handle%p, collections)
678 ierr = cache_list_of_item_names_by_type(collections, item_type, extent)
679 end subroutine kim_collections_cache_list_of_item_names_by_type
680
681 !> \brief \copybrief KIM::Collections::GetItemNameByType
682 !!
683 !! \sa KIM::Collections::GetItemNameByType, KIM_Collections_GetItemNameByType
684 !!
685 !! \since 2.1
686 recursive subroutine kim_collections_get_item_name_by_type( &
687 collections_handle, index, item_name, ierr)
688 use kim_interoperable_types_module, only: kim_collections_type
689 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
690 implicit none
691 interface
692 integer(c_int) recursive function get_item_name_by_type( &
693 collections, index, item_name) &
694 bind(c, name="KIM_Collections_GetItemNameByType")
695 use, intrinsic :: iso_c_binding
696 use kim_interoperable_types_module, only: kim_collections_type
697 implicit none
698 type(kim_collections_type), intent(in) :: collections
699 integer(c_int), intent(in), value :: index
700 type(c_ptr), intent(out) :: item_name
701 end function get_item_name_by_type
702 end interface
703 type(kim_collections_handle_type), intent(in) :: collections_handle
704 integer(c_int), intent(in) :: index
705 character(len=*, kind=c_char), intent(out) :: item_name
706 integer(c_int), intent(out) :: ierr
707 type(kim_collections_type), pointer :: collections
708
709 type(c_ptr) pitem_name
710
711 call c_f_pointer(collections_handle%p, collections)
712 ierr = get_item_name_by_type(collections, index - 1, pitem_name)
713 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
714 end subroutine kim_collections_get_item_name_by_type
715
716 !> \brief \copybrief KIM::Collections::CacheListOfItemNamesByCollectionAndType
717 !!
718 !! \sa KIM::Collections::CacheListOfItemNamesByCollectionAndType,
719 !! KIM_Collections_CacheListOfItemNamesByCollectionAndType
720 !!
721 !! \since 2.1
722 recursive subroutine &
723 kim_collections_cache_list_of_item_names_by_collection_and_type( &
724 collections_handle, collection, item_type, extent, ierr)
725 use kim_interoperable_types_module, only: kim_collections_type
726 use kim_collection_module, only: kim_collection_type
727 use kim_collection_item_type_module, only: kim_collection_item_type_type
728 implicit none
729 interface
730 integer(c_int) recursive function &
731 cache_list_of_item_names_by_collection_and_type( &
732 collections, collection, item_type, extent) &
733 bind(c, name="KIM_Collections_CacheListOfItemNamesByCollectionAndType")
734 use, intrinsic :: iso_c_binding
735 use kim_interoperable_types_module, only: kim_collections_type
736 use kim_collection_module, only: kim_collection_type
737 use kim_collection_item_type_module, only: &
738 kim_collection_item_type_type
739 implicit none
740 type(kim_collections_type), intent(in) :: collections
741 type(kim_collection_type), intent(in), value :: collection
742 type(kim_collection_item_type_type), intent(in), value :: item_type
743 integer(c_int), intent(out) :: extent
744 end function cache_list_of_item_names_by_collection_and_type
745 end interface
746 type(kim_collections_handle_type), intent(in) :: collections_handle
747 type(kim_collection_type), intent(in) :: collection
748 type(kim_collection_item_type_type), intent(in) :: item_type
749 integer(c_int), intent(out) :: extent
750 integer(c_int), intent(out) :: ierr
751 type(kim_collections_type), pointer :: collections
752
753 call c_f_pointer(collections_handle%p, collections)
754 ierr = cache_list_of_item_names_by_collection_and_type(collections, &
755 collection, &
756 item_type, &
757 extent)
758 end subroutine kim_collections_cache_list_of_item_names_by_collection_and_type
759
760 !> \brief \copybrief KIM::Collections::GetItemNameByCollectionAndType
761 !!
762 !! \sa KIM::Collections::GetItemNameByCollectionAndType,
763 !! KIM_Collections_GetItemNameByCollectionAndType
764 !!
765 !! \since 2.1
766 recursive subroutine kim_collections_get_item_name_by_collection_and_type( &
767 collections_handle, index, item_name, ierr)
768 use kim_interoperable_types_module, only: kim_collections_type
769 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
770 implicit none
771 interface
772 integer(c_int) recursive function get_item_name_by_collection_and_type( &
773 collections, index, item_name) &
774 bind(c, name="KIM_Collections_GetItemNameByCollectionAndType")
775 use, intrinsic :: iso_c_binding
776 use kim_interoperable_types_module, only: kim_collections_type
777 implicit none
778 type(kim_collections_type), intent(in) :: collections
779 integer(c_int), intent(in), value :: index
780 type(c_ptr), intent(out) :: item_name
781 end function get_item_name_by_collection_and_type
782 end interface
783 type(kim_collections_handle_type), intent(in) :: collections_handle
784 integer(c_int), intent(in) :: index
785 character(len=*, kind=c_char), intent(out) :: item_name
786 integer(c_int), intent(out) :: ierr
787 type(kim_collections_type), pointer :: collections
788
789 type(c_ptr) pitem_name
790
791 call c_f_pointer(collections_handle%p, collections)
792 ierr = get_item_name_by_collection_and_type(collections, index - 1, &
793 pitem_name)
794 call kim_convert_c_char_ptr_to_string(pitem_name, item_name)
795 end subroutine kim_collections_get_item_name_by_collection_and_type
796
797 !> \brief \copybrief <!--
798 !! -->KIM::Collections::GetItemLibraryFileNameByCollectionAndType
799 !!
800 !! \sa KIM::Collections::GetItemLibraryFileNameByCollectionAndType,
801 !! KIM_Collections_GetItemLibraryFileNameByCollectionAndType
802 !!
803 !! \since 2.1
804 recursive subroutine &
805 kim_collections_get_item_library_file_name_by_coll_and_type( &
806 collections_handle, collection, item_type, item_name, file_name, ierr)
807 use kim_interoperable_types_module, only: kim_collections_type
808 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
809 use kim_collection_module, only: kim_collection_type
810 use kim_collection_item_type_module, only: kim_collection_item_type_type
811 implicit none
812 interface
813 integer(c_int) recursive function &
814 get_item_library_file_name_by_coll_and_type( &
815 collections, collection, item_type, item_name, file_name) &
816 bind(c, &
817 name="KIM_Collections_GetItemLibraryFileNameByCollectionAndType")
818 use, intrinsic :: iso_c_binding
819 use kim_interoperable_types_module, only: kim_collections_type
820 use kim_collection_module, only: kim_collection_type
821 use kim_collection_item_type_module, only: &
822 kim_collection_item_type_type
823 implicit none
824 type(kim_collections_type), intent(in) :: collections
825 type(kim_collection_type), intent(in), value :: collection
826 type(kim_collection_item_type_type), intent(in), value :: item_type
827 character(c_char), intent(in) :: item_name(*)
828 type(c_ptr), intent(out) :: file_name
829 end function get_item_library_file_name_by_coll_and_type
830 end interface
831 type(kim_collections_handle_type), intent(in) :: collections_handle
832 type(kim_collection_type), intent(in) :: collection
833 type(kim_collection_item_type_type), intent(in) :: item_type
834 character(len=*, kind=c_char), intent(in) :: item_name
835 character(len=*, kind=c_char), intent(out) :: file_name
836 integer(c_int), intent(out) :: ierr
837 type(kim_collections_type), pointer :: collections
838
839 type(c_ptr) pfile_name
840
841 call c_f_pointer(collections_handle%p, collections)
842 ierr = get_item_library_file_name_by_coll_and_type( &
843 collections, &
844 collection, &
845 item_type, &
846 trim(item_name)//c_null_char, &
847 pfile_name)
848 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
849 end subroutine kim_collections_get_item_library_file_name_by_coll_and_type
850
851 !> \brief \copybrief <!--
852 !! -->KIM::Collections::CacheListOfItemMetadataFilesByCollectionAndType
853 !!
854 !! \sa KIM::Collections::CacheListOfItemMetadataFilesByCollectionAndType,
855 !! KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType
856 !!
857 !! \since 2.1
858 recursive subroutine &
859 kim_colls_cache_list_of_item_metadata_files_by_coll_and_type( &
860 collections_handle, collection, item_type, item_name, extent, ierr)
861 use kim_interoperable_types_module, only: kim_collections_type
862 use kim_collection_module, only: kim_collection_type
863 use kim_collection_item_type_module, only: kim_collection_item_type_type
864 implicit none
865 interface
866 integer(c_int) recursive function &
867 cache_list_of_item_metadata_files_by_coll_and_type( &
868 collections, collection, item_type, item_name, extent) &
869 bind(c, &
870 name= &
871 "KIM_Collections_CacheListOfItemMetadataFilesByCollectionAndType")
872 use, intrinsic :: iso_c_binding
873 use kim_interoperable_types_module, only: kim_collections_type
874 use kim_collection_module, only: kim_collection_type
875 use kim_collection_item_type_module, only: &
876 kim_collection_item_type_type
877 implicit none
878 type(kim_collections_type), intent(in) :: collections
879 type(kim_collection_type), intent(in), value :: collection
880 type(kim_collection_item_type_type), intent(in), value :: item_type
881 character(c_char), intent(in) :: item_name(*)
882 integer(c_int), intent(out) :: extent
883 end function cache_list_of_item_metadata_files_by_coll_and_type
884 end interface
885 type(kim_collections_handle_type), intent(in) :: collections_handle
886 type(kim_collection_type), intent(in) :: collection
887 type(kim_collection_item_type_type), intent(in) :: item_type
888 character(len=*, kind=c_char), intent(in) :: item_name
889 integer(c_int), intent(out) :: extent
890 integer(c_int), intent(out) :: ierr
891 type(kim_collections_type), pointer :: collections
892
893 call c_f_pointer(collections_handle%p, collections)
894 ierr = cache_list_of_item_metadata_files_by_coll_and_type( &
895 collections, &
896 collection, &
897 item_type, &
898 trim(item_name)//c_null_char, &
899 extent)
900 end subroutine kim_colls_cache_list_of_item_metadata_files_by_coll_and_type
901
902 !> \brief \copybrief KIM::Collections::GetItemMetadataFileByCollectionAndType
903 !!
904 !! \sa KIM::Collections::GetItemMetadataFileByCollectionAndType,
905 !! KIM_Collections_GetItemMetadataFileByCollectionAndType
906 !!
907 !! \since 2.1
908 recursive subroutine &
909 kim_collections_get_item_metadata_file_length_by_coll_and_type( &
910 collections_handle, index, file_length, available_as_string, ierr)
911 use kim_interoperable_types_module, only: kim_collections_type
912 implicit none
913 interface
914 integer(c_int) recursive function &
915 get_item_metadata_file_by_coll_and_type( &
916 collections, index, &
917 file_name, &
918 file_length, &
919 file_raw_data, &
920 available_as_string, &
921 file_string) &
922 bind(c, &
923 name= &
924 "KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
925 use, intrinsic :: iso_c_binding
926 use kim_interoperable_types_module, only: kim_collections_type
927 implicit none
928 type(kim_collections_type), intent(in) :: collections
929 integer(c_int), intent(in), value :: index
930 type(c_ptr), intent(out) :: file_name
931 integer(c_long), intent(out) :: file_length
932 type(c_ptr), intent(out) :: file_raw_data
933 integer(c_int), intent(out) :: available_as_string
934 type(c_ptr), intent(out) :: file_string
935 end function get_item_metadata_file_by_coll_and_type
936 end interface
937 type(kim_collections_handle_type), intent(in) :: collections_handle
938 integer(c_int), intent(in), value :: index
939 integer(c_long), intent(out) :: file_length
940 integer(c_int), intent(out) :: available_as_string
941 integer(c_int), intent(out) :: ierr
942 type(kim_collections_type), pointer :: collections
943
944 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
945
946 call c_f_pointer(collections_handle%p, collections)
947 ierr = get_item_metadata_file_by_coll_and_type(collections, &
948 index - 1, &
949 pfile_name, &
950 file_length, &
951 pfile_raw_data, &
952 available_as_string, &
953 pfile_string)
954 end subroutine kim_collections_get_item_metadata_file_length_by_coll_and_type
955
956 !> \brief Get the item's metadata file values.
957 !!
958 !! \sa KIM::Collections::GetItemMetadataFileByCollectionAndType,
959 !! KIM_Collections_GetItemMetadataFileByCollectionAndType
960 !!
961 !! \since 2.1
962 recursive subroutine &
963 kim_collections_get_item_metadata_file_values_by_coll_and_type( &
964 collections_handle, index, file_name, file_raw_data, file_string, ierr)
965 use kim_interoperable_types_module, only: kim_collections_type
966 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
967 implicit none
968 interface
969 integer(c_int) recursive function &
970 get_item_metadata_file_by_coll_and_type(collections, &
971 index, &
972 file_name, &
973 file_length, &
974 file_raw_data, &
975 available_as_string, &
976 file_string) &
977 bind(c, &
978 name= &
979 "KIM_Collections_GetItemMetadataFileByCollectionAndType_fortran")
980 use, intrinsic :: iso_c_binding
981 use kim_interoperable_types_module, only: kim_collections_type
982 implicit none
983 type(kim_collections_type), intent(in) :: collections
984 integer(c_int), intent(in), value :: index
985 type(c_ptr), intent(out) :: file_name
986 integer(c_long), intent(out) :: file_length
987 type(c_ptr), intent(out) :: file_raw_data
988 integer(c_int), intent(out) :: available_as_string
989 type(c_ptr), intent(out) :: file_string
990 end function get_item_metadata_file_by_coll_and_type
991 end interface
992 type(kim_collections_handle_type), intent(in) :: collections_handle
993 integer(c_int), intent(in) :: index
994 character(len=*, kind=c_char), intent(out) :: file_name
995 integer(c_signed_char), intent(out) :: file_raw_data(:)
996 character(len=*, kind=c_char), intent(out) :: file_string
997 integer(c_int), intent(out) :: ierr
998 type(kim_collections_type), pointer :: collections
999
1000 integer(c_long) file_length
1001 integer(c_int) available_as_string
1002 type(c_ptr) pfile_name, pfile_raw_data, pfile_string
1003 integer(c_signed_char), pointer :: file_raw_data_fpointer(:)
1004
1005 call c_f_pointer(collections_handle%p, collections)
1006 ierr = get_item_metadata_file_by_coll_and_type(collections, &
1007 index - 1, &
1008 pfile_name, &
1009 file_length, &
1010 pfile_raw_data, &
1011 available_as_string, &
1012 pfile_string)
1013 if (ierr == 0) then
1014 if (size(file_raw_data) < file_length) then
1015 ierr = 1
1016 return
1017 end if
1018 if (available_as_string == 1) then
1019 if (len(file_string) < file_length) then
1020 ierr = 1
1021 return
1022 end if
1023 end if
1024
1025 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1026 if (c_associated(pfile_raw_data)) then
1027 call c_f_pointer(pfile_raw_data, file_raw_data_fpointer, [file_length])
1028 else
1029 nullify (file_raw_data_fpointer)
1030 end if
1031 file_raw_data = file_raw_data_fpointer(1:file_length)
1032
1033 if (available_as_string == 1) then
1034 call kim_convert_c_char_ptr_to_string(pfile_string, file_string)
1035 end if
1036 end if
1037 end subroutine kim_collections_get_item_metadata_file_values_by_coll_and_type
1038
1039 !> \brief \copybrief KIM::Collections::GetProjectNameAndSemVer
1040 !!
1041 !! \sa KIM::Collections::GetProjectNameAndSemVer,
1042 !! KIM_Collections_GetProjectNameAndSemVer
1043 !!
1044 !! \since 2.1
1045 recursive subroutine kim_collections_get_project_name_and_sem_ver( &
1046 collections_handle, project_name, sem_ver)
1047 use kim_interoperable_types_module, only: kim_collections_type
1048 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1049 implicit none
1050 interface
1051 recursive subroutine get_project_name_and_sem_ver(collections, &
1052 project_name, sem_ver) &
1053 bind(c, name="KIM_Collections_GetProjectNameAndSemVer")
1054 use, intrinsic :: iso_c_binding
1055 use kim_interoperable_types_module, only: kim_collections_type
1056 implicit none
1057 type(kim_collections_type), intent(in) :: collections
1058 type(c_ptr), intent(out) :: project_name
1059 type(c_ptr), intent(out) :: sem_ver
1060 end subroutine get_project_name_and_sem_ver
1061 end interface
1062 type(kim_collections_handle_type), intent(in) :: collections_handle
1063 character(len=*, kind=c_char), intent(out) :: project_name
1064 character(len=*, kind=c_char), intent(out) :: sem_ver
1065 type(kim_collections_type), pointer :: collections
1066
1067 type(c_ptr) pproject_name, psem_ver
1068
1069 call c_f_pointer(collections_handle%p, collections)
1070 call get_project_name_and_sem_ver(collections, pproject_name, psem_ver)
1071 call kim_convert_c_char_ptr_to_string(pproject_name, project_name)
1072 call kim_convert_c_char_ptr_to_string(psem_ver, sem_ver)
1073 end subroutine kim_collections_get_project_name_and_sem_ver
1074
1075 !> \brief \copybrief KIM::Collections::GetEnvironmentVariableName
1076 !!
1077 !! \sa KIM::Collections::GetEnvironmentVariableName,
1078 !! KIM_Collections_GetEnvironmentVariableName
1079 !!
1080 !! \since 2.1
1081 recursive subroutine kim_collections_get_environment_variable_name( &
1082 collections_handle, item_type, name, ierr)
1083 use kim_interoperable_types_module, only: kim_collections_type
1084 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1085 use kim_collection_item_type_module, only: kim_collection_item_type_type
1086 implicit none
1087 interface
1088 integer(c_int) recursive function get_environment_variable_name( &
1089 collections, item_type, name) &
1090 bind(c, name="KIM_Collections_GetEnvironmentVariableName")
1091 use, intrinsic :: iso_c_binding
1092 use kim_interoperable_types_module, only: kim_collections_type
1093 use kim_collection_item_type_module, only: &
1094 kim_collection_item_type_type
1095 implicit none
1096 type(kim_collections_type), intent(in) :: collections
1097 type(kim_collection_item_type_type), intent(in), value :: item_type
1098 type(c_ptr), intent(out) :: name
1099 end function get_environment_variable_name
1100 end interface
1101 type(kim_collections_handle_type), intent(in) :: collections_handle
1102 type(kim_collection_item_type_type), intent(in) :: item_type
1103 character(len=*, kind=c_char), intent(out) :: name
1104 integer(c_int), intent(out) :: ierr
1105 type(kim_collections_type), pointer :: collections
1106
1107 type(c_ptr) pname
1108
1109 call c_f_pointer(collections_handle%p, collections)
1110 ierr = get_environment_variable_name(collections, item_type, pname)
1111 call kim_convert_c_char_ptr_to_string(pname, name)
1112 end subroutine kim_collections_get_environment_variable_name
1113
1114 !> \brief \copybrief KIM::Collections::GetConfigurationFileEnvironmentVariable
1115 !!
1116 !! \sa KIM::Collections::GetConfigurationFileEnvironmentVariable,
1117 !! KIM_Collections_GetConfigurationFileEnvironmentVariable
1118 !!
1119 !! \since 2.1
1120 recursive subroutine &
1121 kim_collections_get_configuration_file_environment_variable( &
1122 collections_handle, name, value)
1123 use kim_interoperable_types_module, only: kim_collections_type
1124 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1125 implicit none
1126 interface
1127 recursive subroutine get_configuration_file_environment_variable( &
1128 collections, name, value) &
1129 bind(c, name="KIM_Collections_GetConfigurationFileEnvironmentVariable")
1130 use, intrinsic :: iso_c_binding
1131 use kim_interoperable_types_module, only: kim_collections_type
1132 implicit none
1133 type(kim_collections_type), intent(in) :: collections
1134 type(c_ptr), intent(out) :: name
1135 type(c_ptr), intent(out) :: value
1136 end subroutine get_configuration_file_environment_variable
1137 end interface
1138 type(kim_collections_handle_type), intent(in) :: collections_handle
1139 character(len=*, kind=c_char), intent(out) :: name
1140 character(len=*, kind=c_char), intent(out) :: value
1141 type(kim_collections_type), pointer :: collections
1142
1143 type(c_ptr) pname, pvalue
1144
1145 call c_f_pointer(collections_handle%p, collections)
1146 call get_configuration_file_environment_variable(collections, pname, pvalue)
1147 call kim_convert_c_char_ptr_to_string(pname, name)
1148 call kim_convert_c_char_ptr_to_string(pvalue, value)
1149 end subroutine kim_collections_get_configuration_file_environment_variable
1150
1151 !> \brief \copybrief KIM::Collections::GetConfigurationFileName
1152 !!
1153 !! \sa KIM::Collections::GetConfigurationFileName,
1154 !! KIM_Collections_GetConfigurationFileName
1155 !!
1156 !! \since 2.1
1157 recursive subroutine kim_collections_get_configuration_file_name( &
1158 collections_handle, file_name)
1159 use kim_interoperable_types_module, only: kim_collections_type
1160 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1161 implicit none
1162 interface
1163 recursive subroutine get_configuration_file_name(collections, file_name) &
1164 bind(c, name="KIM_Collections_GetConfigurationFileName")
1165 use, intrinsic :: iso_c_binding
1166 use kim_interoperable_types_module, only: kim_collections_type
1167 implicit none
1168 type(kim_collections_type), intent(in) :: collections
1169 type(c_ptr), intent(out) :: file_name
1170 end subroutine get_configuration_file_name
1171 end interface
1172 type(kim_collections_handle_type), intent(in) :: collections_handle
1173 character(len=*, kind=c_char), intent(out) :: file_name
1174 type(kim_collections_type), pointer :: collections
1175
1176 type(c_ptr) pfile_name
1177
1178 call c_f_pointer(collections_handle%p, collections)
1179 call get_configuration_file_name(collections, pfile_name)
1180 call kim_convert_c_char_ptr_to_string(pfile_name, file_name)
1181 end subroutine kim_collections_get_configuration_file_name
1182
1183 !> \brief \copybrief KIM::Collections::CacheListOfDirectoryNames
1184 !!
1185 !! \sa KIM::Collections::CacheListOfDirectoryNames,
1186 !! KIM_Collections_CacheListOfDirectoryNames
1187 !!
1188 !! \since 2.1
1189 recursive subroutine kim_collections_cache_list_of_directory_names( &
1190 collections_handle, collection, item_type, extent, ierr)
1191 use kim_interoperable_types_module, only: kim_collections_type
1192 use kim_collection_module, only: kim_collection_type
1193 use kim_collection_item_type_module, only: kim_collection_item_type_type
1194 implicit none
1195 interface
1196 integer(c_int) recursive function cache_list_of_directory_names( &
1197 collections, collection, item_type, extent) &
1198 bind(c, name="KIM_Collections_CacheListOfDirectoryNames")
1199 use, intrinsic :: iso_c_binding
1200 use kim_interoperable_types_module, only: kim_collections_type
1201 use kim_collection_module, only: kim_collection_type
1202 use kim_collection_item_type_module, only: &
1203 kim_collection_item_type_type
1204 implicit none
1205 type(kim_collections_type), intent(in) :: collections
1206 type(kim_collection_type), intent(in), value :: collection
1207 type(kim_collection_item_type_type), intent(in), value :: item_type
1208 integer(c_int), intent(out) :: extent
1209 end function cache_list_of_directory_names
1210 end interface
1211 type(kim_collections_handle_type), intent(in) :: collections_handle
1212 type(kim_collection_type), intent(in) :: collection
1213 type(kim_collection_item_type_type), intent(in) :: item_type
1214 integer(c_int), intent(out) :: extent
1215 integer(c_int), intent(out) :: ierr
1216 type(kim_collections_type), pointer :: collections
1217
1218 call c_f_pointer(collections_handle%p, collections)
1219 ierr = cache_list_of_directory_names(collections, collection, item_type, &
1220 extent)
1221 end subroutine kim_collections_cache_list_of_directory_names
1222
1223 !> \brief \copybrief KIM::Collections::GetDirectoryName
1224 !!
1225 !! \sa KIM::Collections::GetDirectoryName, KIM_Collections_GetDirectoryName
1226 !!
1227 !! \since 2.1
1228 recursive subroutine kim_collections_get_directory_name(collections_handle, &
1229 index, &
1230 directory_name, &
1231 ierr)
1232 use kim_interoperable_types_module, only: kim_collections_type
1233 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
1234 implicit none
1235 interface
1236 integer(c_int) recursive function get_directory_name(collections, index, &
1237 directory_name) &
1238 bind(c, name="KIM_Collections_GetDirectoryName")
1239 use, intrinsic :: iso_c_binding
1240 use kim_interoperable_types_module, only: kim_collections_type
1241 implicit none
1242 type(kim_collections_type), intent(in) :: collections
1243 integer(c_int), intent(in), value :: index
1244 type(c_ptr), intent(out) :: directory_name
1245 end function get_directory_name
1246 end interface
1247 type(kim_collections_handle_type), intent(in) :: collections_handle
1248 integer(c_int), intent(in) :: index
1249 character(len=*, kind=c_char), intent(out) :: directory_name
1250 integer(c_int), intent(out) :: ierr
1251 type(kim_collections_type), pointer :: collections
1252
1253 type(c_ptr) pdirectory_name
1254
1255 call c_f_pointer(collections_handle%p, collections)
1256 ierr = get_directory_name(collections, index - 1, pdirectory_name)
1257 call kim_convert_c_char_ptr_to_string(pdirectory_name, directory_name)
1258 end subroutine kim_collections_get_directory_name
1259
1260 !> \brief \copybrief KIM::Collections::SetLogID
1261 !!
1262 !! \sa KIM::Collections::SetLogID, KIM_Collections_SetLogID
1263 !!
1264 !! \since 2.1
1265 recursive subroutine kim_collections_set_log_id(collections_handle, log_id)
1266 use kim_interoperable_types_module, only: kim_collections_type
1267 implicit none
1268 interface
1269 recursive subroutine set_log_id(collections, log_id) &
1270 bind(c, name="KIM_Collections_SetLogID")
1271 use, intrinsic :: iso_c_binding
1272 use kim_interoperable_types_module, only: kim_collections_type
1273 implicit none
1274 type(kim_collections_type), intent(in) :: collections
1275 character(c_char), intent(in) :: log_id(*)
1276 end subroutine set_log_id
1277 end interface
1278 type(kim_collections_handle_type), intent(in) :: collections_handle
1279 character(len=*, kind=c_char), intent(in) :: log_id
1280 type(kim_collections_type), pointer :: collections
1281
1282 call c_f_pointer(collections_handle%p, collections)
1283 call set_log_id(collections, trim(log_id)//c_null_char)
1284 end subroutine kim_collections_set_log_id
1285
1286 !> \brief \copybrief KIM::Collections::PushLogVerbosity
1287 !!
1288 !! \sa KIM::Collections::PushLogVerbosity, KIM_Collections_PushLogVerbosity
1289 !!
1290 !! \since 2.1
1291 recursive subroutine kim_collections_push_log_verbosity(collections_handle, &
1292 log_verbosity)
1293 use kim_log_verbosity_module, only: kim_log_verbosity_type
1294 use kim_interoperable_types_module, only: kim_collections_type
1295 implicit none
1296 interface
1297 recursive subroutine push_log_verbosity(collections, log_verbosity) &
1298 bind(c, name="KIM_Collections_PushLogVerbosity")
1299 use, intrinsic :: iso_c_binding
1300 use kim_log_verbosity_module, only: kim_log_verbosity_type
1301 use kim_interoperable_types_module, only: kim_collections_type
1302 implicit none
1303 type(kim_collections_type), intent(in) :: collections
1304 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
1305 end subroutine push_log_verbosity
1306 end interface
1307 type(kim_collections_handle_type), intent(in) :: collections_handle
1308 type(kim_log_verbosity_type), intent(in) :: log_verbosity
1309 type(kim_collections_type), pointer :: collections
1310
1311 call c_f_pointer(collections_handle%p, collections)
1312 call push_log_verbosity(collections, log_verbosity)
1313 end subroutine kim_collections_push_log_verbosity
1314
1315 !> \brief \copybrief KIM::Collections::PopLogVerbosity
1316 !!
1317 !! \sa KIM::Collections::, KIM_Collections_PopLogVerbosity
1318 !!
1319 !! \since 2.1
1320 recursive subroutine kim_collections_pop_log_verbosity(collections_handle)
1321 use kim_log_verbosity_module, only: kim_log_verbosity_type
1322 use kim_interoperable_types_module, only: kim_collections_type
1323 implicit none
1324 interface
1325 recursive subroutine pop_log_verbosity(collections) &
1326 bind(c, name="KIM_Collections_PopLogVerbosity")
1327 use, intrinsic :: iso_c_binding
1328 use kim_log_verbosity_module, only: kim_log_verbosity_type
1329 use kim_interoperable_types_module, only: kim_collections_type
1330 implicit none
1331 type(kim_collections_type), intent(in) :: collections
1332 end subroutine pop_log_verbosity
1333 end interface
1334 type(kim_collections_handle_type), intent(in) :: collections_handle
1335 type(kim_collections_type), pointer :: collections
1336
1337 call c_f_pointer(collections_handle%p, collections)
1338 call pop_log_verbosity(collections)
1339 end subroutine kim_collections_pop_log_verbosity
1340 end module kim_collections_module