Commit 98f9144a authored by Budiardja, Reuben's avatar Budiardja, Reuben
Browse files

Added Assumed-rank simple test.

parent 79d724bf
module AR_M
use iso_fortran_env
use iso_c_binding
implicit none
contains
subroutine AddOne ( A )
real ( real64 ), dimension ( .. ), intent ( inout ), target :: &
A
print*, '--------------------------------------------'
print*, 'Rank of A:', rank ( A )
print*, 'Size of A:', size ( A )
print*, 'C_loc ( A )', c_loc ( A )
print*, 'C_sizeof ( A )', c_sizeof ( A )
select rank ( A )
rank ( 0 )
A = A + 0.5
print*, 'A is', A
rank ( 1 )
A = A + 1.0
print*, 'A ( 1 : 3 ) is', A ( 1 : 3 )
rank ( 2 )
A = A + 2.0
print*, 'A ( 1 : 3, 1 : 3 ) is', A ( 1 : 3, 1 : 3 )
rank default
print*, 'Rank ', rank ( A ), 'is not implemented.'
end select
print*, '--------------------------------------------'
print*
end subroutine AddOne
end module AR_M
program AR_T
use AR_M
implicit none
real ( real64 ), allocatable :: &
A_0D
real ( real64 ), dimension ( : ), allocatable :: &
A_1D
real ( real64 ), dimension ( :, : ), allocatable :: &
A_2D
real ( real64 ), dimension ( :, :, : ), allocatable :: &
A_3D
real ( real64 ), dimension ( :, :, :, : ), allocatable :: &
A_4D
allocate ( A_0D, A_1D ( 10 ), A_2D ( 10, 10 ), A_3D ( 10, 10, 10 ), &
A_4D ( 10, 10, 10, 10 ) )
A_0D = 100.0
A_1D = 100.0
A_2D = 100.0
A_3D = 100.0
A_4D = 100.0
call AddOne ( A_0D )
call AddOne ( A_1D )
call AddOne ( A_2D )
call AddOne ( A_3D )
call AddOne ( A_4D )
end program AR_T
Markdown is supported
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