Debian Codegraph @

fortran/include/kim_compute_arguments_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::ComputeArguments
31 !!
32 !! \sa KIM::ComputeArguments, KIM_ComputeArguments
33 !!
34 !! \since 2.0
35 module kim_compute_arguments_module
36 use, intrinsic :: iso_c_binding
37 implicit none
38 private
39
40 public &
41 ! Derived types
42 kim_compute_arguments_handle_type, &
43 ! Constants
44 KIM_COMPUTE_ARGUMENTS_NULL_HANDLE, &
45 ! Routines
46 operator(.eq.), &
47 operator(.ne.), &
48 kim_get_argument_support_status, &
49 kim_get_callback_support_status, &
50 kim_set_argument_pointer, &
51 kim_set_callback_pointer, &
52 kim_are_all_required_present, &
53 kim_set_simulator_buffer_pointer, &
54 kim_get_simulator_buffer_pointer, &
55 kim_to_string, &
56 kim_set_log_id, &
57 kim_push_log_verbosity, &
58 kim_pop_log_verbosity
59
60 !> \brief \copybrief KIM::ComputeArguments
61 !!
62 !! \sa KIM::ComputeArguments, KIM_ComputeArguments
63 !!
64 !! \since 2.0
65 type, bind(c) :: kim_compute_arguments_handle_type
66 type(c_ptr) :: p = c_null_ptr
67 end type kim_compute_arguments_handle_type
68
69 !> \brief NULL handle for use in comparisons.
70 !!
71 !! \since 2.0
72 type(kim_compute_arguments_handle_type), protected, save &
73 :: KIM_COMPUTE_ARGUMENTS_NULL_HANDLE
74
75 !> \brief Compares kim_compute_arguments_handle_type's for equality.
76 !!
77 !! \since 2.0
78 interface operator(.eq.)
79 module procedure kim_compute_arguments_handle_equal
80 end interface operator(.eq.)
81
82 !> \brief Compares kim_compute_arguments_handle_type's for inequality.
83 !!
84 !! \since 2.0
85 interface operator(.ne.)
86 module procedure kim_compute_arguments_handle_not_equal
87 end interface operator(.ne.)
88
89 !> \brief \copybrief KIM::ComputeArguments::GetArgumentSupportStatus
90 !!
91 !! \sa KIM::ComputeArguments::GetArgumentSupportStatus,
92 !! KIM_ComputeArguments_GetArgumentSupportStatus
93 !!
94 !! \since 2.0
95 interface kim_get_argument_support_status
96 module procedure kim_compute_arguments_get_argument_support_status
97 end interface kim_get_argument_support_status
98
99 !> \brief \copybrief KIM::ComputeArguments::GetCallbackSupportStatus
100 !!
101 !! \sa KIM::ComputeArguments::GetCallbackSupportStatus,
102 !! KIM_ComputeArguments_GetCallbackSupportStatus
103 !!
104 !! \since 2.0
105 interface kim_get_callback_support_status
106 module procedure kim_compute_arguments_get_callback_support_status
107 end interface kim_get_callback_support_status
108
109 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
110 !!
111 !! \sa KIM::ComputeArguments::SetArgumentPointer,
112 !! KIM_ComputeArguments_SetArgumentPointerInteger,
113 !! KIM_ComputeArguments_SetArgumentPointerDouble
114 !!
115 !! \since 2.0
116 interface kim_set_argument_pointer
117 module procedure kim_compute_arguments_set_argument_pointer_int0
118 module procedure kim_compute_arguments_set_argument_pointer_int1
119 module procedure kim_compute_arguments_set_argument_pointer_int2
120 module procedure kim_compute_arguments_set_argument_pointer_double0
121 module procedure kim_compute_arguments_set_argument_pointer_double1
122 module procedure kim_compute_arguments_set_argument_pointer_double2
123 end interface kim_set_argument_pointer
124
125 !> \brief \copybrief KIM::ComputeArguments::SetCallbackPointer
126 !!
127 !! \sa KIM::ComputeArguments::SetCallbackPointer,
128 !! KIM_ComputeArguments_SetCallbackPointer
129 !!
130 !! \since 2.0
131 interface kim_set_callback_pointer
132 module procedure kim_compute_arguments_set_callback_pointer
133 end interface kim_set_callback_pointer
134
135 !> \brief \copybrief KIM::ComputeArguments::<!--
136 !! -->AreAllRequiredArgumentsAndCallbacksPresent
137 !!
138 !! \sa KIM::ComputeArguments::AreAllRequiredArgumentsAndCallbacksPresent,
139 !! KIM_ComputeArguments_AreAllRequiredArgumentsAndCallbacksPresent
140 !!
141 !! \since 2.0
142 interface kim_are_all_required_present
143 module procedure kim_compute_arguments_are_all_required_present
144 end interface kim_are_all_required_present
145
146 !> \brief \copybrief KIM::ComputeArguments::SetSimulatorBufferPointer
147 !!
148 !! \sa KIM::ComputeArguments::SetSimulatorBufferPointer,
149 !! KIM_ComputeArguments_SetSimulatorBufferPointer
150 !!
151 !! \since 2.0
152 interface kim_set_simulator_buffer_pointer
153 module procedure kim_compute_arguments_set_simulator_buffer_pointer
154 end interface kim_set_simulator_buffer_pointer
155
156 !> \brief \copybrief KIM::ComputeArguments::GetSimulatorBufferPointer
157 !!
158 !! \sa KIM::ComputeArguments::GetSimulatorBufferPointer,
159 !! KIM_ComputeArguments_GetSimulatorBufferPointer
160 !!
161 !! \since 2.0
162 interface kim_get_simulator_buffer_pointer
163 module procedure kim_compute_arguments_get_simulator_buffer_pointer
164 end interface kim_get_simulator_buffer_pointer
165
166 !> \brief \copybrief KIM::ComputeArguments::ToString
167 !!
168 !! \sa KIM::ComputeArguments::ToString, KIM_ComputeArguments_ToString
169 !!
170 !! \since 2.0
171 interface kim_to_string
172 module procedure kim_compute_arguments_to_string
173 end interface kim_to_string
174
175 !> \brief \copybrief KIM::ComputeArguments::SetLogID
176 !!
177 !! \sa KIM::ComputeArguments::SetLogID, KIM_ComputeArguments_SetLogID
178 !!
179 !! \since 2.0
180 interface kim_set_log_id
181 module procedure kim_compute_arguments_set_log_id
182 end interface kim_set_log_id
183
184 !> \brief \copybrief KIM::ComputeArguments::PushLogVerbosity
185 !!
186 !! \sa KIM::ComputeArguments::PushLogVerbosity,
187 !! KIM_ComputeArguments_PushLogVerbosity
188 !!
189 !! \since 2.0
190 interface kim_push_log_verbosity
191 module procedure kim_compute_arguments_push_log_verbosity
192 end interface kim_push_log_verbosity
193
194 !> \brief \copybrief KIM::ComputeArguments::PopLogVerbosity
195 !!
196 !! \sa KIM::ComputeArguments::PopLogVerbosity,
197 !! KIM_ComputeArguments_PopLogVerbosity
198 !!
199 !! \since 2.0
200 interface kim_pop_log_verbosity
201 module procedure kim_compute_arguments_pop_log_verbosity
202 end interface kim_pop_log_verbosity
203
204 contains
205 !> \brief Compares kim_compute_arguments_handle_type's for equality.
206 !!
207 !! \since 2.0
208 logical recursive function kim_compute_arguments_handle_equal(lhs, rhs)
209 implicit none
210 type(kim_compute_arguments_handle_type), intent(in) :: lhs
211 type(kim_compute_arguments_handle_type), intent(in) :: rhs
212
213 if ((.not. c_associated(lhs%p)) .and. (.not. c_associated(rhs%p))) then
214 kim_compute_arguments_handle_equal = .true.
215 else
216 kim_compute_arguments_handle_equal = c_associated(lhs%p, rhs%p)
217 end if
218 end function kim_compute_arguments_handle_equal
219
220 !> \brief Compares kim_compute_arguments_handle_type's for inequality.
221 !!
222 !! \since 2.0
223 logical recursive function kim_compute_arguments_handle_not_equal(lhs, rhs)
224 implicit none
225 type(kim_compute_arguments_handle_type), intent(in) :: lhs
226 type(kim_compute_arguments_handle_type), intent(in) :: rhs
227
228 kim_compute_arguments_handle_not_equal = .not. (lhs == rhs)
229 end function kim_compute_arguments_handle_not_equal
230
231 !> \brief \copybrief KIM::ComputeArguments::GetArgumentSupportStatus
232 !!
233 !! \sa KIM::ComputeArguments::GetArgumentSupportStatus,
234 !! KIM_ComputeArguments_GetArgumentSupportStatus
235 !!
236 !! \since 2.0
237 recursive subroutine kim_compute_arguments_get_argument_support_status( &
238 compute_arguments_handle, compute_argument_name, &
239 support_status, ierr)
240 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
241 use kim_support_status_module, only: kim_support_status_type
242 use kim_interoperable_types_module, only: kim_compute_arguments_type
243 implicit none
244 interface
245 integer(c_int) recursive function get_argument_support_status( &
246 compute_arguments, compute_argument_name, support_status) &
247 bind(c, name="KIM_ComputeArguments_GetArgumentSupportStatus")
248 use, intrinsic :: iso_c_binding
249 use kim_compute_argument_name_module, only: &
250 kim_compute_argument_name_type
251 use kim_support_status_module, only: kim_support_status_type
252 use kim_interoperable_types_module, only: kim_compute_arguments_type
253 implicit none
254 type(kim_compute_arguments_type), intent(in) :: compute_arguments
255 type(kim_compute_argument_name_type), intent(in), value :: &
256 compute_argument_name
257 type(kim_support_status_type), intent(out) :: support_status
258 end function get_argument_support_status
259 end interface
260 type(kim_compute_arguments_handle_type), intent(in) :: &
261 compute_arguments_handle
262 type(kim_compute_argument_name_type), intent(in) :: &
263 compute_argument_name
264 type(kim_support_status_type), intent(out) :: support_status
265 integer(c_int), intent(out) :: ierr
266 type(kim_compute_arguments_type), pointer :: compute_arguments
267
268 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
269 ierr = get_argument_support_status(compute_arguments, &
270 compute_argument_name, support_status)
271 end subroutine kim_compute_arguments_get_argument_support_status
272
273 !> \brief \copybrief KIM::ComputeArguments::GetCallbackSupportStatus
274 !!
275 !! \sa KIM::ComputeArguments::GetCallbackSupportStatus,
276 !! KIM_ComputeArguments_GetCallbackSupportStatus
277 !!
278 !! \since 2.0
279 recursive subroutine kim_compute_arguments_get_callback_support_status( &
280 compute_arguments_handle, compute_callback_name, support_status, ierr)
281 use kim_compute_callback_name_module, only: kim_compute_callback_name_type
282 use kim_support_status_module, only: kim_support_status_type
283 use kim_interoperable_types_module, only: kim_compute_arguments_type
284 implicit none
285 interface
286 integer(c_int) recursive function get_callback_support_status( &
287 compute_arguments, compute_callback_name, support_status) &
288 bind(c, name="KIM_ComputeArguments_GetCallbackSupportStatus")
289 use, intrinsic :: iso_c_binding
290 use kim_compute_callback_name_module, only: &
291 kim_compute_callback_name_type
292 use kim_support_status_module, only: kim_support_status_type
293 use kim_interoperable_types_module, only: kim_compute_arguments_type
294 implicit none
295 type(kim_compute_arguments_type), intent(in) :: compute_arguments
296 type(kim_compute_callback_name_type), intent(in), value :: &
297 compute_callback_name
298 type(kim_support_status_type), intent(out) :: support_status
299 end function get_callback_support_status
300 end interface
301 type(kim_compute_arguments_handle_type), intent(in) :: &
302 compute_arguments_handle
303 type(kim_compute_callback_name_type), intent(in) :: &
304 compute_callback_name
305 type(kim_support_status_type), intent(out) :: support_status
306 integer(c_int), intent(out) :: ierr
307 type(kim_compute_arguments_type), pointer :: compute_arguments
308
309 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
310 ierr = get_callback_support_status(compute_arguments, &
311 compute_callback_name, support_status)
312 end subroutine kim_compute_arguments_get_callback_support_status
313
314 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
315 !!
316 !! \sa KIM::ComputeArguments::SetArgumentPointer,
317 !! KIM_ComputeArguments_SetArgumentPointerInteger
318 !!
319 !! \since 2.0
320 recursive subroutine kim_compute_arguments_set_argument_pointer_int0( &
321 compute_arguments_handle, compute_argument_name, int0, ierr)
322 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
323 use kim_interoperable_types_module, only: kim_compute_arguments_type
324 implicit none
325 interface
326 integer(c_int) recursive function set_argument_pointer_integer( &
327 compute_arguments, compute_argument_name, ptr) &
328 bind(c, name="KIM_ComputeArguments_SetArgumentPointerInteger")
329 use, intrinsic :: iso_c_binding
330 use kim_compute_argument_name_module, only: &
331 kim_compute_argument_name_type
332 use kim_interoperable_types_module, only: kim_compute_arguments_type
333 implicit none
334 type(kim_compute_arguments_type), intent(in) :: compute_arguments
335 type(kim_compute_argument_name_type), intent(in), value :: &
336 compute_argument_name
337 type(c_ptr), intent(in), value :: ptr
338 end function set_argument_pointer_integer
339 end interface
340 type(kim_compute_arguments_handle_type), intent(in) :: &
341 compute_arguments_handle
342 type(kim_compute_argument_name_type), intent(in) :: &
343 compute_argument_name
344 integer(c_int), intent(in), target :: int0
345 integer(c_int), intent(out) :: ierr
346 type(kim_compute_arguments_type), pointer :: compute_arguments
347
348 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
349 ierr = set_argument_pointer_integer(compute_arguments, &
350 compute_argument_name, c_loc(int0))
351 end subroutine kim_compute_arguments_set_argument_pointer_int0
352
353 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
354 !!
355 !! \sa KIM::ComputeArguments::SetArgumentPointer,
356 !! KIM_ComputeArguments_SetArgumentPointerInteger
357 !!
358 !! \since 2.0
359 recursive subroutine kim_compute_arguments_set_argument_pointer_int1( &
360 compute_arguments_handle, compute_argument_name, int1, ierr)
361 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
362 use kim_interoperable_types_module, only: kim_compute_arguments_type
363 implicit none
364 type(kim_compute_arguments_handle_type), intent(in) :: &
365 compute_arguments_handle
366 type(kim_compute_argument_name_type), intent(in) :: &
367 compute_argument_name
368 integer(c_int), intent(in), target :: int1(:)
369 integer(c_int), intent(out) :: ierr
370 type(kim_compute_arguments_type), pointer :: compute_arguments
371
372 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
373 call set(compute_arguments, compute_argument_name, size(int1, 1, c_int), &
374 int1, ierr)
375 return
376
377 contains
378 recursive subroutine set(compute_arguments, compute_argument_name, &
379 extent1, int1, ierr)
380 use kim_compute_argument_name_module, only: &
381 kim_compute_argument_name_type
382 use kim_interoperable_types_module, only: kim_compute_arguments_type
383 implicit none
384 interface
385 integer(c_int) recursive function set_argument_pointer_integer( &
386 compute_arguments, compute_argument_name, ptr) &
387 bind(c, name="KIM_ComputeArguments_SetArgumentPointerInteger")
388 use, intrinsic :: iso_c_binding
389 use kim_compute_argument_name_module, only: &
390 kim_compute_argument_name_type
391 use kim_interoperable_types_module, only: kim_compute_arguments_type
392 implicit none
393 type(kim_compute_arguments_type), intent(in) :: compute_arguments
394 type(kim_compute_argument_name_type), intent(in), value :: &
395 compute_argument_name
396 type(c_ptr), intent(in), value :: ptr
397 end function set_argument_pointer_integer
398 end interface
399 type(kim_compute_arguments_type), intent(in) :: compute_arguments
400 type(kim_compute_argument_name_type), intent(in) :: &
401 compute_argument_name
402 integer(c_int), intent(in) :: extent1
403 integer(c_int), intent(in), target :: int1(extent1)
404 integer(c_int), intent(out) :: ierr
405
406 ierr = set_argument_pointer_integer(compute_arguments, &
407 compute_argument_name, c_loc(int1))
408 end subroutine set
409 end subroutine kim_compute_arguments_set_argument_pointer_int1
410
411 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
412 !!
413 !! \sa KIM::ComputeArguments::SetArgumentPointer,
414 !! KIM_ComputeArguments_SetArgumentPointerInteger
415 !!
416 !! \since 2.0
417 recursive subroutine kim_compute_arguments_set_argument_pointer_int2( &
418 compute_arguments_handle, compute_argument_name, int2, ierr)
419 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
420 use kim_interoperable_types_module, only: kim_compute_arguments_type
421 implicit none
422 type(kim_compute_arguments_handle_type), intent(in) :: &
423 compute_arguments_handle
424 type(kim_compute_argument_name_type), intent(in) :: &
425 compute_argument_name
426 integer(c_int), intent(in), target :: int2(:, :)
427 integer(c_int), intent(out) :: ierr
428 type(kim_compute_arguments_type), pointer :: compute_arguments
429
430 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
431 call set(compute_arguments, compute_argument_name, size(int2, 1, c_int), &
432 size(int2, 2, c_int), int2, ierr)
433 return
434
435 contains
436 recursive subroutine set(compute_arguments, compute_argument_name, &
437 extent1, extent2, int2, ierr)
438 use kim_compute_argument_name_module, only: &
439 kim_compute_argument_name_type
440 use kim_interoperable_types_module, only: kim_compute_arguments_type
441 implicit none
442 interface
443 integer(c_int) recursive function set_argument_pointer_integer( &
444 compute_arguments, compute_argument_name, ptr) &
445 bind(c, name="KIM_ComputeArguments_SetArgumentPointerInteger")
446 use, intrinsic :: iso_c_binding
447 use kim_compute_argument_name_module, only: &
448 kim_compute_argument_name_type
449 use kim_interoperable_types_module, only: kim_compute_arguments_type
450 implicit none
451 type(kim_compute_arguments_type), intent(in) :: compute_arguments
452 type(kim_compute_argument_name_type), intent(in), value :: &
453 compute_argument_name
454 type(c_ptr), intent(in), value :: ptr
455 end function set_argument_pointer_integer
456 end interface
457 type(kim_compute_arguments_type), intent(in) :: compute_arguments
458 type(kim_compute_argument_name_type), intent(in) :: &
459 compute_argument_name
460 integer(c_int), intent(in) :: extent1
461 integer(c_int), intent(in) :: extent2
462 integer(c_int), intent(in), target :: int2(extent1, extent2)
463 integer(c_int), intent(out) :: ierr
464
465 ierr = set_argument_pointer_integer(compute_arguments, &
466 compute_argument_name, c_loc(int2))
467 end subroutine set
468 end subroutine kim_compute_arguments_set_argument_pointer_int2
469
470 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
471 !!
472 !! \sa KIM::ComputeArguments::SetArgumentPointer,
473 !! KIM_ComputeArguments_SetArgumentPointerDouble
474 !!
475 !! \since 2.0
476 recursive subroutine kim_compute_arguments_set_argument_pointer_double0( &
477 compute_arguments_handle, compute_argument_name, double0, ierr)
478 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
479 use kim_interoperable_types_module, only: kim_compute_arguments_type
480 implicit none
481 interface
482 integer(c_int) recursive function set_argument_pointer_double( &
483 compute_arguments, compute_argument_name, ptr) &
484 bind(c, name="KIM_ComputeArguments_SetArgumentPointerDouble")
485 use, intrinsic :: iso_c_binding
486 use kim_compute_argument_name_module, only: &
487 kim_compute_argument_name_type
488 use kim_interoperable_types_module, only: kim_compute_arguments_type
489 implicit none
490 type(kim_compute_arguments_type), intent(in) :: compute_arguments
491 type(kim_compute_argument_name_type), intent(in), value :: &
492 compute_argument_name
493 type(c_ptr), intent(in), value :: ptr
494 end function set_argument_pointer_double
495 end interface
496 type(kim_compute_arguments_handle_type), intent(in) :: &
497 compute_arguments_handle
498 type(kim_compute_argument_name_type), intent(in) :: &
499 compute_argument_name
500 real(c_double), intent(in), target :: double0
501 integer(c_int), intent(out) :: ierr
502 type(kim_compute_arguments_type), pointer :: compute_arguments
503
504 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
505 ierr = set_argument_pointer_double(compute_arguments, &
506 compute_argument_name, c_loc(double0))
507 end subroutine kim_compute_arguments_set_argument_pointer_double0
508
509 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
510 !!
511 !! \sa KIM::ComputeArguments::SetArgumentPointer,
512 !! KIM_ComputeArguments_SetArgumentPointerDouble
513 !!
514 !! \since 2.0
515 recursive subroutine kim_compute_arguments_set_argument_pointer_double1( &
516 compute_arguments_handle, compute_argument_name, double1, ierr)
517 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
518 use kim_interoperable_types_module, only: kim_compute_arguments_type
519 implicit none
520 type(kim_compute_arguments_handle_type), intent(in) :: &
521 compute_arguments_handle
522 type(kim_compute_argument_name_type), intent(in) :: &
523 compute_argument_name
524 real(c_double), intent(in), target :: double1(:)
525 integer(c_int), intent(out) :: ierr
526 type(kim_compute_arguments_type), pointer :: compute_arguments
527
528 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
529 call set(compute_arguments, compute_argument_name, &
530 size(double1, 1, c_int), double1, ierr)
531 return
532
533 contains
534 recursive subroutine set(compute_arguments, compute_argument_name, &
535 extent1, double1, ierr)
536 use kim_compute_argument_name_module, only: &
537 kim_compute_argument_name_type
538 use kim_interoperable_types_module, only: kim_compute_arguments_type
539 implicit none
540 interface
541 integer(c_int) recursive function set_argument_pointer_double( &
542 compute_arguments, compute_argument_name, ptr) &
543 bind(c, name="KIM_ComputeArguments_SetArgumentPointerDouble")
544 use, intrinsic :: iso_c_binding
545 use kim_compute_argument_name_module, only: &
546 kim_compute_argument_name_type
547 use kim_interoperable_types_module, only: kim_compute_arguments_type
548 implicit none
549 type(kim_compute_arguments_type), intent(in) :: compute_arguments
550 type(kim_compute_argument_name_type), intent(in), value :: &
551 compute_argument_name
552 type(c_ptr), intent(in), value :: ptr
553 end function set_argument_pointer_double
554 end interface
555 type(kim_compute_arguments_type), intent(in) :: compute_arguments
556 type(kim_compute_argument_name_type), intent(in) :: &
557 compute_argument_name
558 integer(c_int), intent(in) :: extent1
559 real(c_double), intent(in), target :: double1(extent1)
560 integer(c_int), intent(out) :: ierr
561
562 ierr = set_argument_pointer_double(compute_arguments, &
563 compute_argument_name, c_loc(double1))
564 end subroutine set
565 end subroutine kim_compute_arguments_set_argument_pointer_double1
566
567 !> \brief \copybrief KIM::ComputeArguments::SetArgumentPointer
568 !!
569 !! \sa KIM::ComputeArguments::SetArgumentPointer,
570 !! KIM_ComputeArguments_SetArgumentPointerDouble
571 !!
572 !! \since 2.0
573 recursive subroutine kim_compute_arguments_set_argument_pointer_double2( &
574 compute_arguments_handle, compute_argument_name, double2, ierr)
575 use kim_compute_argument_name_module, only: kim_compute_argument_name_type
576 use kim_interoperable_types_module, only: kim_compute_arguments_type
577 implicit none
578 type(kim_compute_arguments_handle_type), intent(in) :: &
579 compute_arguments_handle
580 type(kim_compute_argument_name_type), intent(in) :: &
581 compute_argument_name
582 real(c_double), intent(in), target :: double2(:, :)
583 integer(c_int), intent(out) :: ierr
584 type(kim_compute_arguments_type), pointer :: compute_arguments
585
586 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
587 call set(compute_arguments, compute_argument_name, &
588 size(double2, 1, c_int), size(double2, 2, c_int), double2, ierr)
589 return
590
591 contains
592 recursive subroutine set(compute_arguments, compute_argument_name, &
593 extent1, extent2, double2, ierr)
594 use kim_compute_argument_name_module, only: &
595 kim_compute_argument_name_type
596 implicit none
597 interface
598 integer(c_int) recursive function set_argument_pointer_double( &
599 compute_arguments, compute_argument_name, ptr) &
600 bind(c, name="KIM_ComputeArguments_SetArgumentPointerDouble")
601 use, intrinsic :: iso_c_binding
602 use kim_compute_argument_name_module, only: &
603 kim_compute_argument_name_type
604 use kim_interoperable_types_module, only: kim_compute_arguments_type
605 implicit none
606 type(kim_compute_arguments_type), intent(in) :: compute_arguments
607 type(kim_compute_argument_name_type), intent(in), value :: &
608 compute_argument_name
609 type(c_ptr), intent(in), value :: ptr
610 end function set_argument_pointer_double
611 end interface
612 type(kim_compute_arguments_type), intent(in) :: compute_arguments
613 type(kim_compute_argument_name_type), intent(in) :: &
614 compute_argument_name
615 integer(c_int), intent(in) :: extent1
616 integer(c_int), intent(in) :: extent2
617 real(c_double), intent(in), target :: double2(extent1, extent2)
618 integer(c_int), intent(out) :: ierr
619
620 ierr = set_argument_pointer_double(compute_arguments, &
621 compute_argument_name, c_loc(double2))
622 end subroutine set
623 end subroutine kim_compute_arguments_set_argument_pointer_double2
624
625 !> \brief \copybrief KIM::ComputeArguments::SetCallbackPointer
626 !!
627 !! \sa KIM::ComputeArguments::SetCallbackPointer,
628 !! KIM_ComputeArguments_SetCallbackPointer
629 !!
630 !! \since 2.0
631 recursive subroutine kim_compute_arguments_set_callback_pointer( &
632 compute_arguments_handle, compute_callback_name, language_name, fptr, &
633 data_object, ierr)
634 use kim_compute_callback_name_module, only: kim_compute_callback_name_type
635 use kim_language_name_module, only: kim_language_name_type
636 use kim_interoperable_types_module, only: kim_compute_arguments_type
637 implicit none
638 interface
639 integer(c_int) recursive function set_callback_pointer( &
640 compute_arguments, compute_callback_name, language_name, fptr, &
641 data_object) bind(c, name="KIM_ComputeArguments_SetCallbackPointer")
642 use, intrinsic :: iso_c_binding
643 use kim_language_name_module, only: kim_language_name_type
644 use kim_compute_callback_name_module, only: &
645 kim_compute_callback_name_type
646 use kim_interoperable_types_module, only: kim_compute_arguments_type
647 implicit none
648 type(kim_compute_arguments_type), intent(in) :: compute_arguments
649 type(kim_language_name_type), intent(in), value :: language_name
650 type(kim_compute_callback_name_type), intent(in), value :: &
651 compute_callback_name
652 type(c_funptr), intent(in), value :: fptr
653 type(c_ptr), intent(in), value :: data_object
654 end function set_callback_pointer
655 end interface
656 type(kim_compute_arguments_handle_type), intent(in) :: &
657 compute_arguments_handle
658 type(kim_compute_callback_name_type), intent(in) :: &
659 compute_callback_name
660 type(kim_language_name_type), intent(in) :: language_name
661 type(c_funptr), intent(in), value :: fptr ! must be left as "value"!?!
662 type(c_ptr), intent(in) :: data_object
663 integer(c_int), intent(out) :: ierr
664 type(kim_compute_arguments_type), pointer :: compute_arguments
665
666 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
667 ierr = set_callback_pointer(compute_arguments, compute_callback_name, &
668 language_name, fptr, data_object)
669 end subroutine kim_compute_arguments_set_callback_pointer
670
671 !> \brief \copybrief KIM::ComputeArguments::<!--
672 !! -->AreAllRequiredArgumentsAndCallbacksPresent
673 !!
674 !! \sa KIM::ComputeArguments::AreAllRequiredArgumentsAndCallbacksPresent,
675 !! KIM_ComputeArguments_AreAllRequiredArgumentsAndCallbacksPresent
676 !!
677 !! \since 2.0
678 recursive subroutine kim_compute_arguments_are_all_required_present( &
679 compute_arguments_handle, result_value, ierr)
680 use kim_interoperable_types_module, only: kim_compute_arguments_type
681 implicit none
682 interface
683 integer(c_int) recursive function &
684 are_all_required_arguments_and_callbacks_present( &
685 compute_arguments, result_value) &
686 bind(c, &
687 name= &
688 "KIM_ComputeArguments_AreAllRequiredArgumentsAndCallbacksPresent")
689 use, intrinsic :: iso_c_binding
690 use kim_interoperable_types_module, only: kim_compute_arguments_type
691 implicit none
692 type(kim_compute_arguments_type), intent(in) :: compute_arguments
693 integer(c_int), intent(out) :: result_value
694 end function are_all_required_arguments_and_callbacks_present
695 end interface
696 type(kim_compute_arguments_handle_type), intent(in) :: &
697 compute_arguments_handle
698 integer(c_int), intent(out) :: result_value
699 integer(c_int), intent(out) :: ierr
700 type(kim_compute_arguments_type), pointer :: compute_arguments
701
702 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
703 ierr = are_all_required_arguments_and_callbacks_present( &
704 compute_arguments, result_value)
705 end subroutine kim_compute_arguments_are_all_required_present
706
707 !> \brief \copybrief KIM::ComputeArguments::SetSimulatorBufferPointer
708 !!
709 !! \sa KIM::ComputeArguments::SetSimulatorBufferPointer,
710 !! KIM_ComputeArguments_SetSimulatorBufferPointer
711 !!
712 !! \since 2.0
713 recursive subroutine kim_compute_arguments_set_simulator_buffer_pointer( &
714 compute_arguments_handle, ptr)
715 use kim_interoperable_types_module, only: kim_compute_arguments_type
716 implicit none
717 interface
718 recursive subroutine set_simulator_buffer_pointer( &
719 compute_arguments, ptr) &
720 bind(c, name="KIM_ComputeArguments_SetSimulatorBufferPointer")
721 use, intrinsic :: iso_c_binding
722 use kim_interoperable_types_module, only: kim_compute_arguments_type
723 implicit none
724 type(kim_compute_arguments_type), intent(in) :: compute_arguments
725 type(c_ptr), intent(in), value :: ptr
726 end subroutine set_simulator_buffer_pointer
727 end interface
728 type(kim_compute_arguments_handle_type), intent(in) :: &
729 compute_arguments_handle
730 type(c_ptr), intent(in) :: ptr
731 type(kim_compute_arguments_type), pointer :: compute_arguments
732
733 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
734 call set_simulator_buffer_pointer(compute_arguments, ptr)
735 end subroutine kim_compute_arguments_set_simulator_buffer_pointer
736
737 !> \brief \copybrief KIM::ComputeArguments::GetSimulatorBufferPointer
738 !!
739 !! \sa KIM::ComputeArguments::GetSimulatorBufferPointer,
740 !! KIM_ComputeArguments_GetSimulatorBufferPointer
741 !!
742 !! \since 2.0
743 recursive subroutine kim_compute_arguments_get_simulator_buffer_pointer( &
744 compute_arguments_handle, ptr)
745 use kim_interoperable_types_module, only: kim_compute_arguments_type
746 implicit none
747 interface
748 recursive subroutine get_simulator_buffer_pointer( &
749 compute_arguments, ptr) &
750 bind(c, name="KIM_ComputeArguments_GetSimulatorBufferPointer")
751 use, intrinsic :: iso_c_binding
752 use kim_interoperable_types_module, only: kim_compute_arguments_type
753 implicit none
754 type(kim_compute_arguments_type), intent(in) :: compute_arguments
755 type(c_ptr), intent(out) :: ptr
756 end subroutine get_simulator_buffer_pointer
757 end interface
758 type(kim_compute_arguments_handle_type), intent(in) :: &
759 compute_arguments_handle
760 type(c_ptr), intent(out) :: ptr
761 type(kim_compute_arguments_type), pointer :: compute_arguments
762
763 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
764 call get_simulator_buffer_pointer(compute_arguments, ptr)
765 end subroutine kim_compute_arguments_get_simulator_buffer_pointer
766
767 !> \brief \copybrief KIM::ComputeArguments::ToString
768 !!
769 !! \sa KIM::ComputeArguments::ToString, KIM_ComputeArguments_ToString
770 !!
771 !! \since 2.0
772 recursive subroutine kim_compute_arguments_to_string( &
773 compute_arguments_handle, string)
774 use kim_convert_string_module, only: kim_convert_c_char_ptr_to_string
775 use kim_interoperable_types_module, only: kim_compute_arguments_type
776 implicit none
777 interface
778 type(c_ptr) recursive function compute_arguments_string( &
779 compute_arguments) bind(c, name="KIM_ComputeArguments_ToString")
780 use, intrinsic :: iso_c_binding
781 use kim_interoperable_types_module, only: kim_compute_arguments_type
782 implicit none
783 type(kim_compute_arguments_type), intent(in) :: compute_arguments
784 end function compute_arguments_string
785 end interface
786 type(kim_compute_arguments_handle_type), intent(in) :: &
787 compute_arguments_handle
788 character(len=*, kind=c_char), intent(out) :: string
789 type(kim_compute_arguments_type), pointer :: compute_arguments
790
791 type(c_ptr) :: p
792
793 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
794 p = compute_arguments_string(compute_arguments)
795 call kim_convert_c_char_ptr_to_string(p, string)
796 end subroutine kim_compute_arguments_to_string
797
798 !> \brief \copybrief KIM::ComputeArguments::SetLogID
799 !!
800 !! \sa KIM::ComputeArguments::SetLogID, KIM_ComputeArguments_SetLogID
801 !!
802 !! \since 2.0
803 recursive subroutine kim_compute_arguments_set_log_id( &
804 compute_arguments_handle, log_id)
805 use kim_interoperable_types_module, only: kim_compute_arguments_type
806 implicit none
807 interface
808 recursive subroutine set_log_id(compute_arguments, log_id) &
809 bind(c, name="KIM_ComputeArguments_SetLogID")
810 use, intrinsic :: iso_c_binding
811 use kim_interoperable_types_module, only: kim_compute_arguments_type
812 implicit none
813 type(kim_compute_arguments_type), intent(in) :: compute_arguments
814 character(c_char), intent(in) :: log_id(*)
815 end subroutine set_log_id
816 end interface
817 type(kim_compute_arguments_handle_type), intent(in) :: &
818 compute_arguments_handle
819 character(len=*, kind=c_char), intent(in) :: log_id
820 type(kim_compute_arguments_type), pointer :: compute_arguments
821
822 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
823 call set_log_id(compute_arguments, trim(log_id)//c_null_char)
824 end subroutine kim_compute_arguments_set_log_id
825
826 !> \brief \copybrief KIM::ComputeArguments::PushLogVerbosity
827 !!
828 !! \sa KIM::ComputeArguments::PushLogVerbosity,
829 !! KIM_ComputeArguments_PushLogVerbosity
830 !!
831 !! \since 2.0
832 recursive subroutine kim_compute_arguments_push_log_verbosity( &
833 compute_arguments_handle, log_verbosity)
834 use kim_log_verbosity_module, only: kim_log_verbosity_type
835 use kim_interoperable_types_module, only: kim_compute_arguments_type
836 implicit none
837 interface
838 recursive subroutine push_log_verbosity( &
839 compute_arguments, log_verbosity) &
840 bind(c, name="KIM_ComputeArguments_PushLogVerbosity")
841 use, intrinsic :: iso_c_binding
842 use kim_log_verbosity_module, only: kim_log_verbosity_type
843 use kim_interoperable_types_module, only: kim_compute_arguments_type
844 implicit none
845 type(kim_compute_arguments_type), intent(in) :: compute_arguments
846 type(kim_log_verbosity_type), intent(in), value :: log_verbosity
847 end subroutine push_log_verbosity
848 end interface
849 type(kim_compute_arguments_handle_type), intent(in) :: &
850 compute_arguments_handle
851 type(kim_log_verbosity_type), intent(in) :: log_verbosity
852 type(kim_compute_arguments_type), pointer :: compute_arguments
853
854 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
855 call push_log_verbosity(compute_arguments, log_verbosity)
856 end subroutine kim_compute_arguments_push_log_verbosity
857
858 !> \brief \copybrief KIM::ComputeArguments::PopLogVerbosity
859 !!
860 !! \sa KIM::ComputeArguments::PopLogVerbosity,
861 !! KIM_ComputeArguments_PopLogVerbosity
862 !!
863 !! \since 2.0
864 recursive subroutine kim_compute_arguments_pop_log_verbosity( &
865 compute_arguments_handle)
866 use kim_log_verbosity_module, only: kim_log_verbosity_type
867 use kim_interoperable_types_module, only: kim_compute_arguments_type
868 implicit none
869 interface
870 recursive subroutine pop_log_verbosity(compute_arguments) &
871 bind(c, name="KIM_ComputeArguments_PopLogVerbosity")
872 use, intrinsic :: iso_c_binding
873 use kim_log_verbosity_module, only: kim_log_verbosity_type
874 use kim_interoperable_types_module, only: kim_compute_arguments_type
875 implicit none
876 type(kim_compute_arguments_type), intent(in) :: compute_arguments
877 end subroutine pop_log_verbosity
878 end interface
879 type(kim_compute_arguments_handle_type), intent(in) :: &
880 compute_arguments_handle
881 type(kim_compute_arguments_type), pointer :: compute_arguments
882
883 call c_f_pointer(compute_arguments_handle%p, compute_arguments)
884 call pop_log_verbosity(compute_arguments)
885 end subroutine kim_compute_arguments_pop_log_verbosity
886 end module kim_compute_arguments_module