2 ! { dg-options "-fcoarray=single -g" }
4 ! Test the fix for PR96737 in which the 'TYPE_CANONICAL' was not campatible
7 ! Contributed by Andre Vehreschild <vehre@gcc.gnu.org>
9 module surface_packages
13 integer, allocatable
:: normals(:,:)
18 type(flux_planes
), allocatable
:: surface_fluxes(:)
19 integer, allocatable
:: positions(:,:,:,:)
23 type(package
), allocatable
:: halo_outbox(:,:,:)
25 procedure
, nopass
:: set_halo_outbox
26 procedure
, nopass
:: get_surface_normal_spacing
29 type problem_discretization
30 type(surfaces
) block_surfaces
34 module subroutine set_halo_outbox(my_halo_outbox
)
36 type(package
), intent(in
) :: my_halo_outbox(:,:,:)
39 module subroutine get_surface_normal_spacing
45 submodule(surface_packages
) implementation
47 type(surfaces
), save :: singleton
[*]
50 module procedure get_surface_normal_spacing
54 associate( positions
=> reshape(i
*[5,4,3,2], [2,1,1,2]), normals
=> reshape(i
*[6,6,6], [3,1]) )
55 do b
=1,size(singleton
[i
]%halo_outbox
,1)
56 do d
=1,size(singleton
[i
]%halo_outbox
,2)
57 do f
=1,size(singleton
[i
]%halo_outbox
,3)
58 if ( .not
. all([singleton
[i
]%halo_outbox(b
,d
,f
)%positions
== positions
]) ) error
stop "positions"
59 if ( .not
. all([singleton
[i
]%halo_outbox(b
,d
,f
)%surface_fluxes(1)%normals
== normals
] ) ) error
stop "normals"
67 module procedure set_halo_outbox
68 singleton
%halo_outbox
= my_halo_outbox
75 use surface_packages
, only
: problem_discretization
, package
77 type(problem_discretization
) global_grid
78 type(package
), allocatable
:: bare(:,:,:)
81 associate( me
=>this_image() )
83 allocate( bare(me
,3,2) )
89 bare(i
,j
,k
)%positions
= reshape(me
*[5,4,3,2], [2,1,1,2])
90 allocate( bare(i
,j
,k
)%surface_fluxes(1) )
91 bare(i
,j
,k
)%surface_fluxes(1)%normals
= reshape(me
*[6,6,6], [3,1])
96 call global_grid
%block_surfaces
%set_halo_outbox(bare
)
97 call global_grid
%block_surfaces
%get_surface_normal_spacing
102 if (this_image()==1) print *,"Test passed"