| 1 |
! (C) Copyright 2013 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 |
|
| 9 |
#include "atlas/atlas_f.h" |
| 10 |
|
| 11 |
module atlas_Domain_module |
| 12 |
|
| 13 |
use, intrinsic :: iso_c_binding, only : c_double |
| 14 |
use fckit_owned_object_module, only : fckit_owned_object |
| 15 |
use atlas_config_module, only : atlas_Config |
| 16 |
|
| 17 |
implicit none |
| 18 |
|
| 19 |
private :: fckit_owned_object |
| 20 |
private :: atlas_Config |
| 21 |
|
| 22 |
public :: atlas_Domain |
| 23 |
public :: atlas_LonLatRectangularDomain |
| 24 |
|
| 25 |
private |
| 26 |
|
| 27 |
!------------------------------------------------------------------------------ |
| 28 |
TYPE, extends(fckit_owned_object) :: atlas_Domain |
| 29 |
|
| 30 |
! Purpose : |
| 31 |
! ------- |
| 32 |
! *atlas_Domain* : |
| 33 |
|
| 34 |
!------------------------------------------------------------------------------ |
| 35 |
contains |
| 36 |
procedure, public :: type => atlas_Domain__type |
| 37 |
procedure, public :: hash |
| 38 |
procedure, public :: spec |
| 39 |
|
| 40 |
#if FCKIT_FINAL_NOT_INHERITING |
| 41 |
final :: atlas_Domain__final_auto |
| 42 |
#endif |
| 43 |
|
| 44 |
END TYPE atlas_Domain |
| 45 |
|
| 46 |
interface atlas_Domain |
| 47 |
module procedure atlas_Domain__ctor_cptr |
| 48 |
module procedure atlas_Domain__ctor_config |
| 49 |
end interface |
| 50 |
|
| 51 |
!------------------------------------------------------------------------------ |
| 52 |
TYPE, extends(atlas_Domain) :: atlas_LonLatRectangularDomain |
| 53 |
|
| 54 |
! Purpose : |
| 55 |
! ------- |
| 56 |
! *atlas_LonLatRectangularDomain* : |
| 57 |
|
| 58 |
!------------------------------------------------------------------------------ |
| 59 |
contains |
| 60 |
procedure, public :: north |
| 61 |
procedure, public :: west |
| 62 |
procedure, public :: south |
| 63 |
procedure, public :: east |
| 64 |
#if FCKIT_FINAL_NOT_INHERITING |
| 65 |
final :: atlas_LonLatRectangularDomain__final_auto |
| 66 |
#endif |
| 67 |
|
| 68 |
END TYPE atlas_LonLatRectangularDomain |
| 69 |
|
| 70 |
interface atlas_LonLatRectangularDomain |
| 71 |
module procedure atlas_LonLatRectangularDomain__ctor_cptr |
| 72 |
end interface |
| 73 |
!------------------------------------------------------------------------------ |
| 74 |
|
| 75 |
|
| 76 |
!======================================================== |
| 77 |
contains |
| 78 |
!======================================================== |
| 79 |
|
| 80 |
function atlas_Domain__ctor_cptr(cptr) result(this) |
| 81 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 82 |
type(atlas_Domain) :: this |
| 83 |
type(c_ptr), intent(in) :: cptr |
| 84 |
call this%reset_c_ptr( cptr ) |
| 85 |
call this%return() |
| 86 |
end function |
| 87 |
|
| 88 |
function atlas_Domain__ctor_config(config) result(this) |
| 89 |
use atlas_Domain_c_binding |
| 90 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 91 |
type(atlas_Domain) :: this |
| 92 |
type(atlas_Config) :: config |
| 93 |
call this%reset_c_ptr( atlas__Domain__ctor_config(config%CPTR_PGIBUG_B) ) |
| 94 |
call this%return() |
| 95 |
end function |
| 96 |
|
| 97 |
function atlas_Domain__type(this) result(type_) |
| 98 |
use atlas_Domain_c_binding |
| 99 |
use fckit_c_interop_module, only : c_ptr_to_string, c_ptr_free |
| 100 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 101 |
class(atlas_Domain), intent(in) :: this |
| 102 |
character(len=:), allocatable :: type_ |
| 103 |
type(c_ptr) :: type_c_str |
| 104 |
integer :: size |
| 105 |
call atlas__Domain__type(this%CPTR_PGIBUG_A, type_c_str, size ) |
| 106 |
type_ = c_ptr_to_string(type_c_str) |
| 107 |
call c_ptr_free(type_c_str) |
| 108 |
end function |
| 109 |
|
| 110 |
function hash(this) |
| 111 |
use atlas_Domain_c_binding |
| 112 |
use fckit_c_interop_module, only : c_ptr_to_string, c_ptr_free |
| 113 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 114 |
class(atlas_Domain), intent(in) :: this |
| 115 |
character(len=:), allocatable :: hash |
| 116 |
type(c_ptr) :: hash_c_str |
| 117 |
integer :: size |
| 118 |
call atlas__Domain__hash(this%CPTR_PGIBUG_A, hash_c_str, size ) |
| 119 |
hash = c_ptr_to_string(hash_c_str) |
| 120 |
call c_ptr_free(hash_c_str) |
| 121 |
end function |
| 122 |
|
| 123 |
function spec(this) |
| 124 |
use atlas_Domain_c_binding |
| 125 |
class(atlas_Domain), intent(in) :: this |
| 126 |
type(atlas_Config) :: spec |
| 127 |
spec = atlas_Config( atlas__Domain__spec(this%CPTR_PGIBUG_A) ) |
| 128 |
call spec%return() |
| 129 |
end function |
| 130 |
|
| 131 |
|
| 132 |
!------------------------------------------------------------------------------ |
| 133 |
|
| 134 |
function atlas_LonLatRectangularDomain__ctor_cptr(cptr) result(this) |
| 135 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 136 |
type(atlas_LonLatRectangularDomain) :: this |
| 137 |
type(c_ptr), intent(in) :: cptr |
| 138 |
call this%reset_c_ptr( cptr ) |
| 139 |
call this%return() |
| 140 |
end function |
| 141 |
|
| 142 |
function north(this) result(value) |
| 143 |
use atlas_Domain_c_binding |
| 144 |
class(atlas_LonLatRectangularDomain), intent(in) :: this |
| 145 |
real(c_double) :: value |
| 146 |
value = atlas__LonLatRectangularDomain__north(this%CPTR_PGIBUG_A) |
| 147 |
end function |
| 148 |
|
| 149 |
function west(this) result(value) |
| 150 |
use atlas_Domain_c_binding |
| 151 |
class(atlas_LonLatRectangularDomain), intent(in) :: this |
| 152 |
real(c_double) :: value |
| 153 |
value = atlas__LonLatRectangularDomain__west(this%CPTR_PGIBUG_A) |
| 154 |
end function |
| 155 |
|
| 156 |
function south(this) result(value) |
| 157 |
use atlas_Domain_c_binding |
| 158 |
class(atlas_LonLatRectangularDomain), intent(in) :: this |
| 159 |
real(c_double) :: value |
| 160 |
value = atlas__LonLatRectangularDomain__south(this%CPTR_PGIBUG_A) |
| 161 |
end function |
| 162 |
|
| 163 |
function east(this) result(value) |
| 164 |
use atlas_Domain_c_binding |
| 165 |
class(atlas_LonLatRectangularDomain), intent(in) :: this |
| 166 |
real(c_double) :: value |
| 167 |
value = atlas__LonLatRectangularDomain__east(this%CPTR_PGIBUG_A) |
| 168 |
end function |
| 169 |
|
| 170 |
!------------------------------------------------------------------------------ |
| 171 |
|
| 172 |
|
| 173 |
#if FCKIT_FINAL_NOT_INHERITING |
| 174 |
ATLAS_FINAL subroutine atlas_Domain__final_auto(this) |
| 175 |
type(atlas_Domain), intent(inout) :: this |
| 176 |
#if FCKIT_FINAL_DEBUGGING |
| 177 |
write(0,*) "atlas_Domain__final_auto" |
| 178 |
#endif |
| 179 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 180 |
call this%final() |
| 181 |
#endif |
| 182 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 183 |
end subroutine |
| 184 |
|
| 185 |
ATLAS_FINAL subroutine atlas_LonLatRectangularDomain__final_auto(this) |
| 186 |
type(atlas_LonLatRectangularDomain), intent(inout) :: this |
| 187 |
#if FCKIT_FINAL_DEBUGGING |
| 188 |
write(0,*) "atlas_LonLatRectangularDomain__final_auto" |
| 189 |
#endif |
| 190 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 191 |
call this%final() |
| 192 |
#endif |
| 193 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 194 |
end subroutine |
| 195 |
#endif |
| 196 |
|
| 197 |
|
| 198 |
end module atlas_Domain_module |
| 199 |
|