UFO
ObsGeosAod.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 geosaod 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_geosaod_mod
14  use ufo_geovals_mod, only: ufo_geovals
16  implicit none
17  private
18 
19  ! ------------------------------------------------------------------------------
20 #define LISTED_TYPE ufo_geosaod
21 
22  !> Linked list interface - defines registry_t type
23 #include "oops/util/linkedList_i.f"
24  !> Global registry
25  type(registry_t) :: ufo_geosaod_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_geosaod_setup_c(c_key_self, c_conf, c_obsvars, c_geovars) bind(c,name='ufo_geosaod_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_geosaod), 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_geosaod_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_geosaod_setup_c
58 
59 ! ------------------------------------------------------------------------------
60 
61 subroutine ufo_geosaod_delete_c(c_key_self) bind(c,name='ufo_geosaod_delete_f90')
62 implicit none
63 integer(c_int), intent(inout) :: c_key_self
64 
65 type(ufo_geosaod), pointer :: self
66 
67 call ufo_geosaod_registry%delete(c_key_self, self)
68 
69 end subroutine ufo_geosaod_delete_c
70 
71 ! ------------------------------------------------------------------------------
72 
73 subroutine ufo_geosaod_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, &
74  c_hofx) bind(c,name='ufo_geosaod_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_geosaod), pointer :: self
84 type(ufo_geovals), pointer :: geovals
85 
86 call ufo_geosaod_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_geosaod_simobs_c
91 
92 ! ------------------------------------------------------------------------------
93 
94 end module ufo_geosaod_mod_c
ufo_geosaod_mod_c
Fortran geosaod module for functions on the interface between C++ and Fortran.
Definition: ObsGeosAod.interface.F90:9
ufo_geosaod_mod
Fortran module for geosaod observation operator.
Definition: ufo_geosaod_mod.F90:8
ufo_geosaod_mod_c::ufo_geosaod_simobs_c
subroutine ufo_geosaod_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
Definition: ObsGeosAod.interface.F90:75
ufo_geosaod_mod::ufo_geosaod
Fortran derived type for the observation type.
Definition: ufo_geosaod_mod.F90:22
ufo_geovals_mod
Definition: ufo_geovals_mod.F90:7
ufo_geosaod_mod_c::ufo_geosaod_delete_c
subroutine ufo_geosaod_delete_c(c_key_self)
Definition: ObsGeosAod.interface.F90:62
ufo_geovals_mod_c
Definition: GeoVaLs.interface.F90:7
ufo_geosaod_mod_c::ufo_geosaod_setup_c
subroutine ufo_geosaod_setup_c(c_key_self, c_conf, c_obsvars, c_geovars)
Linked list implementation.
Definition: ObsGeosAod.interface.F90:38
ufo_vars_mod
Definition: ufo_variables_mod.F90:8
ufo_geosaod_mod_c::ufo_geosaod_registry
type(registry_t) ufo_geosaod_registry
Linked list interface - defines registry_t type.
Definition: ObsGeosAod.interface.F90:25
ufo_geovals_mod::ufo_geovals
type to hold interpolated fields required by the obs operators
Definition: ufo_geovals_mod.F90:47
ufo_geovals_mod_c::ufo_geovals_registry
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
Definition: GeoVaLs.interface.F90:30