UFO
ObsAodGeos.interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2019 UCAR
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 
6 !> Fortran aodgeos module for functions on the interface between C++ and Fortran
7 ! to handle observation operators
8 
10 
11  use iso_c_binding
12  use fckit_configuration_module, only: fckit_configuration
13  use ufo_aodgeos_mod
14  use ufo_geovals_mod, only: ufo_geovals
16  implicit none
17  private
18 
19  ! ------------------------------------------------------------------------------
20 #define LISTED_TYPE ufo_aodgeos
21 
22  !> Linked list interface - defines registry_t type
23 #include "oops/util/linkedList_i.f"
24  !> Global registry
25  type(registry_t) :: ufo_aodgeos_registry
26 
27  ! ------------------------------------------------------------------------------
28 
29 contains
30 
31  ! ------------------------------------------------------------------------------
32  !> Linked list implementation
33 #include "oops/util/linkedList_c.f"
34 
35 ! ------------------------------------------------------------------------------
36 
37 subroutine ufo_aodgeos_setup_c(c_key_self, c_conf, c_obsvars, c_geovars) bind(c,name='ufo_aodgeos_setup_f90')
38 use oops_variables_mod
39 use ufo_vars_mod
40 implicit none
41 integer(c_int), intent(inout) :: c_key_self
42 type(c_ptr), intent(in), value :: c_conf
43 type(ufo_aodgeos), pointer :: self
44 type(c_ptr), intent(in), value :: c_obsvars !< variables to be simulated
45 type(c_ptr), intent(in), value :: c_geovars !< variables requested from the model
46 
47 type(fckit_configuration) :: f_conf
48 
49 call ufo_aodgeos_registry%setup(c_key_self, self)
50 f_conf = fckit_configuration(c_conf)
51 
52 self%obsvars = oops_variables(c_obsvars)
53 self%geovars = oops_variables(c_geovars)
54 
55 call self%setup(f_conf)
56 
57 end subroutine ufo_aodgeos_setup_c
58 
59 ! ------------------------------------------------------------------------------
60 
61 subroutine ufo_aodgeos_delete_c(c_key_self) bind(c,name='ufo_aodgeos_delete_f90')
62 implicit none
63 integer(c_int), intent(inout) :: c_key_self
64 
65 type(ufo_aodgeos), pointer :: self
66 
67 call ufo_aodgeos_registry%delete(c_key_self, self)
68 
69 end subroutine ufo_aodgeos_delete_c
70 
71 ! ------------------------------------------------------------------------------
72 
73 subroutine ufo_aodgeos_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, &
74  c_hofx) bind(c,name='ufo_aodgeos_simobs_f90')
75 
76 implicit none
77 integer(c_int), intent(in) :: c_key_self
78 integer(c_int), intent(in) :: c_key_geovals
79 type(c_ptr), value, intent(in) :: c_obsspace
80 integer(c_int), intent(in) :: c_nvars, c_nlocs
81 real(c_double), intent(inout) :: c_hofx(c_nvars, c_nlocs)
82 
83 type(ufo_aodgeos), pointer :: self
84 type(ufo_geovals), pointer :: geovals
85 
86 call ufo_aodgeos_registry%get(c_key_self, self)
87 call ufo_geovals_registry%get(c_key_geovals, geovals)
88 call self%simobs(geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
89 
90 end subroutine ufo_aodgeos_simobs_c
91 
92 ! ------------------------------------------------------------------------------
93 
94 end module ufo_aodgeos_mod_c
Fortran aodgeos module for functions on the interface between C++ and Fortran.
subroutine ufo_aodgeos_delete_c(c_key_self)
subroutine ufo_aodgeos_setup_c(c_key_self, c_conf, c_obsvars, c_geovars)
Linked list implementation.
type(registry_t) ufo_aodgeos_registry
Linked list interface - defines registry_t type.
subroutine ufo_aodgeos_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
Fortran module for aodgeos observation operator.
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
Fortran derived type for the observation type.
type to hold interpolated fields required by the obs operators