FV3 Bundle
fv3jedi_geom_interface_mod.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 handling geometry for the FV3 model
7 
9 
11 use iso_c_binding
13 
14 implicit none
15 private
16 
17 public :: fv3jedi_geom_registry
18 
19 ! ------------------------------------------------------------------------------
20 
21 #define LISTED_TYPE fv3jedi_geom
22 
23 !> Linked list interface - defines registry_t type
24 #include "linkedList_i.f"
25 
26 !> Global registry
27 type(registry_t) :: fv3jedi_geom_registry
28 
29 ! ------------------------------------------------------------------------------
30 
31 contains
32 
33 ! ------------------------------------------------------------------------------
34 !> Linked list implementation
35 #include "linkedList_c.f"
36 
37 ! ------------------------------------------------------------------------------
38 
39 subroutine c_fv3jedi_geo_setup(c_key_self, c_conf) bind(c,name='fv3jedi_geo_setup_f90')
40 
41 implicit none
42 
43 !Arguments
44 integer(c_int), intent(inout) :: c_key_self
45 type(c_ptr), intent(in) :: c_conf
46 
47 type(fv3jedi_geom), pointer :: self
48 
49 ! Init, add and get key
50 ! ---------------------
51 call fv3jedi_geom_registry%init()
52 call fv3jedi_geom_registry%add(c_key_self)
53 call fv3jedi_geom_registry%get(c_key_self,self)
54 
55 call create(self,c_conf)
56 
57 end subroutine c_fv3jedi_geo_setup
58 
59 ! ------------------------------------------------------------------------------
60 
61 subroutine c_fv3jedi_geo_clone(c_key_self, c_key_other) bind(c,name='fv3jedi_geo_clone_f90')
62 
63 implicit none
64 
65 integer(c_int), intent(in ) :: c_key_self
66 integer(c_int), intent(inout) :: c_key_other
67 
68 type(fv3jedi_geom), pointer :: self, other
69 
70 !add, get, get key
71 call fv3jedi_geom_registry%add(c_key_other)
72 call fv3jedi_geom_registry%get(c_key_other, other)
73 call fv3jedi_geom_registry%get(c_key_self, self)
74 
75 call clone(self, other)
76 
77 end subroutine c_fv3jedi_geo_clone
78 
79 ! ------------------------------------------------------------------------------
80 
81 subroutine c_fv3jedi_geo_delete(c_key_self) bind(c,name='fv3jedi_geo_delete_f90')
82 
83 implicit none
84 
85 integer(c_int), intent(inout) :: c_key_self
86 type(fv3jedi_geom), pointer :: self
87 
88 ! Get key
89 call fv3jedi_geom_registry%get(c_key_self, self)
90 
91 call delete(self)
92 
93 ! Remove key
94 call fv3jedi_geom_registry%remove(c_key_self)
95 
96 end subroutine c_fv3jedi_geo_delete
97 
98 ! ------------------------------------------------------------------------------
99 
100 subroutine c_fv3jedi_geo_info(c_key_self) bind(c,name='fv3jedi_geo_info_f90')
102 implicit none
103 
104 integer(c_int), intent(in ) :: c_key_self
105 type(fv3jedi_geom), pointer :: self
106 
107 call fv3jedi_geom_registry%get(c_key_self, self)
108 
109 call info(self)
110 
111 end subroutine c_fv3jedi_geo_info
112 
113 ! ------------------------------------------------------------------------------
114 
type(registry_t), public fv3jedi_geom_registry
Linked list interface - defines registry_t type.
subroutine, public delete(self)
subroutine, public create(self, c_conf)
subroutine, public info(self)
Fortran module handling geometry for the FV3 model.
subroutine c_fv3jedi_geo_setup(c_key_self, c_conf)
Linked list implementation.
subroutine c_fv3jedi_geo_delete(c_key_self)
subroutine, public clone(self, other)
Fortran module handling geometry for the FV3 model.
subroutine c_fv3jedi_geo_clone(c_key_self, c_key_other)