OOPS
qg_geom_iter_interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2009-2016 ECMWF.
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 ! In applying this licence, ECMWF does not waive the privileges and immunities
6 ! granted to it by virtue of its status as an intergovernmental organisation nor
7 ! does it submit to any jurisdiction.
8 
10 
11 use iso_c_binding
12 use kinds
14 use qg_geom_mod
15 
16 implicit none
17 
18 private
19 ! ------------------------------------------------------------------------------
20 contains
21 ! ------------------------------------------------------------------------------
22 !> Setup geometry iterator
23 subroutine qg_geom_iter_setup_c(c_key_self,c_key_geom,c_index) bind(c,name='qg_geom_iter_setup_f90')
24 
25 ! Passed variables
26 integer(c_int),intent(inout) :: c_key_self !< Geometry iterator
27 integer(c_int),intent(in) :: c_key_geom !< Geometry
28 integer(c_int),intent(in) :: c_index !< Index
29 
30 ! Local variables
31 type(qg_geom_iter),pointer :: self
32 type(qg_geom),pointer :: geom
33 
34 ! Interface
35 call qg_geom_iter_registry%init()
36 call qg_geom_iter_registry%add(c_key_self)
37 call qg_geom_iter_registry%get(c_key_self,self)
38 call qg_geom_registry%get(c_key_geom,geom)
39 
40 ! Call Fortran
41 call qg_geom_iter_setup(self,geom,c_index)
42 
43 end subroutine qg_geom_iter_setup_c
44 ! ------------------------------------------------------------------------------
45 !> Clone geometry iterator
46 subroutine qg_geom_iter_clone_c(c_key_self,c_key_other) bind(c,name='qg_geom_iter_clone_f90')
47 
48 ! Passed variables
49 integer(c_int),intent(inout) :: c_key_self !< Geometry iterator
50 integer(c_int),intent(in) :: c_key_other !< Other geometry iterator
51 
52 ! Local variables
53 type(qg_geom_iter),pointer :: self,other
54 
55 ! Interface
56 call qg_geom_iter_registry%get(c_key_other,other)
57 call qg_geom_iter_registry%init()
58 call qg_geom_iter_registry%add(c_key_self)
59 call qg_geom_iter_registry%get(c_key_self,self)
60 
61 ! Call Fortran
62 call qg_geom_iter_clone(self,other)
63 
64 end subroutine qg_geom_iter_clone_c
65 ! ------------------------------------------------------------------------------
66 !> Delete geometry iterator
67 subroutine qg_geom_iter_delete_c(c_key_self) bind(c,name='qg_geom_iter_delete_f90')
68 
69 ! Passed variables
70 integer(c_int),intent(inout) :: c_key_self !< Geometry iterator
71 
72 ! Clear interface
73 call qg_geom_iter_registry%remove(c_key_self)
74 
75 end subroutine qg_geom_iter_delete_c
76 ! ------------------------------------------------------------------------------
77 !> Check geometry iterator equality
78 subroutine qg_geom_iter_equals_c(c_key_self,c_key_other,c_equals) bind(c,name='qg_geom_iter_equals_f90')
79 
80 ! Passed variables
81 integer(c_int),intent(inout) :: c_key_self !< Geometry iterator
82 integer(c_int),intent(in) :: c_key_other !< Other geometry iterator
83 integer(c_int),intent(inout) :: c_equals !< Equality flag
84 
85 ! Local variables
86 type(qg_geom_iter),pointer :: self,other
87 
88 ! Interface
89 call qg_geom_iter_registry%get(c_key_self,self)
90 call qg_geom_iter_registry%get(c_key_other,other)
91 
92 ! Call Fortran
93 call qg_geom_iter_equals(self,other,c_equals)
94 
95 end subroutine qg_geom_iter_equals_c
96 ! ------------------------------------------------------------------------------
97 !> Get geometry iterator current lat/lon
98 subroutine qg_geom_iter_current_c(c_key_self,c_lat,c_lon) bind(c,name='qg_geom_iter_current_f90')
99 
100 ! Passed variables
101 integer(c_int),intent(in) :: c_key_self !< Geometry iterator
102 real(c_double),intent(inout) :: c_lat !< Latitude
103 real(c_double),intent(inout) :: c_lon !< Longitude
104 
105 ! Local variables
106 type(qg_geom_iter),pointer :: self
107 
108 ! Interface
109 call qg_geom_iter_registry%get(c_key_self,self)
110 
111 ! Call Fortran
112 call qg_geom_iter_current(self,c_lon,c_lat)
113 
114 end subroutine qg_geom_iter_current_c
115 ! ------------------------------------------------------------------------------
116 !> Update geometry iterator to next point
117 subroutine qg_geom_iter_next_c(c_key_self) bind(c,name='qg_geom_iter_next_f90')
118 
119 ! Passed variables
120 integer(c_int),intent(in) :: c_key_self !< Geometry iterator
121 
122 ! Local variables
123 type(qg_geom_iter),pointer :: self
124 
125 ! Interface
126 call qg_geom_iter_registry%get(c_key_self,self)
127 
128 ! Call Fortran
129 call qg_geom_iter_next(self)
130 
131 end subroutine qg_geom_iter_next_c
132 ! ------------------------------------------------------------------------------
133 end module qg_geom_iter_interface
subroutine qg_geom_iter_clone_c(c_key_self, c_key_other)
Clone geometry iterator.
subroutine qg_geom_iter_current_c(c_key_self, c_lat, c_lon)
Get geometry iterator current lat/lon.
subroutine qg_geom_iter_setup_c(c_key_self, c_key_geom, c_index)
Setup geometry iterator.
subroutine qg_geom_iter_equals_c(c_key_self, c_key_other, c_equals)
Check geometry iterator equality.
subroutine qg_geom_iter_next_c(c_key_self)
Update geometry iterator to next point.
subroutine qg_geom_iter_delete_c(c_key_self)
Delete geometry iterator.
subroutine, public qg_geom_iter_setup(self, geom, ind)
Linked list implementation.
subroutine, public qg_geom_iter_clone(self, other)
Clone for the QG model's geometry iterator.
subroutine, public qg_geom_iter_equals(self, other, equals)
Check for the QG model's geometry iterator equality.
subroutine, public qg_geom_iter_next(self)
Update geometry iterator to next point.
subroutine, public qg_geom_iter_current(self, lat, lon)
Get geometry iterator current lat/lon.
type(registry_t), public qg_geom_iter_registry
Linked list interface - defines registry_t type.
type(registry_t), public qg_geom_registry
Linked list interface - defines registry_t type.
Definition: qg_geom_mod.F90:53