| 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_Grid_module |
| 12 |
|
| 13 |
use fckit_owned_object_module, only: fckit_owned_object |
| 14 |
use atlas_Config_module, only: atlas_Config |
| 15 |
use atlas_Projection_module, only : atlas_Projection |
| 16 |
use atlas_Domain_module, only : atlas_LonLatRectangularDomain |
| 17 |
use atlas_kinds_module, only : ATLAS_KIND_IDX, ATLAS_KIND_GIDX |
| 18 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 19 |
|
| 20 |
implicit none |
| 21 |
|
| 22 |
private :: fckit_owned_object |
| 23 |
private :: atlas_Config |
| 24 |
private :: atlas_Projection |
| 25 |
private :: c_ptr |
| 26 |
|
| 27 |
public :: atlas_Grid |
| 28 |
public :: atlas_UnstructuredGrid |
| 29 |
public :: atlas_StructuredGrid |
| 30 |
public :: atlas_GaussianGrid |
| 31 |
public :: atlas_ReducedGaussianGrid |
| 32 |
public :: atlas_RegularGaussianGrid |
| 33 |
public :: atlas_RegularLonLatGrid |
| 34 |
public :: atlas_ShiftedLonLatGrid |
| 35 |
public :: atlas_ShiftedLonGrid |
| 36 |
public :: atlas_ShiftedLatGrid |
| 37 |
public :: atlas_RegionalGrid |
| 38 |
|
| 39 |
private |
| 40 |
|
| 41 |
!------------------------------------------------------------------------------ |
| 42 |
TYPE, extends(fckit_owned_object) :: atlas_Grid |
| 43 |
|
| 44 |
! Purpose : |
| 45 |
! ------- |
| 46 |
! *atlas_Grid* : Object Grid specifications for Grids |
| 47 |
|
| 48 |
! Methods : |
| 49 |
! ------- |
| 50 |
|
| 51 |
! Author : |
| 52 |
! ------ |
| 53 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 54 |
|
| 55 |
!------------------------------------------------------------------------------ |
| 56 |
contains |
| 57 |
procedure :: name => atlas_Grid__name |
| 58 |
procedure :: size => atlas_Grid__size |
| 59 |
procedure :: spec => atlas_Grid__spec |
| 60 |
procedure :: uid |
| 61 |
procedure :: lonlat_bounding_box |
| 62 |
|
| 63 |
#if FCKIT_FINAL_NOT_INHERITING |
| 64 |
final :: atlas_Grid__final_auto |
| 65 |
#endif |
| 66 |
|
| 67 |
END TYPE atlas_Grid |
| 68 |
|
| 69 |
interface atlas_Grid |
| 70 |
module procedure atlas_Grid__ctor_id |
| 71 |
module procedure atlas_Grid__ctor_config |
| 72 |
module procedure atlas_Grid__ctor_cptr |
| 73 |
end interface |
| 74 |
|
| 75 |
!------------------------------------------------------------------------------ |
| 76 |
|
| 77 |
TYPE, extends(atlas_Grid) :: atlas_UnstructuredGrid |
| 78 |
|
| 79 |
! Purpose : |
| 80 |
! ------- |
| 81 |
! *atlas_UnstructuredGrid* : Object Grid specifications for Reduced Grids |
| 82 |
|
| 83 |
! Methods : |
| 84 |
! ------- |
| 85 |
|
| 86 |
! Author : |
| 87 |
! ------ |
| 88 |
! 8-Jun-2019 Willem Deconinck *ECMWF* |
| 89 |
|
| 90 |
!------------------------------------------------------------------------------ |
| 91 |
contains |
| 92 |
#if FCKIT_FINAL_NOT_INHERITING |
| 93 |
final :: atlas_UnstructuredGrid__final_auto |
| 94 |
#endif |
| 95 |
END TYPE atlas_UnstructuredGrid |
| 96 |
|
| 97 |
interface atlas_UnstructuredGrid |
| 98 |
module procedure atlas_UnstructuredGrid__ctor_points |
| 99 |
module procedure atlas_UnstructuredGrid__ctor_config |
| 100 |
module procedure atlas_UnstructuredGrid__ctor_cptr |
| 101 |
end interface |
| 102 |
|
| 103 |
!------------------------------------------------------------------------------ |
| 104 |
|
| 105 |
TYPE, extends(atlas_Grid) :: atlas_StructuredGrid |
| 106 |
|
| 107 |
! Purpose : |
| 108 |
! ------- |
| 109 |
! *atlas_StructuredGrid* : Object Grid specifications for Reduced Grids |
| 110 |
|
| 111 |
! Methods : |
| 112 |
! ------- |
| 113 |
|
| 114 |
! Author : |
| 115 |
! ------ |
| 116 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 117 |
|
| 118 |
!------------------------------------------------------------------------------ |
| 119 |
contains |
| 120 |
procedure :: ny => Structured__ny |
| 121 |
procedure, private :: nx_int32 => Structured__nx_int32 |
| 122 |
procedure, private :: nx_int64 => Structured__nx_int64 |
| 123 |
generic :: nx => nx_int32, nx_int64 |
| 124 |
procedure, private :: Structured__index_int32 |
| 125 |
procedure, private :: Structured__index_int64 |
| 126 |
generic :: index => Structured__index_int32, Structured__index_int64 |
| 127 |
procedure, private :: Structured__index2ij_int32 |
| 128 |
procedure, private :: Structured__index2ij_int64 |
| 129 |
generic :: index2ij => Structured__index2ij_int32, Structured__index2ij_int64 |
| 130 |
procedure, private :: Structured__ij_int32 |
| 131 |
procedure, private :: Structured__ij_int64 |
| 132 |
generic :: ij => Structured__ij_int32, Structured__ij_int64 |
| 133 |
procedure :: nx_array => Structured__nx_array |
| 134 |
procedure :: nxmin => Structured__nxmin |
| 135 |
procedure :: nxmax => Structured__nxmax |
| 136 |
procedure :: y_array => Structured__y_array |
| 137 |
procedure, private :: x_32 => Structured__x_32 |
| 138 |
procedure, private :: x_64 => Structured__x_64 |
| 139 |
generic :: x => x_32, x_64 |
| 140 |
procedure, private :: y_32 => Structured__y_32 |
| 141 |
procedure, private :: y_64 => Structured__y_64 |
| 142 |
generic :: y => y_32, y_64 |
| 143 |
procedure, private :: xy_32 => Structured__xy_32 |
| 144 |
procedure, private :: xy_64 => Structured__xy_64 |
| 145 |
generic :: xy => xy_32, xy_64 |
| 146 |
procedure, private :: lonlat_32 => Structured__lonlat_32 |
| 147 |
procedure, private :: lonlat_64 => Structured__lonlat_64 |
| 148 |
generic :: lonlat => lonlat_32, lonlat_64 |
| 149 |
procedure :: reduced => Structured__reduced |
| 150 |
#if FCKIT_FINAL_NOT_INHERITING |
| 151 |
final :: atlas_StructuredGrid__final_auto |
| 152 |
#endif |
| 153 |
|
| 154 |
END TYPE atlas_StructuredGrid |
| 155 |
|
| 156 |
interface atlas_StructuredGrid |
| 157 |
module procedure atlas_StructuredGrid__ctor_id |
| 158 |
module procedure atlas_StructuredGrid__ctor_config |
| 159 |
module procedure atlas_StructuredGrid__ctor_cptr |
| 160 |
end interface |
| 161 |
|
| 162 |
!------------------------------------------------------------------------------ |
| 163 |
!------------------------------------------------------------------------------ |
| 164 |
TYPE, extends(atlas_StructuredGrid) :: atlas_GaussianGrid |
| 165 |
|
| 166 |
! Purpose : |
| 167 |
! ------- |
| 168 |
! *atlas_ReducedGaussianGrid* : Object Grid specifications for Reduced Gaussian Grids |
| 169 |
|
| 170 |
! Methods : |
| 171 |
! ------- |
| 172 |
|
| 173 |
! Author : |
| 174 |
! ------ |
| 175 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 176 |
|
| 177 |
!------------------------------------------------------------------------------ |
| 178 |
contains |
| 179 |
procedure :: N => Gaussian__N |
| 180 |
|
| 181 |
#if FCKIT_FINAL_NOT_INHERITING |
| 182 |
final :: atlas_GaussianGrid__final_auto |
| 183 |
#endif |
| 184 |
|
| 185 |
END TYPE atlas_GaussianGrid |
| 186 |
|
| 187 |
interface atlas_GaussianGrid |
| 188 |
module procedure atlas_GaussianGrid__ctor_id |
| 189 |
end interface |
| 190 |
|
| 191 |
!------------------------------------------------------------------------------ |
| 192 |
!------------------------------------------------------------------------------ |
| 193 |
|
| 194 |
TYPE, extends(atlas_StructuredGrid) :: atlas_ReducedGaussianGrid |
| 195 |
|
| 196 |
! Purpose : |
| 197 |
! ------- |
| 198 |
! *atlas_ReducedGaussianGrid* : Object Grid specifications for Reduced Gaussian Grids |
| 199 |
|
| 200 |
! Methods : |
| 201 |
! ------- |
| 202 |
|
| 203 |
! Author : |
| 204 |
! ------ |
| 205 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 206 |
|
| 207 |
!------------------------------------------------------------------------------ |
| 208 |
contains |
| 209 |
procedure :: N => ReducedGaussian__N |
| 210 |
|
| 211 |
#if FCKIT_FINAL_NOT_INHERITING |
| 212 |
final :: atlas_ReducedGaussianGrid__final_auto |
| 213 |
#endif |
| 214 |
|
| 215 |
END TYPE atlas_ReducedGaussianGrid |
| 216 |
|
| 217 |
interface atlas_ReducedGaussianGrid |
| 218 |
module procedure atlas_ReducedGaussianGrid__ctor_int32 |
| 219 |
module procedure atlas_ReducedGaussianGrid__ctor_int64 |
| 220 |
module procedure atlas_ReducedGaussianGrid__ctor_projection_int32 |
| 221 |
module procedure atlas_ReducedGaussianGrid__ctor_projection_int64 |
| 222 |
end interface |
| 223 |
|
| 224 |
!------------------------------------------------------------------------------ |
| 225 |
|
| 226 |
TYPE, extends(atlas_StructuredGrid) :: atlas_RegularGaussianGrid |
| 227 |
|
| 228 |
! Purpose : |
| 229 |
! ------- |
| 230 |
! *atlas_RegularGaussianGrid* : Object Grid specifications for Regular Gaussian Grids |
| 231 |
|
| 232 |
! Methods : |
| 233 |
! ------- |
| 234 |
|
| 235 |
! Author : |
| 236 |
! ------ |
| 237 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 238 |
|
| 239 |
!------------------------------------------------------------------------------ |
| 240 |
contains |
| 241 |
procedure :: N => RegularGaussian__N |
| 242 |
|
| 243 |
#if FCKIT_FINAL_NOT_INHERITING |
| 244 |
final :: atlas_RegularGaussianGrid__final_auto |
| 245 |
#endif |
| 246 |
|
| 247 |
END TYPE atlas_RegularGaussianGrid |
| 248 |
|
| 249 |
interface atlas_RegularGaussianGrid |
| 250 |
module procedure atlas_RegularGaussianGrid__ctor_int32 |
| 251 |
module procedure atlas_RegularGaussianGrid__ctor_int64 |
| 252 |
end interface |
| 253 |
|
| 254 |
!------------------------------------------------------------------------------ |
| 255 |
|
| 256 |
TYPE, extends(atlas_StructuredGrid) :: atlas_RegularLonLatGrid |
| 257 |
|
| 258 |
! Purpose : |
| 259 |
! ------- |
| 260 |
! *atlas_RegularLonLatGrid* : Object Grid specifications for LonLat Grids |
| 261 |
|
| 262 |
! Methods : |
| 263 |
! ------- |
| 264 |
|
| 265 |
! Author : |
| 266 |
! ------ |
| 267 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 268 |
|
| 269 |
!------------------------------------------------------------------------------ |
| 270 |
contains |
| 271 |
#if FCKIT_FINAL_NOT_INHERITING |
| 272 |
final :: atlas_RegularLonLatGrid__final_auto |
| 273 |
#endif |
| 274 |
END TYPE atlas_RegularLonLatGrid |
| 275 |
|
| 276 |
interface atlas_RegularLonLatGrid |
| 277 |
module procedure atlas_grid_RegularLonLat__ctor_int32 |
| 278 |
module procedure atlas_grid_RegularLonLat__ctor_int64 |
| 279 |
end interface |
| 280 |
|
| 281 |
!------------------------------------------------------------------------------ |
| 282 |
|
| 283 |
TYPE, extends(atlas_StructuredGrid) :: atlas_ShiftedLonLatGrid |
| 284 |
|
| 285 |
! Purpose : |
| 286 |
! ------- |
| 287 |
! *atlas_ShiftedLonLatGrid* : Object Grid specifications for LonLat Grids |
| 288 |
|
| 289 |
! Methods : |
| 290 |
! ------- |
| 291 |
|
| 292 |
! Author : |
| 293 |
! ------ |
| 294 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 295 |
|
| 296 |
!------------------------------------------------------------------------------ |
| 297 |
contains |
| 298 |
#if FCKIT_FINAL_NOT_INHERITING |
| 299 |
final :: atlas_ShiftedLonLatGrid__final_auto |
| 300 |
#endif |
| 301 |
END TYPE atlas_ShiftedLonLatGrid |
| 302 |
|
| 303 |
interface atlas_ShiftedLonLatGrid |
| 304 |
module procedure atlas_grid_ShiftedLonLat__ctor_int32 |
| 305 |
module procedure atlas_grid_ShiftedLonLat__ctor_int64 |
| 306 |
end interface |
| 307 |
|
| 308 |
!------------------------------------------------------------------------------ |
| 309 |
|
| 310 |
TYPE, extends(atlas_StructuredGrid) :: atlas_ShiftedLonGrid |
| 311 |
|
| 312 |
! Purpose : |
| 313 |
! ------- |
| 314 |
! *atlas_ShiftedLonGrid* : Object Grid specifications for LonLat Grids |
| 315 |
|
| 316 |
! Methods : |
| 317 |
! ------- |
| 318 |
|
| 319 |
! Author : |
| 320 |
! ------ |
| 321 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 322 |
|
| 323 |
!------------------------------------------------------------------------------ |
| 324 |
contains |
| 325 |
#if FCKIT_FINAL_NOT_INHERITING |
| 326 |
final :: atlas_ShiftedLonGrid__final_auto |
| 327 |
#endif |
| 328 |
END TYPE atlas_ShiftedLonGrid |
| 329 |
|
| 330 |
interface atlas_ShiftedLonGrid |
| 331 |
module procedure atlas_grid_ShiftedLon__ctor_int32 |
| 332 |
module procedure atlas_grid_ShiftedLon__ctor_int64 |
| 333 |
end interface |
| 334 |
|
| 335 |
!------------------------------------------------------------------------------ |
| 336 |
|
| 337 |
TYPE, extends(atlas_StructuredGrid) :: atlas_ShiftedLatGrid |
| 338 |
|
| 339 |
! Purpose : |
| 340 |
! ------- |
| 341 |
! *atlas_ShiftedLatGrid* : Object Grid specifications for LonLat Grids |
| 342 |
|
| 343 |
! Methods : |
| 344 |
! ------- |
| 345 |
|
| 346 |
! Author : |
| 347 |
! ------ |
| 348 |
! 9-Oct-2014 Willem Deconinck *ECMWF* |
| 349 |
|
| 350 |
!------------------------------------------------------------------------------ |
| 351 |
contains |
| 352 |
#if FCKIT_FINAL_NOT_INHERITING |
| 353 |
final :: atlas_ShiftedLatGrid__final_auto |
| 354 |
#endif |
| 355 |
END TYPE atlas_ShiftedLatGrid |
| 356 |
|
| 357 |
interface atlas_ShiftedLatGrid |
| 358 |
module procedure atlas_grid_ShiftedLat__ctor_int32 |
| 359 |
module procedure atlas_grid_ShiftedLat__ctor_int64 |
| 360 |
end interface |
| 361 |
|
| 362 |
!------------------------------------------------------------------------------ |
| 363 |
|
| 364 |
interface atlas_RegionalGrid |
| 365 |
module procedure atlas_RegionalGrid_ctor_int32 |
| 366 |
module procedure atlas_RegionalGrid_ctor_int64 |
| 367 |
module procedure atlas_RegionalGrid_ctor_nwse_int32 |
| 368 |
module procedure atlas_RegionalGrid_ctor_nwse_int64 |
| 369 |
module procedure atlas_RegionalGrid_ctor_increments_int32 |
| 370 |
module procedure atlas_RegionalGrid_ctor_increments_int64 |
| 371 |
end interface |
| 372 |
|
| 373 |
!------------------------------------------------------------------------------ |
| 374 |
interface c_idx |
| 375 |
module procedure c_idx_32 |
| 376 |
module procedure c_idx_64 |
| 377 |
end interface |
| 378 |
|
| 379 |
interface c_gidx |
| 380 |
module procedure c_gidx_32 |
| 381 |
module procedure c_gidx_64 |
| 382 |
end interface |
| 383 |
|
| 384 |
!------------------------------------------------------------------------------ |
| 385 |
|
| 386 |
!======================================================== |
| 387 |
contains |
| 388 |
!======================================================== |
| 389 |
|
| 390 |
pure function c_idx_32(f_idx) result(c_idx) |
| 391 |
use, intrinsic :: iso_c_binding, only : c_long |
| 392 |
integer(ATLAS_KIND_IDX) :: c_idx |
| 393 |
integer(c_long), intent(in) :: f_idx |
| 394 |
c_idx = int(f_idx,ATLAS_KIND_IDX) - 1_ATLAS_KIND_IDX |
| 395 |
end function |
| 396 |
|
| 397 |
pure function c_idx_64(f_idx) result(c_idx) |
| 398 |
use, intrinsic :: iso_c_binding, only : c_long, c_int |
| 399 |
integer(ATLAS_KIND_IDX) :: c_idx |
| 400 |
integer(c_int), intent(in) :: f_idx |
| 401 |
c_idx = int(f_idx,ATLAS_KIND_IDX) - 1_ATLAS_KIND_IDX |
| 402 |
end function |
| 403 |
|
| 404 |
pure function c_gidx_32(f_gidx) result(c_gidx) |
| 405 |
use, intrinsic :: iso_c_binding, only : c_long |
| 406 |
integer(ATLAS_KIND_GIDX) :: c_gidx |
| 407 |
integer(c_long), intent(in) :: f_gidx |
| 408 |
c_gidx = int(f_gidx,ATLAS_KIND_GIDX) - 1_ATLAS_KIND_GIDX |
| 409 |
end function |
| 410 |
|
| 411 |
pure function c_gidx_64(f_gidx) result(c_gidx) |
| 412 |
use, intrinsic :: iso_c_binding, only : c_int |
| 413 |
integer(ATLAS_KIND_GIDX) :: c_gidx |
| 414 |
integer(c_int), intent(in) :: f_gidx |
| 415 |
c_gidx = int(f_gidx,ATLAS_KIND_GIDX) - 1_ATLAS_KIND_GIDX |
| 416 |
end function |
| 417 |
|
| 418 |
! ----------------------------------------------------------------------------- |
| 419 |
! Destructor |
| 420 |
|
| 421 |
#if FCKIT_FINAL_NOT_INHERITING |
| 422 |
ATLAS_FINAL subroutine atlas_Grid__final_auto(this) |
| 423 |
type(atlas_Grid), intent(inout) :: this |
| 424 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 425 |
call this%final() |
| 426 |
#endif |
| 427 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 428 |
end subroutine |
| 429 |
|
| 430 |
ATLAS_FINAL subroutine atlas_UnstructuredGrid__final_auto(this) |
| 431 |
type(atlas_UnstructuredGrid), intent(inout) :: this |
| 432 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 433 |
call this%final() |
| 434 |
#endif |
| 435 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 436 |
end subroutine |
| 437 |
|
| 438 |
ATLAS_FINAL subroutine atlas_StructuredGrid__final_auto(this) |
| 439 |
type(atlas_StructuredGrid), intent(inout) :: this |
| 440 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 441 |
call this%final() |
| 442 |
#endif |
| 443 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 444 |
end subroutine |
| 445 |
|
| 446 |
ATLAS_FINAL subroutine atlas_GaussianGrid__final_auto(this) |
| 447 |
type(atlas_GaussianGrid), intent(inout) :: this |
| 448 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 449 |
call this%final() |
| 450 |
#endif |
| 451 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 452 |
end subroutine |
| 453 |
|
| 454 |
ATLAS_FINAL subroutine atlas_ReducedGaussianGrid__final_auto(this) |
| 455 |
type(atlas_ReducedGaussianGrid), intent(inout) :: this |
| 456 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 457 |
call this%final() |
| 458 |
#endif |
| 459 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 460 |
end subroutine |
| 461 |
|
| 462 |
ATLAS_FINAL subroutine atlas_RegularLonLatGrid__final_auto(this) |
| 463 |
type(atlas_RegularLonLatGrid), intent(inout) :: this |
| 464 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 465 |
call this%final() |
| 466 |
#endif |
| 467 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 468 |
end subroutine |
| 469 |
|
| 470 |
ATLAS_FINAL subroutine atlas_ShiftedLonLatGrid__final_auto(this) |
| 471 |
type(atlas_ShiftedLonLatGrid), intent(inout) :: this |
| 472 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 473 |
call this%final() |
| 474 |
#endif |
| 475 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 476 |
end subroutine |
| 477 |
|
| 478 |
ATLAS_FINAL subroutine atlas_ShiftedLonGrid__final_auto(this) |
| 479 |
type(atlas_ShiftedLonGrid), intent(inout) :: this |
| 480 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 481 |
call this%final() |
| 482 |
#endif |
| 483 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 484 |
end subroutine |
| 485 |
|
| 486 |
ATLAS_FINAL subroutine atlas_ShiftedLatGrid__final_auto(this) |
| 487 |
type(atlas_ShiftedLatGrid), intent(inout) :: this |
| 488 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 489 |
call this%final() |
| 490 |
#endif |
| 491 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 492 |
end subroutine |
| 493 |
|
| 494 |
ATLAS_FINAL subroutine atlas_RegularGaussianGrid__final_auto(this) |
| 495 |
type(atlas_RegularGaussianGrid), intent(inout) :: this |
| 496 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 497 |
call this%final() |
| 498 |
#endif |
| 499 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 500 |
end subroutine |
| 501 |
#endif |
| 502 |
|
| 503 |
|
| 504 |
! ----------------------------------------------------------------------------- |
| 505 |
! Constructors |
| 506 |
|
| 507 |
function atlas_Grid__ctor_id(identifier) result(this) |
| 508 |
use fckit_c_interop_module, only: c_str |
| 509 |
use atlas_grid_Structured_c_binding |
| 510 |
type(atlas_Grid) :: this |
| 511 |
character(len=*), intent(in) :: identifier |
| 512 |
call this%reset_c_ptr( atlas__grid__Structured(c_str(identifier)) ) |
| 513 |
call this%return() |
| 514 |
end function |
| 515 |
|
| 516 |
function atlas_Grid__ctor_config(config) result(this) |
| 517 |
use atlas_grid_Structured_c_binding |
| 518 |
type(atlas_Grid) :: this |
| 519 |
type(atlas_Config), intent(in) :: config |
| 520 |
call this%reset_c_ptr( atlas__grid__Structured__config(config%CPTR_PGIBUG_B) ) |
| 521 |
call this%return() |
| 522 |
end function |
| 523 |
|
| 524 |
function atlas_Grid__ctor_cptr(cptr) result(this) |
| 525 |
use fckit_c_interop_module, only: c_str |
| 526 |
use atlas_grid_Structured_c_binding |
| 527 |
type(atlas_Grid) :: this |
| 528 |
type(c_ptr), intent(in) :: cptr |
| 529 |
call this%reset_c_ptr( cptr ) |
| 530 |
call this%return() |
| 531 |
end function |
| 532 |
|
| 533 |
! ----------------------------------------------------------------------------- |
| 534 |
|
| 535 |
function atlas_UnstructuredGrid__ctor_config(config) result(this) |
| 536 |
use atlas_grid_unstructured_c_binding |
| 537 |
type(atlas_UnstructuredGrid) :: this |
| 538 |
type(atlas_Config), intent(in) :: config |
| 539 |
call this%reset_c_ptr( atlas__grid__Unstructured__config(config%CPTR_PGIBUG_B) ) |
| 540 |
call this%return() |
| 541 |
end function |
| 542 |
|
| 543 |
function atlas_UnstructuredGrid__ctor_cptr(cptr) result(this) |
| 544 |
use fckit_c_interop_module, only: c_str |
| 545 |
use atlas_grid_unstructured_c_binding |
| 546 |
type(atlas_UnstructuredGrid) :: this |
| 547 |
type(c_ptr), intent(in) :: cptr |
| 548 |
call this%reset_c_ptr( cptr ) |
| 549 |
call this%return() |
| 550 |
end function |
| 551 |
|
| 552 |
function atlas_UnstructuredGrid__ctor_points( xy ) result(this) |
| 553 |
use, intrinsic :: iso_c_binding, only : c_double, c_int |
| 554 |
use fckit_c_interop_module, only : c_str |
| 555 |
use fckit_array_module, only : array_strides, array_view1d |
| 556 |
use atlas_grid_unstructured_c_binding |
| 557 |
type(atlas_UnstructuredGrid) :: this |
| 558 |
real(c_double), intent(in), target :: xy(:,:) |
| 559 |
integer(c_int) :: shapef(2) |
| 560 |
integer(c_int) :: stridesf(2) |
| 561 |
real(c_double), pointer :: xy1d(:) |
| 562 |
xy1d => array_view1d(xy) |
| 563 |
shapef = shape(xy) |
| 564 |
stridesf = array_strides(xy) |
| 565 |
call this%reset_c_ptr( atlas__grid__Unstructured__points( xy1d, shapef, stridesf ) ) |
| 566 |
call this%return() |
| 567 |
end function |
| 568 |
|
| 569 |
! ----------------------------------------------------------------------------- |
| 570 |
|
| 571 |
function atlas_StructuredGrid__ctor_id(identifier) result(this) |
| 572 |
use fckit_c_interop_module, only: c_str |
| 573 |
use atlas_grid_Structured_c_binding |
| 574 |
type(atlas_StructuredGrid) :: this |
| 575 |
character(len=*), intent(in) :: identifier |
| 576 |
call this%reset_c_ptr( atlas__grid__Structured(c_str(identifier)) ) |
| 577 |
call this%return() |
| 578 |
end function |
| 579 |
|
| 580 |
function atlas_StructuredGrid__ctor_config(config) result(this) |
| 581 |
use atlas_grid_Structured_c_binding |
| 582 |
type(atlas_StructuredGrid) :: this |
| 583 |
type(atlas_Config), intent(in) :: config |
| 584 |
call this%reset_c_ptr( atlas__grid__Structured__config(config%CPTR_PGIBUG_B) ) |
| 585 |
call this%return() |
| 586 |
end function |
| 587 |
|
| 588 |
function atlas_StructuredGrid__ctor_cptr(cptr) result(this) |
| 589 |
use fckit_c_interop_module, only: c_str |
| 590 |
use atlas_grid_Structured_c_binding |
| 591 |
type(atlas_StructuredGrid) :: this |
| 592 |
type(c_ptr), intent(in) :: cptr |
| 593 |
call this%reset_c_ptr( cptr ) |
| 594 |
call this%return() |
| 595 |
end function |
| 596 |
|
| 597 |
!----------------------------------------------------------------------------- |
| 598 |
|
| 599 |
function atlas_GaussianGrid__ctor_id(identifier) result(this) |
| 600 |
use fckit_c_interop_module, only: c_str |
| 601 |
use atlas_grid_Structured_c_binding |
| 602 |
type(atlas_GaussianGrid) :: this |
| 603 |
character(len=*), intent(in) :: identifier |
| 604 |
call this%reset_c_ptr( atlas__grid__Structured(c_str(identifier)) ) |
| 605 |
call this%return() |
| 606 |
end function |
| 607 |
|
| 608 |
! ----------------------------------------------------------------------------- |
| 609 |
|
| 610 |
function atlas_RegularGaussianGrid__ctor_int32(N) result(this) |
| 611 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 612 |
use atlas_grid_Structured_c_binding |
| 613 |
type(atlas_RegularGaussianGrid) :: this |
| 614 |
integer(c_int), intent(in) :: N |
| 615 |
call this%reset_c_ptr( atlas__grid__regular__RegularGaussian(int(N,c_long)) ) |
| 616 |
call this%return() |
| 617 |
end function |
| 618 |
|
| 619 |
function atlas_RegularGaussianGrid__ctor_int64(N) result(this) |
| 620 |
use, intrinsic :: iso_c_binding, only: c_long |
| 621 |
use atlas_grid_Structured_c_binding |
| 622 |
type(atlas_RegularGaussianGrid) :: this |
| 623 |
integer(c_long), intent(in) :: N |
| 624 |
call this%reset_c_ptr( atlas__grid__regular__RegularGaussian(int(N,c_long)) ) |
| 625 |
call this%return() |
| 626 |
end function |
| 627 |
|
| 628 |
!----------------------------------------------------------------------------- |
| 629 |
|
| 630 |
function atlas_ReducedGaussianGrid__ctor_int32(nx) result(this) |
| 631 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 632 |
use atlas_grid_Structured_c_binding |
| 633 |
type(atlas_ReducedGaussianGrid) :: this |
| 634 |
integer(c_int), intent(in) :: nx(:) |
| 635 |
call this%reset_c_ptr( & |
| 636 |
& atlas__grid__reduced__ReducedGaussian_int( nx, int(size(nx),c_long) ) ) |
| 637 |
call this%return() |
| 638 |
end function |
| 639 |
|
| 640 |
function atlas_ReducedGaussianGrid__ctor_int64(nx) result(this) |
| 641 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 642 |
use atlas_grid_Structured_c_binding |
| 643 |
type(atlas_ReducedGaussianGrid) :: this |
| 644 |
integer(c_long), intent(in) :: nx(:) |
| 645 |
call this%reset_c_ptr( & |
| 646 |
& atlas__grid__reduced__ReducedGaussian_long( nx, int(size(nx),c_long) ) ) |
| 647 |
call this%return() |
| 648 |
end function |
| 649 |
|
| 650 |
function atlas_ReducedGaussianGrid__ctor_projection_int32(nx, projection) result(this) |
| 651 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 652 |
use atlas_grid_Structured_c_binding |
| 653 |
type(atlas_ReducedGaussianGrid) :: this |
| 654 |
integer(c_int), intent(in) :: nx(:) |
| 655 |
type(atlas_Projection), intent(in) :: projection |
| 656 |
call this%reset_c_ptr( & |
| 657 |
& atlas__grid__reduced__ReducedGaussian_int_projection( nx, int(size(nx),c_long), projection%CPTR_PGIBUG_A ) ) |
| 658 |
call this%return() |
| 659 |
end function |
| 660 |
|
| 661 |
function atlas_ReducedGaussianGrid__ctor_projection_int64(nx, projection) result(this) |
| 662 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 663 |
use atlas_grid_Structured_c_binding |
| 664 |
type(atlas_ReducedGaussianGrid) :: this |
| 665 |
integer(c_long), intent(in) :: nx(:) |
| 666 |
type(atlas_Projection), intent(in) :: projection |
| 667 |
call this%reset_c_ptr( & |
| 668 |
& atlas__grid__reduced__ReducedGaussian_long_projection( nx, int(size(nx),c_long), projection%CPTR_PGIBUG_A ) ) |
| 669 |
call this%return() |
| 670 |
end function |
| 671 |
|
| 672 |
!----------------------------------------------------------------------------- |
| 673 |
|
| 674 |
function atlas_grid_RegularLonLat__ctor_int32(nlon,nlat) result(this) |
| 675 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 676 |
use atlas_grid_Structured_c_binding |
| 677 |
type(atlas_RegularLonLatGrid) :: this |
| 678 |
integer(c_int), intent(in) :: nlon, nlat |
| 679 |
call this%reset_c_ptr( atlas__grid__regular__RegularLonLat(int(nlon,c_long),int(nlat,c_long)) ) |
| 680 |
call this%return() |
| 681 |
end function |
| 682 |
|
| 683 |
function atlas_grid_RegularLonLat__ctor_int64(nlon,nlat) result(this) |
| 684 |
use, intrinsic :: iso_c_binding, only: c_long |
| 685 |
use atlas_grid_Structured_c_binding |
| 686 |
type(atlas_RegularLonLatGrid) :: this |
| 687 |
integer(c_long), intent(in) :: nlon, nlat |
| 688 |
call this%reset_c_ptr( atlas__grid__regular__RegularLonLat( nlon, nlat ) ) |
| 689 |
call this%return() |
| 690 |
end function |
| 691 |
|
| 692 |
!----------------------------------------------------------------------------- |
| 693 |
|
| 694 |
function atlas_grid_ShiftedLonLat__ctor_int32(nlon,nlat) result(this) |
| 695 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 696 |
use atlas_grid_Structured_c_binding |
| 697 |
type(atlas_ShiftedLonLatGrid) :: this |
| 698 |
integer(c_int), intent(in) :: nlon, nlat |
| 699 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLonLat(int(nlon,c_long),int(nlat,c_long)) ) |
| 700 |
call this%return() |
| 701 |
end function |
| 702 |
|
| 703 |
function atlas_grid_ShiftedLonLat__ctor_int64(nlon,nlat) result(this) |
| 704 |
use, intrinsic :: iso_c_binding, only: c_long |
| 705 |
use atlas_grid_Structured_c_binding |
| 706 |
type(atlas_ShiftedLonLatGrid) :: this |
| 707 |
integer(c_long), intent(in) :: nlon, nlat |
| 708 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLonLat( nlon, nlat ) ) |
| 709 |
call this%return() |
| 710 |
end function |
| 711 |
|
| 712 |
!----------------------------------------------------------------------------- |
| 713 |
|
| 714 |
function atlas_grid_ShiftedLon__ctor_int32(nlon,nlat) result(this) |
| 715 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 716 |
use atlas_grid_Structured_c_binding |
| 717 |
type(atlas_ShiftedLonGrid) :: this |
| 718 |
integer(c_int), intent(in) :: nlon, nlat |
| 719 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLon(int(nlon,c_long),int(nlat,c_long)) ) |
| 720 |
call this%return() |
| 721 |
end function |
| 722 |
|
| 723 |
function atlas_grid_ShiftedLon__ctor_int64(nlon,nlat) result(this) |
| 724 |
use, intrinsic :: iso_c_binding, only: c_long |
| 725 |
use atlas_grid_Structured_c_binding |
| 726 |
type(atlas_ShiftedLonGrid) :: this |
| 727 |
integer(c_long), intent(in) :: nlon, nlat |
| 728 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLon( nlon, nlat ) ) |
| 729 |
call this%return() |
| 730 |
end function |
| 731 |
|
| 732 |
!----------------------------------------------------------------------------- |
| 733 |
|
| 734 |
function atlas_grid_ShiftedLat__ctor_int32(nlon,nlat) result(this) |
| 735 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 736 |
use atlas_grid_Structured_c_binding |
| 737 |
type(atlas_ShiftedLatGrid) :: this |
| 738 |
integer(c_int), intent(in) :: nlon, nlat |
| 739 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLat(int(nlon,c_long),int(nlat,c_long)) ) |
| 740 |
call this%return() |
| 741 |
end function |
| 742 |
|
| 743 |
function atlas_grid_ShiftedLat__ctor_int64(nlon,nlat) result(this) |
| 744 |
use, intrinsic :: iso_c_binding, only: c_long |
| 745 |
use atlas_grid_Structured_c_binding |
| 746 |
type(atlas_ShiftedLatGrid) :: this |
| 747 |
integer(c_long), intent(in) :: nlon, nlat |
| 748 |
call this%reset_c_ptr( atlas__grid__regular__ShiftedLat( nlon, nlat ) ) |
| 749 |
call this%return() |
| 750 |
end function |
| 751 |
|
| 752 |
! ----------------------------------------------------------------------------- |
| 753 |
! Structured members |
| 754 |
|
| 755 |
function atlas_Grid__name(this) result(name) |
| 756 |
use atlas_grid_Grid_c_binding |
| 757 |
use fckit_c_interop_module, only : c_ptr_to_string, c_ptr_free |
| 758 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 759 |
class(atlas_Grid), intent(in) :: this |
| 760 |
character(len=:), allocatable :: name |
| 761 |
type(c_ptr) :: name_c_str |
| 762 |
integer :: size |
| 763 |
call atlas__grid__Grid__name(this%CPTR_PGIBUG_A, name_c_str, size ) |
| 764 |
name = c_ptr_to_string(name_c_str) |
| 765 |
call c_ptr_free(name_c_str) |
| 766 |
end function |
| 767 |
|
| 768 |
function atlas_Grid__size(this) result(npts) |
| 769 |
use, intrinsic :: iso_c_binding, only: c_int |
| 770 |
use atlas_grid_Grid_c_binding |
| 771 |
class(atlas_Grid), intent(in) :: this |
| 772 |
integer(ATLAS_KIND_IDX) :: npts |
| 773 |
npts = int(atlas__grid__Grid__size(this%CPTR_PGIBUG_A),ATLAS_KIND_IDX) |
| 774 |
end function |
| 775 |
|
| 776 |
function atlas_Grid__spec(this) result(spec) |
| 777 |
use atlas_grid_Grid_c_binding |
| 778 |
class(atlas_Grid), intent(in) :: this |
| 779 |
type(atlas_Config) :: spec |
| 780 |
spec = atlas_Config( atlas__grid__Grid__spec(this%CPTR_PGIBUG_A) ) |
| 781 |
call spec%return () |
| 782 |
end function |
| 783 |
|
| 784 |
function uid(this) |
| 785 |
use atlas_grid_Grid_c_binding |
| 786 |
use fckit_c_interop_module, only : c_ptr_to_string, c_ptr_free |
| 787 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 788 |
class(atlas_Grid), intent(in) :: this |
| 789 |
character(len=:), allocatable :: uid |
| 790 |
type(c_ptr) :: uid_c_str |
| 791 |
integer :: size |
| 792 |
call atlas__grid__Grid__uid(this%CPTR_PGIBUG_A, uid_c_str, size ) |
| 793 |
uid = c_ptr_to_string(uid_c_str) |
| 794 |
call c_ptr_free(uid_c_str) |
| 795 |
end function |
| 796 |
|
| 797 |
function lonlat_bounding_box (this) result (bb) |
| 798 |
use, intrinsic :: iso_c_binding, only : c_double |
| 799 |
use atlas_grid_Grid_c_binding |
| 800 |
class(atlas_Grid), intent(in) :: this |
| 801 |
type(atlas_LonLatRectangularDomain) :: bb |
| 802 |
bb = atlas_LonLatRectangularDomain(atlas__grid__Grid__lonlat_bounding_box (this%CPTR_PGIBUG_A)) |
| 803 |
call bb%return() |
| 804 |
end function |
| 805 |
|
| 806 |
|
| 807 |
function Gaussian__N(this) result(N) |
| 808 |
use, intrinsic :: iso_c_binding, only: c_long |
| 809 |
use atlas_grid_Structured_c_binding |
| 810 |
class(atlas_GaussianGrid), intent(in) :: this |
| 811 |
integer(c_long) :: N |
| 812 |
N = atlas__grid__Gaussian__N(this%CPTR_PGIBUG_A) |
| 813 |
end function |
| 814 |
|
| 815 |
function ReducedGaussian__N(this) result(N) |
| 816 |
use, intrinsic :: iso_c_binding, only: c_long |
| 817 |
use atlas_grid_Structured_c_binding |
| 818 |
class(atlas_ReducedGaussianGrid), intent(in) :: this |
| 819 |
integer(c_long) :: N |
| 820 |
N = atlas__grid__Gaussian__N(this%CPTR_PGIBUG_A) |
| 821 |
end function |
| 822 |
|
| 823 |
function RegularGaussian__N(this) result(N) |
| 824 |
use, intrinsic :: iso_c_binding, only: c_long |
| 825 |
use atlas_grid_Structured_c_binding |
| 826 |
class(atlas_RegularGaussianGrid), intent(in) :: this |
| 827 |
integer(c_long) :: N |
| 828 |
N = atlas__grid__Gaussian__N(this%CPTR_PGIBUG_A) |
| 829 |
end function |
| 830 |
|
| 831 |
function Structured__ny(this) result(ny) |
| 832 |
use, intrinsic :: iso_c_binding, only: c_long |
| 833 |
use atlas_grid_Structured_c_binding |
| 834 |
class(atlas_StructuredGrid), intent(in) :: this |
| 835 |
integer(ATLAS_KIND_IDX) :: ny |
| 836 |
ny = atlas__grid__Structured__ny(this%CPTR_PGIBUG_A) |
| 837 |
end function |
| 838 |
|
| 839 |
subroutine Structured__index2ij_int32(this, gidx, i, j) |
| 840 |
use, intrinsic :: iso_c_binding, only: c_int32_t |
| 841 |
use atlas_grid_Structured_c_binding |
| 842 |
integer(c_int32_t), intent (in) :: gidx |
| 843 |
class(atlas_StructuredGrid), intent(in) :: this |
| 844 |
integer(ATLAS_KIND_IDX), intent(out) :: i, j |
| 845 |
call atlas__grid__Structured__index2ij(this%CPTR_PGIBUG_A, c_gidx(gidx), i, j) |
| 846 |
i = i + 1 |
| 847 |
j = j + 1 |
| 848 |
end subroutine |
| 849 |
|
| 850 |
subroutine Structured__index2ij_int64(this, gidx, i, j) |
| 851 |
use, intrinsic :: iso_c_binding, only: c_long, c_int64_t |
| 852 |
use atlas_grid_Structured_c_binding |
| 853 |
integer(c_int64_t), intent (in) :: gidx |
| 854 |
class(atlas_StructuredGrid), intent(in) :: this |
| 855 |
integer(ATLAS_KIND_IDX), intent(out) :: i, j |
| 856 |
call atlas__grid__Structured__index2ij(this%CPTR_PGIBUG_A, c_gidx(gidx), i, j) |
| 857 |
i = i + 1 |
| 858 |
j = j + 1 |
| 859 |
end subroutine |
| 860 |
|
| 861 |
function Structured__ij_int32(this, gidx) result(ij) |
| 862 |
use, intrinsic :: iso_c_binding, only: c_int |
| 863 |
use atlas_grid_Structured_c_binding |
| 864 |
integer(c_int), intent (in) :: gidx |
| 865 |
class(atlas_StructuredGrid), intent(in) :: this |
| 866 |
integer(ATLAS_KIND_IDX) :: ij (2) |
| 867 |
call atlas__grid__Structured__index2ij(this%CPTR_PGIBUG_A, c_gidx(gidx), ij(1), ij(2)) |
| 868 |
ij = ij + 1 |
| 869 |
end function |
| 870 |
|
| 871 |
function Structured__ij_int64(this, gidx) result(ij) |
| 872 |
use, intrinsic :: iso_c_binding, only: c_int, c_long |
| 873 |
use atlas_grid_Structured_c_binding |
| 874 |
integer(c_long), intent (in) :: gidx |
| 875 |
class(atlas_StructuredGrid), intent(in) :: this |
| 876 |
integer(ATLAS_KIND_IDX) :: ij (2) |
| 877 |
call atlas__grid__Structured__index2ij(this%CPTR_PGIBUG_A, c_gidx(gidx), ij(1), ij(2)) |
| 878 |
ij = ij + 1 |
| 879 |
end function |
| 880 |
|
| 881 |
function Structured__index_int32(this, i, j) result(gidx) |
| 882 |
use, intrinsic :: iso_c_binding, only: c_int |
| 883 |
use atlas_grid_Structured_c_binding |
| 884 |
integer(ATLAS_KIND_IDX) :: gidx |
| 885 |
class(atlas_StructuredGrid), intent(in) :: this |
| 886 |
integer(c_int), intent(in) :: i, j |
| 887 |
gidx = int(1 + atlas__grid__Structured__index(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j) ), ATLAS_KIND_IDX ) |
| 888 |
end function |
| 889 |
|
| 890 |
function Structured__index_int64(this, i, j) result(gidx) |
| 891 |
use, intrinsic :: iso_c_binding, only: c_long |
| 892 |
use atlas_grid_Structured_c_binding |
| 893 |
integer(ATLAS_KIND_IDX) :: gidx |
| 894 |
class(atlas_StructuredGrid), intent(in) :: this |
| 895 |
integer(c_long), intent(in) :: i, j |
| 896 |
gidx = int( 1 + atlas__grid__Structured__index(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j) ), ATLAS_KIND_IDX ) |
| 897 |
end function |
| 898 |
|
| 899 |
function Structured__nx_int32(this, j) result(nx) |
| 900 |
use, intrinsic :: iso_c_binding, only: c_int |
| 901 |
use atlas_grid_Structured_c_binding |
| 902 |
integer(ATLAS_KIND_IDX) :: nx |
| 903 |
class(atlas_StructuredGrid), intent(in) :: this |
| 904 |
integer(c_int), intent(in) :: j |
| 905 |
nx = atlas__grid__Structured__nx(this%CPTR_PGIBUG_A, c_idx(j) ) |
| 906 |
end function |
| 907 |
|
| 908 |
function Structured__nx_int64(this, j) result(nx) |
| 909 |
use, intrinsic :: iso_c_binding, only: c_long |
| 910 |
use atlas_grid_Structured_c_binding |
| 911 |
integer(ATLAS_KIND_IDX) :: nx |
| 912 |
class(atlas_StructuredGrid), intent(in) :: this |
| 913 |
integer(c_long), intent(in) :: j |
| 914 |
nx = atlas__grid__Structured__nx(this%CPTR_PGIBUG_A, c_idx(j) ) |
| 915 |
end function |
| 916 |
|
| 917 |
function Structured__reduced(this) result(reduced) |
| 918 |
use atlas_grid_Structured_c_binding |
| 919 |
class(atlas_StructuredGrid), intent(in) :: this |
| 920 |
logical :: reduced |
| 921 |
if( atlas__grid__Structured__reduced(this%CPTR_PGIBUG_A) == 1 ) then |
| 922 |
reduced = .true. |
| 923 |
else |
| 924 |
reduced = .false. |
| 925 |
endif |
| 926 |
end function |
| 927 |
|
| 928 |
function Structured__nx_array(this) result(nx) |
| 929 |
use atlas_grid_Structured_c_binding |
| 930 |
use, intrinsic :: iso_c_binding , only : c_long, c_f_pointer |
| 931 |
class(atlas_StructuredGrid), intent(in) :: this |
| 932 |
integer(ATLAS_KIND_IDX), pointer :: nx(:) |
| 933 |
type (c_ptr) :: nx_c_ptr |
| 934 |
integer(ATLAS_KIND_IDX) :: nx_size |
| 935 |
call atlas__grid__Structured__nx_array(this%CPTR_PGIBUG_A, nx_c_ptr, nx_size) |
| 936 |
call c_f_pointer(nx_c_ptr , nx , (/nx_size/)) |
| 937 |
end function |
| 938 |
|
| 939 |
function Structured__nxmax(this) result(nxmax) |
| 940 |
use, intrinsic :: iso_c_binding, only: c_long |
| 941 |
use atlas_grid_Structured_c_binding |
| 942 |
class(atlas_StructuredGrid), intent(in) :: this |
| 943 |
integer(c_long) :: nxmax |
| 944 |
nxmax = atlas__grid__Structured__nxmax(this%CPTR_PGIBUG_A) |
| 945 |
end function |
| 946 |
|
| 947 |
function Structured__nxmin(this) result(nxmin) |
| 948 |
use, intrinsic :: iso_c_binding, only: c_long |
| 949 |
use atlas_grid_Structured_c_binding |
| 950 |
class(atlas_StructuredGrid), intent(in) :: this |
| 951 |
integer(c_long) :: nxmin |
| 952 |
nxmin = atlas__grid__Structured__nxmin(this%CPTR_PGIBUG_A) |
| 953 |
end function |
| 954 |
|
| 955 |
function Structured__y_32(this, j) result(y) |
| 956 |
use, intrinsic :: iso_c_binding, only: c_double, c_int |
| 957 |
use atlas_grid_Structured_c_binding |
| 958 |
real(c_double) :: y |
| 959 |
class(atlas_StructuredGrid), intent(in) :: this |
| 960 |
integer(c_int), intent(in) :: j |
| 961 |
y = atlas__grid__Structured__y(this%CPTR_PGIBUG_A, c_idx(j) ) |
| 962 |
end function |
| 963 |
|
| 964 |
function Structured__y_64(this, j) result(y) |
| 965 |
use, intrinsic :: iso_c_binding, only: c_double, c_long |
| 966 |
use atlas_grid_Structured_c_binding |
| 967 |
real(c_double) :: y |
| 968 |
class(atlas_StructuredGrid), intent(in) :: this |
| 969 |
integer(c_long), intent(in) :: j |
| 970 |
y = atlas__grid__Structured__y(this%CPTR_PGIBUG_A, c_idx(j) ) |
| 971 |
end function |
| 972 |
|
| 973 |
function Structured__y_array(this) result(y) |
| 974 |
use atlas_grid_Structured_c_binding |
| 975 |
use, intrinsic :: iso_c_binding , only : c_double, c_f_pointer |
| 976 |
class(atlas_StructuredGrid), intent(in) :: this |
| 977 |
real (c_double) , pointer :: y(:) |
| 978 |
type (c_ptr) :: y_c_ptr |
| 979 |
integer(ATLAS_KIND_IDX) :: y_size |
| 980 |
call atlas__grid__Structured__y_array(this%CPTR_PGIBUG_A, & |
| 981 |
& y_c_ptr, y_size) |
| 982 |
call c_f_pointer (y_c_ptr, y, (/y_size/)) |
| 983 |
end function |
| 984 |
|
| 985 |
function Structured__x_32(this, i,j) result(x) |
| 986 |
use, intrinsic :: iso_c_binding, only: c_double, c_int |
| 987 |
use atlas_grid_Structured_c_binding |
| 988 |
class(atlas_StructuredGrid), intent(in) :: this |
| 989 |
real(c_double) :: x |
| 990 |
integer(c_int) :: i,j |
| 991 |
x = atlas__grid__Structured__x(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j)) |
| 992 |
end function |
| 993 |
|
| 994 |
function Structured__x_64(this, i,j) result(x) |
| 995 |
use, intrinsic :: iso_c_binding, only: c_double, c_long |
| 996 |
use atlas_grid_Structured_c_binding |
| 997 |
class(atlas_StructuredGrid), intent(in) :: this |
| 998 |
real(c_double) :: x |
| 999 |
integer(c_long) :: i,j |
| 1000 |
x = atlas__grid__Structured__x(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j)) |
| 1001 |
end function |
| 1002 |
|
| 1003 |
function Structured__xy_32(this, i,j) result(xy) |
| 1004 |
use, intrinsic :: iso_c_binding, only: c_double, c_int |
| 1005 |
use atlas_grid_Structured_c_binding |
| 1006 |
real(c_double) :: xy(2) |
| 1007 |
class(atlas_StructuredGrid), intent(in) :: this |
| 1008 |
integer(c_int) , intent(in) :: i,j |
| 1009 |
call atlas__grid__Structured__xy(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j), xy) |
| 1010 |
end function |
| 1011 |
|
| 1012 |
function Structured__xy_64(this, i,j) result(xy) |
| 1013 |
use, intrinsic :: iso_c_binding, only: c_double, c_long |
| 1014 |
use atlas_grid_Structured_c_binding |
| 1015 |
real(c_double) :: xy(2) |
| 1016 |
class(atlas_StructuredGrid), intent(in) :: this |
| 1017 |
integer(c_long) , intent(in) :: i,j |
| 1018 |
call atlas__grid__Structured__xy(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j), xy) |
| 1019 |
end function |
| 1020 |
|
| 1021 |
function Structured__lonlat_32(this, i,j) result(lonlat) |
| 1022 |
use, intrinsic :: iso_c_binding, only: c_double, c_int |
| 1023 |
use atlas_grid_Structured_c_binding |
| 1024 |
real(c_double) :: lonlat(2) |
| 1025 |
class(atlas_StructuredGrid), intent(in) :: this |
| 1026 |
integer(c_int) , intent(in) :: i,j |
| 1027 |
call atlas__grid__Structured__lonlat(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j), lonlat) |
| 1028 |
end function |
| 1029 |
|
| 1030 |
function Structured__lonlat_64(this, i,j) result(lonlat) |
| 1031 |
use, intrinsic :: iso_c_binding, only: c_double, c_long |
| 1032 |
use atlas_grid_Structured_c_binding |
| 1033 |
real(c_double) :: lonlat(2) |
| 1034 |
class(atlas_StructuredGrid), intent(in) :: this |
| 1035 |
integer(c_long) , intent(in) :: i,j |
| 1036 |
call atlas__grid__Structured__lonlat(this%CPTR_PGIBUG_A, c_idx(i), c_idx(j), lonlat) |
| 1037 |
end function |
| 1038 |
|
| 1039 |
! ---------------------------------------------------------------------------------------- |
| 1040 |
|
| 1041 |
function atlas_RegionalGrid_ctor_int32( nx, ny, xy_min, xy_max, projection, y_numbering ) result(this) |
| 1042 |
use, intrinsic :: iso_c_binding, only : c_int, c_double |
| 1043 |
type(atlas_StructuredGrid) :: this |
| 1044 |
integer(c_int), intent(in) :: nx, ny |
| 1045 |
real(c_double), intent(in) :: xy_min(2), xy_max(2) |
| 1046 |
type(atlas_Projection), intent(in), optional :: projection |
| 1047 |
integer(c_int), intent(in), optional :: y_numbering |
| 1048 |
type(atlas_Config) :: config |
| 1049 |
|
| 1050 |
config = atlas_Config() |
| 1051 |
call config%set("type","regional") |
| 1052 |
call config%set("nx",nx) |
| 1053 |
call config%set("ny",ny) |
| 1054 |
call config%set("xmin",xy_min(1)) |
| 1055 |
call config%set("ymin",xy_min(2)) |
| 1056 |
call config%set("xmax",xy_max(1)) |
| 1057 |
call config%set("ymax",xy_max(2)) |
| 1058 |
if( present(projection) ) then |
| 1059 |
call config%set("projection",projection%spec()) |
| 1060 |
endif |
| 1061 |
if( present(y_numbering) ) then |
| 1062 |
call config%set("y_numbering",y_numbering) |
| 1063 |
endif |
| 1064 |
this = atlas_StructuredGrid(config) |
| 1065 |
call config%final() |
| 1066 |
call this%return() |
| 1067 |
end function |
| 1068 |
|
| 1069 |
function atlas_RegionalGrid_ctor_int64( nx, ny, xy_min, xy_max, projection, y_numbering ) result(this) |
| 1070 |
use, intrinsic :: iso_c_binding, only : c_int, c_long, c_double |
| 1071 |
type(atlas_StructuredGrid) :: this |
| 1072 |
integer(c_long), intent(in) :: nx, ny |
| 1073 |
real(c_double), intent(in) :: xy_min(2), xy_max(2) |
| 1074 |
type(atlas_Projection), intent(in), optional :: projection |
| 1075 |
integer(c_int), intent(in), optional :: y_numbering |
| 1076 |
type(atlas_Config) :: config |
| 1077 |
|
| 1078 |
config = atlas_Config() |
| 1079 |
call config%set("type","regional") |
| 1080 |
call config%set("nx",nx) |
| 1081 |
call config%set("ny",ny) |
| 1082 |
call config%set("xmin",xy_min(1)) |
| 1083 |
call config%set("ymin",xy_min(2)) |
| 1084 |
call config%set("xmax",xy_max(1)) |
| 1085 |
call config%set("ymax",xy_max(2)) |
| 1086 |
if( present(projection) ) then |
| 1087 |
call config%set("projection",projection%spec()) |
| 1088 |
endif |
| 1089 |
if( present(y_numbering) ) then |
| 1090 |
call config%set("y_numbering",y_numbering) |
| 1091 |
endif |
| 1092 |
this = atlas_StructuredGrid(config) |
| 1093 |
call config%final() |
| 1094 |
call this%return() |
| 1095 |
end function |
| 1096 |
|
| 1097 |
|
| 1098 |
function atlas_RegionalGrid_ctor_nwse_int32( nx, ny, north, west, south, east, projection, y_numbering ) result(this) |
| 1099 |
use, intrinsic :: iso_c_binding, only : c_int, c_double |
| 1100 |
type(atlas_StructuredGrid) :: this |
| 1101 |
integer(c_int), intent(in) :: nx, ny |
| 1102 |
real(c_double), intent(in) :: north, west, south, east |
| 1103 |
type(atlas_Projection), intent(in), optional :: projection |
| 1104 |
integer(c_int), intent(in), optional :: y_numbering |
| 1105 |
type(atlas_Config) :: config |
| 1106 |
|
| 1107 |
config = atlas_Config() |
| 1108 |
call config%set("type","regional") |
| 1109 |
call config%set("nx",nx) |
| 1110 |
call config%set("ny",ny) |
| 1111 |
call config%set("north",north) |
| 1112 |
call config%set("west",west) |
| 1113 |
call config%set("south",south) |
| 1114 |
call config%set("east",east) |
| 1115 |
if( present(projection) ) then |
| 1116 |
call config%set("projection",projection%spec()) |
| 1117 |
endif |
| 1118 |
if( present(y_numbering) ) then |
| 1119 |
call config%set("y_numbering",y_numbering) |
| 1120 |
endif |
| 1121 |
this = atlas_StructuredGrid(config) |
| 1122 |
call config%final() |
| 1123 |
call this%return() |
| 1124 |
end function |
| 1125 |
|
| 1126 |
function atlas_RegionalGrid_ctor_nwse_int64( nx, ny, north, west, south, east, projection, y_numbering ) result(this) |
| 1127 |
use, intrinsic :: iso_c_binding, only : c_int, c_long, c_double |
| 1128 |
type(atlas_Grid) :: this |
| 1129 |
integer(c_long), intent(in) :: nx, ny |
| 1130 |
real(c_double), intent(in) :: north, west, south, east |
| 1131 |
type(atlas_Projection), intent(in), optional :: projection |
| 1132 |
integer(c_int), intent(in), optional :: y_numbering |
| 1133 |
type(atlas_Config) :: config |
| 1134 |
|
| 1135 |
config = atlas_Config() |
| 1136 |
call config%set("type","regional") |
| 1137 |
call config%set("nx",nx) |
| 1138 |
call config%set("ny",ny) |
| 1139 |
call config%set("north",north) |
| 1140 |
call config%set("west",west) |
| 1141 |
call config%set("south",south) |
| 1142 |
call config%set("east",east) |
| 1143 |
if( present(projection) ) then |
| 1144 |
call config%set("projection",projection%spec()) |
| 1145 |
endif |
| 1146 |
if( present(y_numbering) ) then |
| 1147 |
call config%set("y_numbering",y_numbering) |
| 1148 |
endif |
| 1149 |
this = atlas_StructuredGrid(config) |
| 1150 |
call config%final() |
| 1151 |
call this%return() |
| 1152 |
end function |
| 1153 |
|
| 1154 |
|
| 1155 |
function atlas_RegionalGrid_ctor_increments_int32( nx, ny, dx, dy, xy_min, projection, y_numbering ) result(this) |
| 1156 |
use iso_c_binding, only : c_int, c_double |
| 1157 |
type(atlas_StructuredGrid) :: this |
| 1158 |
integer(c_int), intent(in) :: nx |
| 1159 |
integer(c_int), intent(in) :: ny |
| 1160 |
real(c_double), intent(in) :: xy_min(2) |
| 1161 |
real(c_double), intent(in) :: dx |
| 1162 |
real(c_double), intent(in) :: dy |
| 1163 |
type(atlas_Projection), intent(in), optional :: projection |
| 1164 |
integer(c_int), intent(in), optional :: y_numbering |
| 1165 |
|
| 1166 |
type(atlas_Config) :: config |
| 1167 |
|
| 1168 |
config = atlas_Config() |
| 1169 |
call config%set("type","regional") |
| 1170 |
call config%set("nx",nx) |
| 1171 |
call config%set("ny",ny) |
| 1172 |
call config%set("xmin",xy_min(1)) |
| 1173 |
call config%set("ymin",xy_min(2)) |
| 1174 |
call config%set("dx",dx) |
| 1175 |
call config%set("dy",dy) |
| 1176 |
if( present(projection) ) then |
| 1177 |
call config%set("projection",projection%spec()) |
| 1178 |
endif |
| 1179 |
if( present(y_numbering) ) then |
| 1180 |
call config%set("y_numbering",y_numbering) |
| 1181 |
endif |
| 1182 |
|
| 1183 |
this = atlas_StructuredGrid(config) |
| 1184 |
call config%final() |
| 1185 |
call this%return() |
| 1186 |
end function |
| 1187 |
|
| 1188 |
function atlas_RegionalGrid_ctor_increments_int64( nx, ny, dx, dy, xy_min, projection, y_numbering ) result(this) |
| 1189 |
use iso_c_binding, only : c_int, c_long, c_double |
| 1190 |
type(atlas_StructuredGrid) :: this |
| 1191 |
integer(c_long), intent(in) :: nx |
| 1192 |
integer(c_long), intent(in) :: ny |
| 1193 |
real(c_double), intent(in) :: xy_min(2) |
| 1194 |
real(c_double), intent(in) :: dx |
| 1195 |
real(c_double), intent(in) :: dy |
| 1196 |
type(atlas_Projection), intent(in), optional :: projection |
| 1197 |
integer(c_int), intent(in), optional :: y_numbering |
| 1198 |
|
| 1199 |
type(atlas_Config) :: config |
| 1200 |
|
| 1201 |
config = atlas_Config() |
| 1202 |
call config%set("type","regional") |
| 1203 |
call config%set("nx",nx) |
| 1204 |
call config%set("ny",ny) |
| 1205 |
call config%set("xmin",xy_min(1)) |
| 1206 |
call config%set("ymin",xy_min(2)) |
| 1207 |
call config%set("dx",dx) |
| 1208 |
call config%set("dy",dy) |
| 1209 |
if( present(projection) ) then |
| 1210 |
call config%set("projection",projection%spec()) |
| 1211 |
endif |
| 1212 |
if( present(y_numbering) ) then |
| 1213 |
call config%set("y_numbering",y_numbering) |
| 1214 |
endif |
| 1215 |
|
| 1216 |
this = atlas_StructuredGrid(config) |
| 1217 |
call config%final() |
| 1218 |
call this%return() |
| 1219 |
end function |
| 1220 |
|
| 1221 |
! ---------------------------------------------------------------------------------------- |
| 1222 |
|
| 1223 |
end module atlas_Grid_module |