FV3 Bundle
Locations.interface.F90
Go to the documentation of this file.
1 !
2 ! (C) Copyright 2017 UCAR
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 iso_c_binding
11 use ioda_locs_mod
12 use kinds
13 
14 implicit none
15 
16 public :: ioda_locs_registry
17 
18 private
19 
20 ! ------------------------------------------------------------------------------
21 
22 #define LISTED_TYPE ioda_locs
23 
24 !> Linked list interface - defines registry_t type
25 #include "linkedList_i.f"
26 
27 !> Global registry
28 type(registry_t) :: ioda_locs_registry
29 
30 ! ------------------------------------------------------------------------------
31 contains
32 ! ------------------------------------------------------------------------------
33 !> Linked list implementation
34 #include "linkedList_c.f"
35 
36 ! ------------------------------------------------------------------------------
37 
38 subroutine ioda_locs_create_c(key, klocs, klats, klons, rdist) bind(c,name='ioda_locs_create_f90')
39 
40 implicit none
41 integer(c_int), intent(inout) :: key
42 integer(c_int), intent(in) :: klocs
43 real(c_double), intent(in) :: klats(klocs)
44 real(c_double), intent(in) :: klons(klocs)
45 integer(c_int), intent(in) :: rdist
46 
47 type(ioda_locs), pointer :: self
48 real(kind_real) :: lats(klocs)
49 real(kind_real) :: lons(klocs)
50 
51 call ioda_locs_registry%init()
52 call ioda_locs_registry%add(key)
53 call ioda_locs_registry%get(key, self)
54 
55 lats(:) = klats(:)
56 lons(:) = klons(:)
57 
58 call ioda_locs_create(self, klocs, lats, lons, rdist)
59 
60 end subroutine ioda_locs_create_c
61 
62 ! ------------------------------------------------------------------------------
63 
64 subroutine ioda_locs_delete_c(key) bind(c,name='ioda_locs_delete_f90')
65 
66 implicit none
67 integer(c_int), intent(inout) :: key
68 type(ioda_locs), pointer :: self
69 
70 call ioda_locs_registry%get(key,self)
71 call ioda_locs_delete(self)
72 call ioda_locs_registry%remove(key)
73 
74 end subroutine ioda_locs_delete_c
75 
76 ! ------------------------------------------------------------------------------
77 
78 subroutine ioda_locs_nobs_c(key, kobs) bind(c,name='ioda_locs_nobs_f90')
79 
80 implicit none
81 integer(c_int), intent(in) :: key
82 integer(c_int), intent(inout) :: kobs
83 type(ioda_locs), pointer :: self
84 
85 call ioda_locs_registry%get(key,self)
86 kobs = self%nlocs
87 
88 end subroutine ioda_locs_nobs_c
89 ! ------------------------------------------------------------------------------
90 
91 subroutine ioda_locs_coords_c(key,idx,mylat,mylon) bind(c,name='ioda_locs_coords_f90')
92 
93 implicit none
94 integer(c_int), intent(in) :: key
95 integer(c_int), intent(in) :: idx
96 real(c_double), intent(inout) :: mylat,mylon
97 
98 type(ioda_locs), pointer :: self
99 
100 call ioda_locs_registry%get(key,self)
101 mylat = self%lat(idx+1)
102 mylon = self%lon(idx+1)
103 
104 end subroutine ioda_locs_coords_c
105 
106 ! ------------------------------------------------------------------------------
107 
108 end module ioda_locs_mod_c
subroutine ioda_locs_nobs_c(key, kobs)
subroutine ioda_locs_delete_c(key)
subroutine ioda_locs_coords_c(key, idx, mylat, mylon)
type(registry_t), public ioda_locs_registry
Linked list interface - defines registry_t type.
subroutine, public ioda_locs_create(self, nlocs, lats, lons, rdist)
subroutine, public ioda_locs_delete(self)
Fortran module handling observation locations.
subroutine ioda_locs_create_c(key, klocs, klats, klons, rdist)
Linked list implementation.