UFO
ObsAtmVertInterp.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 module to handle atmvertinterp observations
7 
9 
10  use iso_c_binding
11  use fckit_configuration_module, only: fckit_configuration
13  use ufo_geovals_mod, only: ufo_geovals
15 
16  implicit none
17 
18  private
19 
20 #define LISTED_TYPE ufo_atmvertinterp
21 
22  !> Linked list interface - defines registry_t type
23 #include "oops/util/linkedList_i.f"
24 
25  !> Global registry
26  type(registry_t) :: ufo_atmvertinterp_registry
27 
28  ! ------------------------------------------------------------------------------
29 
30 contains
31  ! ------------------------------------------------------------------------------
32  !> Linked list implementation
33 #include "oops/util/linkedList_c.f"
34 
35 ! ------------------------------------------------------------------------------
36 
37 subroutine ufo_atmvertinterp_setup_c(c_key_self, c_conf, c_obsvars, c_obsvarindices, c_nobsvars, &
38  c_geovars) bind(c,name='ufo_atmvertinterp_setup_f90')
39 use oops_variables_mod
40 implicit none
41 integer(c_int), intent(inout) :: c_key_self
42 type(c_ptr), intent(in), value :: c_conf
43 type(c_ptr), intent(in), value :: c_obsvars ! variables to be simulated...
44 integer(c_int), intent(in), value :: c_nobsvars
45 integer(c_int), intent(in) :: c_obsvarindices(c_nobsvars) ! ... and their global indices
46 type(c_ptr), intent(in), value :: c_geovars ! variables requested from the model
47 
48 type(ufo_atmvertinterp), pointer :: self
49 type(fckit_configuration) :: f_conf
50 
51 call ufo_atmvertinterp_registry%setup(c_key_self, self)
52 f_conf = fckit_configuration(c_conf)
53 
54 self%obsvars = oops_variables(c_obsvars)
55 allocate(self%obsvarindices(self%obsvars%nvars()))
56 self%obsvarindices(:) = c_obsvarindices(:) + 1 ! Convert from C to Fortran indexing
57 self%geovars = oops_variables(c_geovars)
58 
59 call self%setup(f_conf)
60 
61 end subroutine ufo_atmvertinterp_setup_c
62 
63 ! ------------------------------------------------------------------------------
64 
65 subroutine ufo_atmvertinterp_delete_c(c_key_self) bind(c,name='ufo_atmvertinterp_delete_f90')
66 implicit none
67 integer(c_int), intent(inout) :: c_key_self
68 
69 type(ufo_atmvertinterp), pointer :: self
70 
71 call ufo_atmvertinterp_registry%delete(c_key_self, self)
72 
73 end subroutine ufo_atmvertinterp_delete_c
74 
75 ! ------------------------------------------------------------------------------
76 
77 subroutine ufo_atmvertinterp_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, &
78  c_hofx) bind(c,name='ufo_atmvertinterp_simobs_f90')
79 implicit none
80 integer(c_int), intent(in) :: c_key_self
81 integer(c_int), intent(in) :: c_key_geovals
82 type(c_ptr), value, intent(in) :: c_obsspace
83 integer(c_int), intent(in) :: c_nvars, c_nlocs
84 real(c_double), intent(inout) :: c_hofx(c_nvars, c_nlocs)
85 
86 type(ufo_atmvertinterp), pointer :: self
87 type(ufo_geovals), pointer :: geovals
88 character(len=*), parameter :: myname_="ufo_atmvertinterp_simobs_c"
89 
90 call ufo_atmvertinterp_registry%get(c_key_self, self)
91 call ufo_geovals_registry%get(c_key_geovals, geovals)
92 
93 call self%simobs(geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
94 
95 end subroutine ufo_atmvertinterp_simobs_c
96 
97 ! ------------------------------------------------------------------------------
98 
99 end module ufo_atmvertinterp_mod_c
Fortran module to handle atmvertinterp observations.
subroutine ufo_atmvertinterp_setup_c(c_key_self, c_conf, c_obsvars, c_obsvarindices, c_nobsvars, c_geovars)
Linked list implementation.
type(registry_t) ufo_atmvertinterp_registry
Linked list interface - defines registry_t type.
subroutine ufo_atmvertinterp_simobs_c(c_key_self, c_key_geovals, c_obsspace, c_nvars, c_nlocs, c_hofx)
subroutine ufo_atmvertinterp_delete_c(c_key_self)
type(registry_t), public ufo_geovals_registry
Linked list interface - defines registry_t type.
type to hold interpolated fields required by the obs operators