UFO
ObsIdentity.interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017-2018 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 identity module for functions on the interface between C++ and Fortran
7 ! to handle observation operators
8 
10 
11  use iso_c_binding
14  use ufo_geovals_mod, only: ufo_geovals
15  implicit none
16 
17  private
18 
19 #define LISTED_TYPE ufo_identity
20 
21  !> Linked list interface - defines registry_t type
22 #include "oops/util/linkedList_i.f"
23 
24  !> Global registry
25  type(registry_t) :: ufo_identity_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_identity_setup_c(c_key_self, c_conf, c_obsvars, c_geovars) bind(c,name='ufo_identity_setup_f90')
38 use fckit_configuration_module, only: fckit_configuration
39 use oops_variables_mod
40 implicit none
41 integer(c_int), intent(inout) :: c_key_self
42 type(c_ptr), value, intent(in) :: c_conf
43 type(c_ptr), value, intent(in) :: c_obsvars ! variables to be simulated
44 type(c_ptr), value, intent(in) :: c_geovars ! variables requested from the model
45 
46 type(ufo_identity), pointer :: self
47 
48 call ufo_identity_registry%setup(c_key_self, self)
49 
50 self%obsvars = oops_variables(c_obsvars)
51 self%geovars = oops_variables(c_geovars)
52 call self%setup()
53 
54 end subroutine ufo_identity_setup_c
55 
56 ! ------------------------------------------------------------------------------
57 
58 subroutine ufo_identity_delete_c(c_key_self) bind(c,name='ufo_identity_delete_f90')
59 implicit none
60 integer(c_int), intent(inout) :: c_key_self
61 
62 type(ufo_identity), pointer :: self
63 
64 call ufo_identity_registry%get(c_key_self, self)
65 
66 call ufo_identity_registry%remove(c_key_self)
67 
68 end subroutine ufo_identity_delete_c
69 
70 ! ------------------------------------------------------------------------------
71 
72 subroutine ufo_identity_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, &
73  c_hofx) bind(c,name='ufo_identity_simobs_f90')
74 implicit none
75 integer(c_int), intent(in) :: c_key_self
76 integer(c_int), intent(in) :: c_key_geovals
77 type(c_ptr), value, intent(in) :: c_obsspace
78 integer(c_int), intent(in) :: c_nvars, c_nlocs
79 real(c_double), intent(inout) :: c_hofx(c_nvars, c_nlocs)
80 
81 type(ufo_identity), pointer :: self
82 type(ufo_geovals), pointer :: geovals
83 
84 call ufo_identity_registry%get(c_key_self, self)
85 call ufo_geovals_registry%get(c_key_geovals, geovals)
86 
87 call self%simobs(geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
88 
89 end subroutine ufo_identity_simobs_c
90 
91 ! ------------------------------------------------------------------------------
92 
93 end module ufo_identity_mod_c
ufo_identity_mod_c::ufo_identity_delete_c
subroutine ufo_identity_delete_c(c_key_self)
Definition: ObsIdentity.interface.F90:59
ufo_identity_mod
Definition: ufo_identity_mod.F90:8
ufo_geovals_mod
Definition: ufo_geovals_mod.F90:7
ufo_geovals_mod_c
Definition: GeoVaLs.interface.F90:7
ufo_identity_mod_c::ufo_identity_simobs_c
subroutine ufo_identity_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
Definition: ObsIdentity.interface.F90:74
ufo_identity_mod_c::ufo_identity_registry
type(registry_t) ufo_identity_registry
Linked list interface - defines registry_t type.
Definition: ObsIdentity.interface.F90:25
ufo_identity_mod_c::ufo_identity_setup_c
subroutine ufo_identity_setup_c(c_key_self, c_conf, c_obsvars, c_geovars)
Linked list implementation.
Definition: ObsIdentity.interface.F90:38
ufo_identity_mod_c
Fortran identity module for functions on the interface between C++ and Fortran.
Definition: ObsIdentity.interface.F90:9
ufo_identity_mod::ufo_identity
Definition: ufo_identity_mod.F90:15
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