| 1 |
! (C) Copyright 2020 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_functionspace_PointCloud_module |
| 12 |
|
| 13 |
use fckit_c_interop_module, only : c_str, c_ptr_to_string, c_ptr_free |
| 14 |
use atlas_functionspace_module, only : atlas_FunctionSpace |
| 15 |
use atlas_Grid_module, only: atlas_Grid |
| 16 |
use atlas_Field_module, only: atlas_Field |
| 17 |
use atlas_FieldSet_module, only: atlas_FieldSet |
| 18 |
use atlas_kinds_module, only: ATLAS_KIND_GIDX |
| 19 |
|
| 20 |
implicit none |
| 21 |
|
| 22 |
private :: c_str, c_ptr_to_string, c_ptr_free |
| 23 |
private :: atlas_FunctionSpace |
| 24 |
private :: atlas_Field |
| 25 |
private :: atlas_FieldSet |
| 26 |
private :: atlas_Grid |
| 27 |
private :: ATLAS_KIND_GIDX |
| 28 |
|
| 29 |
public :: atlas_functionspace_PointCloud |
| 30 |
|
| 31 |
private |
| 32 |
|
| 33 |
!------------------------------------------------------------------------------ |
| 34 |
TYPE, extends(atlas_FunctionSpace) :: atlas_functionspace_PointCloud |
| 35 |
|
| 36 |
! Purpose : |
| 37 |
! ------- |
| 38 |
! *atlas_functionspace_PointCloud* : Interpretes point cloud fields |
| 39 |
|
| 40 |
! Methods : |
| 41 |
! ------- |
| 42 |
|
| 43 |
! Author : |
| 44 |
! ------ |
| 45 |
! March-2020 Benjamin Menetrier *IRIT-JCSDA* |
| 46 |
|
| 47 |
!------------------------------------------------------------------------------ |
| 48 |
contains |
| 49 |
|
| 50 |
procedure, public :: size => size_ |
| 51 |
procedure, public :: lonlat |
| 52 |
|
| 53 |
END TYPE atlas_functionspace_PointCloud |
| 54 |
|
| 55 |
interface atlas_functionspace_PointCloud |
| 56 |
module procedure ctor_cptr |
| 57 |
module procedure ctor_lonlat |
| 58 |
module procedure ctor_lonlat_ghost |
| 59 |
module procedure ctor_fieldset |
| 60 |
module procedure ctor_grid |
| 61 |
end interface |
| 62 |
|
| 63 |
!------------------------------------------------------------------------------ |
| 64 |
|
| 65 |
!======================================================== |
| 66 |
contains |
| 67 |
!======================================================== |
| 68 |
|
| 69 |
!------------------------------------------------------------------------------ |
| 70 |
|
| 71 |
function ctor_cptr(cptr) result(this) |
| 72 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 73 |
type(atlas_functionspace_PointCloud) :: this |
| 74 |
type(c_ptr), intent(in) :: cptr |
| 75 |
call this%reset_c_ptr( cptr ) |
| 76 |
call this%return() |
| 77 |
end function |
| 78 |
|
| 79 |
!------------------------------------------------------------------------------ |
| 80 |
|
| 81 |
function ctor_lonlat(lonlat) result(this) |
| 82 |
use atlas_functionspace_PointCloud_c_binding |
| 83 |
type(atlas_functionspace_PointCloud) :: this |
| 84 |
class(atlas_Field), intent(in) :: lonlat |
| 85 |
call this%reset_c_ptr( atlas__functionspace__PointCloud__new__lonlat( lonlat%CPTR_PGIBUG_A ) ) |
| 86 |
call this%return() |
| 87 |
end function |
| 88 |
|
| 89 |
!------------------------------------------------------------------------------ |
| 90 |
|
| 91 |
function ctor_lonlat_ghost(lonlat,ghost) result(this) |
| 92 |
use atlas_functionspace_PointCloud_c_binding |
| 93 |
type(atlas_functionspace_PointCloud) :: this |
| 94 |
class(atlas_Field), intent(in) :: lonlat |
| 95 |
class(atlas_Field), intent(in) :: ghost |
| 96 |
call this%reset_c_ptr( atlas__functionspace__PointCloud__new__lonlat_ghost( lonlat%CPTR_PGIBUG_A, ghost%CPTR_PGIBUG_A ) ) |
| 97 |
call this%return() |
| 98 |
end function |
| 99 |
|
| 100 |
!------------------------------------------------------------------------------ |
| 101 |
|
| 102 |
function ctor_fieldset(fset) result(this) |
| 103 |
use atlas_functionspace_PointCloud_c_binding |
| 104 |
type(atlas_functionspace_PointCloud) :: this |
| 105 |
class(atlas_FieldSet), intent(in) :: fset |
| 106 |
call this%reset_c_ptr( atlas__functionspace__PointCloud__new__fieldset( fset%CPTR_PGIBUG_A ) ) |
| 107 |
call this%return() |
| 108 |
end function |
| 109 |
|
| 110 |
!------------------------------------------------------------------------------ |
| 111 |
|
| 112 |
function ctor_grid(grid) result(this) |
| 113 |
use atlas_functionspace_PointCloud_c_binding |
| 114 |
type(atlas_functionspace_PointCloud) :: this |
| 115 |
class(atlas_Grid), intent(in) :: grid |
| 116 |
call this%reset_c_ptr( atlas__functionspace__PointCloud__new__grid( grid%CPTR_PGIBUG_A ) ) |
| 117 |
call this%return() |
| 118 |
end function |
| 119 |
|
| 120 |
!------------------------------------------------------------------------------ |
| 121 |
|
| 122 |
function size_(this) |
| 123 |
use atlas_functionspace_PointCloud_c_binding |
| 124 |
integer :: size_ |
| 125 |
class(atlas_functionspace_PointCloud), intent(in) :: this |
| 126 |
size_ = atlas__fs__PointCloud__size(this%CPTR_PGIBUG_A) |
| 127 |
end function |
| 128 |
|
| 129 |
!------------------------------------------------------------------------------ |
| 130 |
|
| 131 |
function lonlat(this) result(field) |
| 132 |
use atlas_functionspace_PointCloud_c_binding |
| 133 |
type(atlas_Field) :: field |
| 134 |
class(atlas_functionspace_PointCloud), intent(in) :: this |
| 135 |
field = atlas_Field( atlas__fs__PointCloud__lonlat(this%CPTR_PGIBUG_A) ) |
| 136 |
call field%return() |
| 137 |
end function |
| 138 |
|
| 139 |
!------------------------------------------------------------------------------- |
| 140 |
|
| 141 |
#if FCKIT_FINAL_NOT_INHERITING |
| 142 |
ATLAS_FINAL subroutine atlas_functionspace_PointCloud__final_auto(this) |
| 143 |
type(atlas_functionspace_PointCloud), intent(inout) :: this |
| 144 |
#if FCKIT_FINAL_DEBUGGING |
| 145 |
write(0,*) "atlas_functionspace_PointCloud__final_auto" |
| 146 |
#endif |
| 147 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 148 |
call this%final() |
| 149 |
#endif |
| 150 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 151 |
end subroutine |
| 152 |
#endif |
| 153 |
|
| 154 |
!------------------------------------------------------------------------------ |
| 155 |
|
| 156 |
end module atlas_functionspace_PointCloud_module |