Commit 2c72d49b authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

New test case for issue found in CCE regarding Pointer remapped gets the wrong index in submodule.

parent 0c541bde
submodule ( ApplyBoundaryModule ) ApplyBoundary_Kernel
implicit none
contains
module procedure ApplyBoundaryKernelSubmodule
integer ( KDI ) :: &
iV, jV, kV
print*, '====================================='
print*, 'In subroutine submodule'
print*, 'V_3D lbound', lbound ( V_3D )
print*, 'V_3D ubound', ubound ( V_3D )
print*, 'V_3D', V_3D
do kV = lbound ( V_3D, dim = 3 ), ubound ( V_3D, dim = 3 )
do jV = lbound ( V_3D, dim = 2 ), ubound ( V_3D, dim = 2 )
do iV = lbound ( V_3D, dim = 1 ), ubound ( V_3D, dim = 1 )
print '(3i3, es15.6e3)', iV, jV, kV, V_3D ( iV, jV, kV )
!-- The following should be out-of-bound in this scope
! but surprisingly is getting the right value
!print '(3i3, es15.6e3)', iV-4, jV, kV, V_3D ( iV-4, jV, kV )
end do
end do
end do
print*, 'End subroutine submodule'
print*, '====================================='
print*
end procedure ApplyBoundaryKernelSubmodule
end submodule ApplyBoundary_Kernel
\ No newline at end of file
module ApplyBoundaryModule
implicit none
integer, public, parameter :: &
KDR = kind ( 1.0d0 ), &
KDI = kind ( 1 )
public :: &
ApplyBoundaryKernel, &
ApplyBoundaryKernelSubmodule
interface
module subroutine ApplyBoundaryKernelSubmodule ( V_3D )
real ( KDR ), dimension ( :, :, : ), intent ( in ) :: &
V_3D
end subroutine ApplyBoundaryKernelSubmodule
end interface
contains
subroutine ApplyBoundaryKernel ( V_3D )
real ( KDR ), dimension ( :, :, : ), intent ( in ) :: &
V_3D
integer ( KDI ) :: &
iV, jV, kV
print*, '====================================='
print*, 'In subroutine module'
print*, 'V_3D lbound', lbound ( V_3D )
print*, 'V_3D ubound', ubound ( V_3D )
print*, 'V_3D', V_3D
do kV = lbound ( V_3D, dim = 3 ), ubound ( V_3D, dim = 3 )
do jV = lbound ( V_3D, dim = 2 ), ubound ( V_3D, dim = 2 )
do iV = lbound ( V_3D, dim = 1 ), ubound ( V_3D, dim = 1 )
print '(3i3, es15.6e3)', iV, jV, kV, V_3D ( iV, jV, kV )
end do
end do
end do
print*, 'End subroutine module'
print*, '====================================='
print*
end subroutine ApplyBoundaryKernel
end module ApplyBoundaryModule
program ApplyBoundaryTest
use ApplyBoundaryModule
implicit none
integer ( KDI ) :: &
iV, jV, kV
real ( KDR ), dimension ( :, : ), allocatable, target :: &
Value
real ( KDR ), dimension ( :, :, : ), pointer :: &
V_3D
allocate ( Value ( 8, 2 ) )
do iV = 1, size ( Value, dim = 1 )
Value ( iV, 1 ) = iV
Value ( iV, 2 ) = - huge ( 1.0 )
end do
V_3D ( -3 : 4, 1 : 1, 1 : 1 ) => Value ( :, 1 )
print*, 'V_3D In main program:', V_3D
print*, 'V_3D lbound', lbound ( V_3D )
print*, 'V_3D ubound', ubound ( V_3D )
print*, 'V_3D', V_3D
do kV = lbound ( V_3D, dim = 3 ), ubound ( V_3D, dim = 3 )
do jV = lbound ( V_3D, dim = 2 ), ubound ( V_3D, dim = 2 )
do iV = lbound ( V_3D, dim = 1 ), ubound ( V_3D, dim = 1 )
print '(3i3, es15.6e3)', iV, jV, kV, V_3D ( iV, jV, kV )
end do
end do
end do
call ApplyBoundaryKernel ( V_3D )
call ApplyBoundaryKernelSubmodule ( V_3D )
end program ApplyBoundaryTest
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment