Debian Codegraph @

src/libutils.F90

raw
1 !-----------------------------------------------------------------
2 !
3 ! This file is (or was) part of SPLASH, a visualisation tool
4 ! for Smoothed Particle Hydrodynamics written by Daniel Price:
5 !
6 ! http://users.monash.edu.au/~dprice/splash
7 !
8 ! SPLASH comes with ABSOLUTELY NO WARRANTY.
9 ! This is free software; and you are welcome to redistribute
10 ! it under the terms of the GNU General Public License
11 ! (see LICENSE file for details) and the provision that
12 ! this notice remains intact. If you modify this file, please
13 ! note section 2a) of the GPLv2 states that:
14 !
15 ! a) You must cause the modified files to carry prominent notices
16 ! stating that you changed the files and the date of any change.
17 !
18 ! Copyright (C) 2005-2020 Daniel Price. All rights reserved.
19 ! Contact: [email protected]
20 !
21 !-----------------------------------------------------------------
22
23 !-------------------------------------------------------------------------
24 ! Module providing library version of splash read_data routines
25 ! specifies c interfaces to corresponding Fortran subroutines
26 !-------------------------------------------------------------------------
27 module libutils
28 use iso_c_binding, only:c_float, c_double
29
30 implicit none
31
32 public
33
34 #ifdef DP
35 integer, parameter :: c_real = c_double
36 #else
37 integer, parameter :: c_real = c_float
38 #endif
39
40 contains
41
42 subroutine check_argcv()
43 include 'libinclude.f90'
44 end subroutine check_argcv
45
46 function ctypes_to_fstring(array)
47 use, intrinsic :: iso_c_binding, only:c_char
48 character(kind=c_char), dimension(:), intent(in) :: array
49 character(len=size(array)) :: ctypes_to_fstring
50 integer :: i
51
52 ctypes_to_fstring = ''
53 do i=1,size(array)
54 if (array(i)==achar(0)) exit
55 ctypes_to_fstring(i:i) = array(i)
56 enddo
57
58 end function ctypes_to_fstring
59
60 end module libutils