-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_wavelength_wrapper.f90
More file actions
41 lines (30 loc) · 1.3 KB
/
get_wavelength_wrapper.f90
File metadata and controls
41 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
!> Wrapper for interfacing `m_get_wavelength` with python
!>
!> Written by hand here.
!> Generation to be automated in future (including docstrings of some sort).
!> One other note:
!> This function returns a standard Fortran type.
!> In future, we will want to add in returning Fortran derived types too.
!> Doing that will require adding in an extra 'manager' layer
!> so there will be one extra file compared to what we have here.
module m_get_wavelength_w ! Convention to date: just suffix wrappers with _w
use m_get_wavelength, only: o_get_wavelength => get_wavelength
! We won't always need the renaming trick,
! but here we do as the wrapper function
! and the original function should have the same name.
! ("o_" for original)
implicit none(type, external)
private
public :: get_wavelength
contains
pure function get_wavelength(frequency) result(wavelength)
! Annoying that this has to be injected everywhere,
! but ok it can be automated.
integer, parameter :: dp = selected_real_kind(15, 307)
real(kind=dp), intent(in) :: frequency
!! Frequency
real(kind=dp) :: wavelength
!! Corresponding wavelength
wavelength = o_get_wavelength(frequency)
end function get_wavelength
end module m_get_wavelength_w