UFO
MetOfficeRMatrixRadiance.interface.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! (C) Crown Copyright 2021 Met Office
3 !
4 ! This software is licensed under the terms of the Apache Licence Version 2.0
5 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 !-------------------------------------------------------------------------------
7 
9 
10 use fckit_configuration_module, only: fckit_configuration
11 use iso_c_binding
12 use kinds
14 
15 implicit none
16 
17 private
18 
19 #define LISTED_TYPE ufo_metoffice_rmatrixradiance
20 
21 !> Linked list interface - defines registry_t type
22 #include "oops/util/linkedList_i.f"
23 
24 !> Global registry
26 
27 contains
28 
29 !> Linked list implementation
30 #include "oops/util/linkedList_c.f"
31 
32 !-------------------------------------------------------------------------------
33 subroutine ufo_metoffice_rmatrixradiance_setup_c(c_self, c_conf, nchans, wmoid, rtype) &
34  bind(c, name='ufo_metoffice_rmatrixradiance_setup_f90')
35 
36 implicit none
37 integer(c_int), intent(inout) :: c_self
38 type(c_ptr), value, intent(in) :: c_conf
39 integer(c_size_t), intent(inout) :: nchans
40 integer(c_size_t), intent(inout) :: wmoid
41 integer(c_size_t), intent(inout) :: rtype
42 
43 type(ufo_metoffice_rmatrixradiance), pointer :: self
44 type(fckit_configuration) :: f_conf
45 character(len=:), allocatable :: str
46 character(len=200) :: filepath
47 
48 ! Interface and setup
49 call ufo_metoffice_rmatrixradiance_registry % setup(c_self, self)
50 
51 ! Get filepath from configuration
52 f_conf = fckit_configuration(c_conf)
53 call f_conf % get_or_die("RMatrix", str)
54 filepath = str
55 
56 ! Call Fortran
57 call self % setup(trim(filepath))
58 
59 ! Pass back dimension and wmoid
60 nchans = self % nchans
61 wmoid = self % wmo_id
62 rtype = self % rtype
63 
65 
66 !-------------------------------------------------------------------------------
68  bind(c, name='ufo_metoffice_rmatrixradiance_delete_f90')
69 
70 implicit none
71 integer(c_int), intent(inout) :: c_self
72 
73 ! Interface and setup
74 type(ufo_metoffice_rmatrixradiance), pointer :: self
75 call ufo_metoffice_rmatrixradiance_registry % get(c_self, self)
76 
77 ! Delete
78 call self % delete()
79 call ufo_metoffice_rmatrixradiance_registry % delete(c_self, self)
80 
82 
83 !-------------------------------------------------------------------------------
84 subroutine ufo_metoffice_rmatrixradiance_getelements_c(c_self, nchans, channels, obs_error) &
85  bind(c, name='ufo_metoffice_rmatrixradiance_getelements_f90')
86 
87 implicit none
88 integer(c_int), intent(inout) :: c_self
89 integer(c_size_t), intent(in) :: nchans
90 integer(c_int), intent(inout) :: channels(nchans)
91 real(c_float), intent(inout) :: obs_error(nchans)
92 
93 type(ufo_metoffice_rmatrixradiance), pointer :: self
94 
95 call ufo_metoffice_rmatrixradiance_registry%get(c_self, self)
96 
97 channels = self % channels(1:nchans)
98 obs_error = self % errors(1:nchans)
99 
101 
102 !-------------------------------------------------------------------------------
104  bind(c, name='ufo_metoffice_rmatrixradiance_print_f90')
105 
106 implicit none
107 integer(c_int), intent(inout) :: c_self
108 
109 ! Interface and setup
110 type(ufo_metoffice_rmatrixradiance), pointer :: self
111 call ufo_metoffice_rmatrixradiance_registry % get(c_self, self)
112 
113 ! Print information about object
114 call self % print()
115 
117 
118 !-------------------------------------------------------------------------------
type(registry_t) ufo_metoffice_rmatrixradiance_registry
Linked list interface - defines registry_t type.
subroutine ufo_metoffice_rmatrixradiance_setup_c(c_self, c_conf, nchans, wmoid, rtype)
Linked list implementation.
subroutine ufo_metoffice_rmatrixradiance_getelements_c(c_self, nchans, channels, obs_error)
Fortran derived type to hold data for the observation covariance.