SOCA
soca_bkgerrgodas.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_bkgerrgodas_mod::soca_bkgerrgodas
8 
9 use iso_c_binding
10 use fckit_configuration_module, only: fckit_configuration
11 
12 ! soca modules
14 use soca_geom_mod, only: soca_geom
18 use soca_state_mod, only: soca_state
20 
21 implicit none
22 private
23 
24 #define LISTED_TYPE soca_bkgerrgodas
25 
26 !> Linked list interface - defines registry_t type
27 #include "oops/util/linkedList_i.f"
28 
29 !> Global registry for soca_bkgerrgodas
30 type(registry_t), public :: soca_bkgerrgodas_registry
31 
32 
33 ! ------------------------------------------------------------------------------
34 contains
35 ! ------------------------------------------------------------------------------
36 
37 
38 !> Linked list implementation
39 #include "oops/util/linkedList_c.f"
40 
41 ! ------------------------------------------------------------------------------
42 !> C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas::setup()
43 !!
44 !! Constructor for D (standard deviation of background error)
45 subroutine soca_bkgerrgodas_setup_c(c_key_self, c_conf, c_key_bkg, c_key_geom) &
46  bind(c,name='soca_bkgerrgodas_setup_f90')
47 
48  integer(c_int), intent(inout) :: c_key_self !< The D structure
49  type(c_ptr), intent(in) :: c_conf !< The configuration
50  integer(c_int), intent(in) :: c_key_bkg !< Background field
51  integer(c_int), intent(in) :: c_key_geom !< Geometry
52 
53  type(soca_state), pointer :: bkg
54  type(soca_geom), pointer :: geom
55  type(soca_bkgerrgodas), pointer :: self
56 
57  call soca_bkgerrgodas_registry%init()
58  call soca_bkgerrgodas_registry%add(c_key_self)
59  call soca_bkgerrgodas_registry%get(c_key_self, self)
60  call soca_state_registry%get(c_key_bkg, bkg)
61  call soca_geom_registry%get(c_key_geom, geom)
62 
63  call self%setup(fckit_configuration(c_conf), bkg, geom)
64 
65 end subroutine soca_bkgerrgodas_setup_c
66 
67 
68 ! ------------------------------------------------------------------------------
69 !> C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas destructor
70 subroutine soca_bkgerrgodas_delete_c(c_key_self) &
71  bind(c,name='soca_bkgerrgodas_delete_f90')
72 
73  integer(c_int), intent(inout) :: c_key_self
74  type(soca_bkgerrgodas), pointer :: self
75 
76  call soca_bkgerrgodas_registry%get(c_key_self, self)
77  if (associated(self%bkg)) nullify(self%bkg)
78  call self%std_bkgerr%delete()
79 
80  call soca_bkgerrgodas_registry%remove(c_key_self)
81 
82 end subroutine soca_bkgerrgodas_delete_c
83 
84 
85 ! ------------------------------------------------------------------------------
86 !> C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas::mult()
87 !!
88 !! Multiplication forward and adjoint
89 subroutine soca_bkgerrgodas_mult_c(c_key_self, c_key_a, c_key_m)&
90  bind(c,name='soca_bkgerrgodas_mult_f90')
91 
92  integer(c_int), intent(in) :: c_key_a !< " to Increment in
93  integer(c_int), intent(in) :: c_key_m !< " to Increment out
94  integer(c_int), intent(in) :: c_key_self
95 
96  type(soca_increment), pointer :: dxa
97  type(soca_increment), pointer :: dxm
98  type(soca_bkgerrgodas), pointer :: self
99 
100  call soca_increment_registry%get(c_key_a,dxa)
101  call soca_increment_registry%get(c_key_m,dxm)
102  call soca_bkgerrgodas_registry%get(c_key_self,self)
103 
104  !< Computes dxm = D dxa
105  call dxm%copy(dxa)
106  call self%mult(dxa, dxm)
107 
108 end subroutine soca_bkgerrgodas_mult_c
109 
110 end module soca_bkgerrgodas_mod_c
C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas.
subroutine soca_bkgerrgodas_mult_c(c_key_self, c_key_a, c_key_m)
C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas::mult()
subroutine soca_bkgerrgodas_delete_c(c_key_self)
C++ interface for soca_bkgerrgodas_mod::soca_bkgerrgodas destructor.
type(registry_t), public soca_bkgerrgodas_registry
Linked list interface - defines registry_t type.
subroutine soca_bkgerrgodas_setup_c(c_key_self, c_conf, c_key_bkg, c_key_geom)
Linked list implementation.
variable transform: background error
C++ interfaces for soca_geom_mod::soca_geom.
type(registry_t), public soca_geom_registry
Linked list interface - defines registry_t type.
Geometry module.
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.
Variable transform for background error (D), GODAS version.
Geometry data structure.