SOCA
soca_horizfilt.interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017-2021 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 !> C++ interface for soca_horizfilt_mod::soca_horizfilt
8 
9 use fckit_configuration_module, only: fckit_configuration
10 use iso_c_binding
11 use oops_variables_mod, only: oops_variables
12 
13 ! soca modules
15 use soca_geom_mod, only : soca_geom
19 use soca_state_mod, only: soca_state
21 
22 implicit none
23 private
24 
25 
26 #define LISTED_TYPE soca_horizfilt
27 
28 !> Linked list interface - defines registry_t type
29 #include "oops/util/linkedList_i.f"
30 
31 !> Global registry for soca_horizfilt_mod::soca_horizfilt
32 type(registry_t), public :: soca_horizfilt_registry
33 
34 ! ------------------------------------------------------------------------------
35 contains
36 ! ------------------------------------------------------------------------------
37 
38 !> Linked list implementation
39 #include "oops/util/linkedList_c.f"
40 ! ------------------------------------------------------------------------------
41 
42 
43 ! ------------------------------------------------------------------------------
44 !> C++ interface for soca_horizfilt_mod::soca_horizfilt::setup()
45 !!
46 !! Setup for the filtering operator
47 subroutine soca_horizfilt_setup_c(c_key_self, &
48  c_conf, &
49  c_key_geom, &
50  c_key_traj, &
51  c_vars) &
52  & bind(c,name='soca_horizfilt_setup_f90')
53  integer(c_int), intent(inout) :: c_key_self !< The filtering structure
54  type(c_ptr), intent(in) :: c_conf !< The configuration
55  integer(c_int), intent(in) :: c_key_geom !< Geometry
56  integer(c_int), intent(in) :: c_key_traj !< Trajectory
57  type(c_ptr),value, intent(in) :: c_vars !< List of variables
58 
59  type(soca_horizfilt), pointer :: self
60  type(soca_geom), pointer :: geom
61  type(soca_state), pointer :: traj
62  type(oops_variables) :: vars
63 
64  call soca_geom_registry%get(c_key_geom, geom)
65  call soca_state_registry%get(c_key_traj, traj)
66  call soca_horizfilt_registry%init()
67  call soca_horizfilt_registry%add(c_key_self)
68  call soca_horizfilt_registry%get(c_key_self, self)
69  vars = oops_variables(c_vars)
70  call self%setup(fckit_configuration(c_conf), geom, traj, vars)
71 
72 end subroutine soca_horizfilt_setup_c
73 
74 
75 ! ------------------------------------------------------------------------------
76 !> C++ interface for soca_horizfilt_mod::soca_horizfilt::delete()
77 !!
78 !! Delete filtering operator
79 subroutine soca_horizfilt_delete_c(c_key_self) bind (c,name='soca_horizfilt_delete_f90')
80  integer(c_int), intent(inout) :: c_key_self !< The filtering structure
81 
82  type(soca_horizfilt), pointer :: self
83 
84  call soca_horizfilt_registry%get(c_key_self,self)
85  call self%delete()
86  call soca_horizfilt_registry%remove(c_key_self)
87 
88 end subroutine soca_horizfilt_delete_c
89 
90 
91 ! ------------------------------------------------------------------------------
92 !> C++ interface for soca_horizfilt_mod::soca_horizfilt::mult()
93 !!
94 !! Multiply
95 subroutine soca_horizfilt_mult_c(c_key_self, c_key_in, c_key_out, c_key_geom) bind(c,name='soca_horizfilt_mult_f90')
96  integer(c_int), intent(inout) :: c_key_self !< The filtering structure
97  integer(c_int), intent(in) :: c_key_in !< " to Increment in
98  integer(c_int), intent(in) :: c_key_out !< " to Increment out
99  integer(c_int), intent(in) :: c_key_geom !< Geometry
100 
101  type(soca_horizfilt), pointer :: self
102  type(soca_increment), pointer :: xin
103  type(soca_increment), pointer :: xout
104  type(soca_geom), pointer :: geom
105 
106  call soca_geom_registry%get(c_key_geom, geom)
107  call soca_horizfilt_registry%get(c_key_self, self)
108  call soca_increment_registry%get(c_key_in, xin)
109  call soca_increment_registry%get(c_key_out, xout)
110 
111  call self%mult(xin, xout, geom) !< xout = C.xout
112 
113 end subroutine soca_horizfilt_mult_c
114 
115 
116 ! ------------------------------------------------------------------------------
117 !> C++ interface for soca_horizfilt_mod::soca_horizfilt::multad()
118 !!
119 !! Multiply adjoint
120 subroutine soca_horizfilt_mult_ad_c(c_key_self, c_key_in, c_key_out, c_key_geom) &
121  bind(c,name='soca_horizfilt_multad_f90')
122  integer(c_int), intent(inout) :: c_key_self !< The filtering structure
123  integer(c_int), intent(in) :: c_key_in !< " to Increment in
124  integer(c_int), intent(in) :: c_key_out !< " to Increment out
125  integer(c_int), intent(in) :: c_key_geom !< Geometry
126 
127  type(soca_horizfilt), pointer :: self
128  type(soca_increment), pointer :: xin
129  type(soca_increment), pointer :: xout
130  type(soca_geom), pointer :: geom
131 
132  call soca_geom_registry%get(c_key_geom, geom)
133  call soca_horizfilt_registry%get(c_key_self, self)
134  call soca_increment_registry%get(c_key_in, xin)
135  call soca_increment_registry%get(c_key_out, xout)
136 
137  call self%multad(xin, xout, geom) !< xout = C^T.xout
138 
139 end subroutine soca_horizfilt_mult_ad_c
140 
141 end module soca_horizfilt_mod_c
C++ interfaces for soca_geom_mod::soca_geom.
type(registry_t), public soca_geom_registry
Linked list interface - defines registry_t type.
Geometry module.
C++ interface for soca_horizfilt_mod::soca_horizfilt.
subroutine soca_horizfilt_delete_c(c_key_self)
C++ interface for soca_horizfilt_mod::soca_horizfilt::delete()
subroutine soca_horizfilt_setup_c(c_key_self, c_conf, c_key_geom, c_key_traj, c_vars)
Linked list implementation.
subroutine soca_horizfilt_mult_ad_c(c_key_self, c_key_in, c_key_out, c_key_geom)
C++ interface for soca_horizfilt_mod::soca_horizfilt::multad()
type(registry_t), public soca_horizfilt_registry
Linked list interface - defines registry_t type.
subroutine soca_horizfilt_mult_c(c_key_self, c_key_in, c_key_out, c_key_geom)
C++ interface for soca_horizfilt_mod::soca_horizfilt::mult()
horizontal filtering
Increment fields.
registry for soca_increment_mod::soca_increment instances for use in Fortran/C++ interface of soca_in...
type(registry_t), public soca_increment_registry
Linked list interface - defines registry_t type.
State fields.
registry for soca_state_mod::soca_state instances for use in Fortran/C++ interfaces of soca_state_mod...
type(registry_t), public soca_state_registry
Linked list interface - defines registry_t type.
Geometry data structure.
Variable transform: horizontal filtering.