Skip to content

Commit

Permalink
Fortran: Use class(atlas_StructuredGrid) instead of type(atlas_Struct…
Browse files Browse the repository at this point in the history
…uredGrid)
  • Loading branch information
wdeconinck committed Jan 25, 2024
1 parent 18830bc commit 6095e01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions doc/example-fortran/structured-grid-stencils/program.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine run

use, intrinsic :: iso_fortran_env, only : real64, real32
use atlas_module, only : &
& atlas_StructuredGrid ,&
& atlas_ReducedGaussianGrid ,&
& atlas_functionspace_StructuredColumns ,&
& atlas_Field, &
& ATLAS_KIND_IDX, &
Expand All @@ -31,7 +31,7 @@ subroutine run
implicit none

character(len=:), allocatable :: gridname
type(atlas_StructuredGrid) :: grid
type(atlas_ReducedGaussianGrid) :: grid
type(atlas_functionspace_StructuredColumns) :: functionspace
real(real64) :: zlon, zlat
integer(ATLAS_KIND_IDX) :: jlon,jlat, jgp
Expand All @@ -48,7 +48,9 @@ subroutine run
gridname = "O320"

! Create grid and write some properties
grid = atlas_StructuredGrid(gridname)
!grid = atlas_StructuredGrid(gridname)
grid = atlas_ReducedGaussianGrid([20,24,28,32,36,40,44,48,52,56,60,64,&
64,60,56,52,48,44,40,36,32,28,24,20])

if (fckit_mpi%rank() == log_rank) then
write(0,*) "grid%name() : ", grid%name()
Expand Down
8 changes: 4 additions & 4 deletions src/atlas_f/grid/atlas_StencilComputer_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function atlas_StructuredGrid_ComputeNorth__ctor(grid, halo) result(this)
use atlas_grid_module, only : atlas_StructuredGrid
implicit none
type(atlas_StructuredGrid_ComputeNorth) :: this
type(atlas_StructuredGrid), intent(in) :: grid
class(atlas_StructuredGrid), intent(in) :: grid
integer(c_int), intent(in) :: halo
call this%reset_c_ptr( atlas__grid__ComputeNorth__new(grid%CPTR_PGIBUG_B, halo), &
& fckit_c_deleter(atlas__grid__ComputeNorth__delete) )
Expand All @@ -183,7 +183,7 @@ function atlas_StructuredGrid_ComputeWest__ctor(grid, halo) result(this)
use atlas_grid_module, only : atlas_StructuredGrid
implicit none
type(atlas_StructuredGrid_ComputeWest) :: this
type(atlas_StructuredGrid), intent(in) :: grid
class(atlas_StructuredGrid), intent(in) :: grid
integer(c_int), intent(in) :: halo
call this%reset_c_ptr( atlas__grid__ComputeWest__new(grid%CPTR_PGIBUG_B, halo), &
& fckit_c_deleter(atlas__grid__ComputeWest__delete) )
Expand All @@ -195,7 +195,7 @@ subroutine atlas_StructuredGrid_ComputeStencil__setup(this, grid, stencil_width)
use atlas_grid_module, only : atlas_StructuredGrid
implicit none
class(atlas_StructuredGrid_ComputeStencil) :: this
type(atlas_StructuredGrid), intent(in) :: grid
class(atlas_StructuredGrid), intent(in) :: grid
integer(ATLAS_KIND_IDX), intent(in) :: stencil_width
this%stencil_width = stencil_width
this%halo = (stencil_width + 1) / 2
Expand Down Expand Up @@ -309,7 +309,7 @@ function atlas_StructuredGrid_ComputeStencil__ctor(grid, stencil_width) result(t
use atlas_grid_module, only : atlas_StructuredGrid
implicit none
type(atlas_StructuredGrid_ComputeStencil) :: this
type(atlas_StructuredGrid), intent(in) :: grid
class(atlas_StructuredGrid), intent(in) :: grid
integer(ATLAS_KIND_IDX), intent(in) :: stencil_width
call this%setup(grid, stencil_width)
end function
Expand Down

0 comments on commit 6095e01

Please sign in to comment.