Skip to content

Commit 3aeae4f

Browse files
author
Damian Rouson
committed
white space edits
1 parent 15d1446 commit 3aeae4f

File tree

2 files changed

+103
-103
lines changed

2 files changed

+103
-103
lines changed

src/tests/unit/collectives/co_broadcast_allocatable_components.f90

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ function f(x) result(y)
1313
end function
1414
end interface
1515

16-
type dynamic
17-
character(len=:), allocatable :: string
18-
character(len=len(text)), allocatable :: string_array(:)
19-
complex, allocatable :: scalar
20-
integer, allocatable :: vector(:)
21-
logical, allocatable :: matrix(:,:)
22-
real, allocatable :: superstring(:,:,:, :,:,:, :,:,:, :,:,:, :,:,: )
23-
end type
16+
type dynamic
17+
character(len=:), allocatable :: string
18+
character(len=len(text)), allocatable :: string_array(:)
19+
complex, allocatable :: scalar
20+
integer, allocatable :: vector(:)
21+
logical, allocatable :: matrix(:,:)
22+
real, allocatable :: superstring(:,:,:, :,:,:, :,:,:, :,:,:, :,:,: )
23+
end type
2424

25-
type(dynamic) alloc_message, alloc_content
25+
type(dynamic) alloc_message, alloc_content
2626

2727
associate(me=>this_image())
2828

29-
alloc_content = dynamic( &
30-
string=text, &
31-
string_array=[text], &
32-
scalar=(0.,1.), &
33-
vector=reshape( [integer::], [0]), &
34-
matrix=reshape( [.true.], [1,1]), &
35-
superstring=reshape([1,2,3,4], [2,1,2, 1,1,1, 1,1,1, 1,1,1, 1,1,1 ]) &
36-
)
29+
alloc_content = dynamic( &
30+
string=text, &
31+
string_array=[text], &
32+
scalar=(0.,1.), &
33+
vector=reshape( [integer::], [0]), &
34+
matrix=reshape( [.true.], [1,1]), &
35+
superstring=reshape([1,2,3,4], [2,1,2, 1,1,1, 1,1,1, 1,1,1, 1,1,1 ]) &
36+
)
3737

38-
if (me==sender) alloc_message = alloc_content
38+
if (me==sender) alloc_message = alloc_content
3939

40-
call co_broadcast(alloc_message,source_image=sender)
40+
call co_broadcast(alloc_message,source_image=sender)
4141

42-
associate( failures => [ &
43-
alloc_message%string /= alloc_content%string, &
44-
alloc_message%string_array /= alloc_content%string_array, &
45-
alloc_message%scalar /= alloc_content%scalar, &
46-
alloc_message%vector /= alloc_content%vector, &
47-
alloc_message%matrix .neqv. alloc_content%matrix, &
48-
alloc_message%superstring /= alloc_content%superstring &
49-
] )
42+
associate( failures => [ &
43+
alloc_message%string /= alloc_content%string, &
44+
alloc_message%string_array /= alloc_content%string_array, &
45+
alloc_message%scalar /= alloc_content%scalar, &
46+
alloc_message%vector /= alloc_content%vector, &
47+
alloc_message%matrix .neqv. alloc_content%matrix, &
48+
alloc_message%superstring /= alloc_content%superstring &
49+
] )
5050

51-
if ( any(failures) ) error stop "Test failed."
51+
if ( any(failures) ) error stop "Test failed."
5252

53-
end associate
53+
end associate
5454

5555
sync all ! Wait for each image to pass the test
5656
if (me==sender) print *,"Test passed."

src/tests/unit/collectives/co_broadcast_derived_type.f90

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -13,83 +13,83 @@ function f(x) result(y)
1313
end function
1414
end interface
1515

16-
type parent
17-
integer :: heritable=0
18-
end type
19-
20-
type component
21-
integer :: subcomponent=0
22-
end type
23-
24-
type, extends(parent) :: child
25-
26-
! Scalar and array derived-type components
27-
type(component) a, b(1,2,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1)
28-
29-
! Scalar and array intrinsic-type components
30-
character(len=len(text)) :: c="", z(0)
31-
complex :: i=(0.,0.), j(1)=(0.,0.)
32-
integer :: k=0, l(2,3)=0
33-
logical :: r=.false., s(1,2,3, 1,2,3, 1,2,3, 1,2,3, 1,2,3)=.false.
34-
real :: t=0., u(3,2,1)=0.
35-
36-
! Scalar and array pointer components
37-
character(len=len(text)), pointer :: &
38-
char_ptr=>null(), char_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
39-
complex, pointer :: cplx_ptr=>null(), cplx_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
40-
integer, pointer :: int_ptr =>null(), int_ptr_maxdim (:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
41-
logical, pointer :: bool_ptr=>null(), bool_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
42-
real, pointer :: real_ptr=>null(), real_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
43-
procedure(f), pointer :: procedure_pointer=>null()
44-
end type
45-
46-
type(child) message
47-
type(child) :: content = child( & ! define content using the insrinsic structure constructor
48-
parent=parent(heritable=-4), & ! parent
49-
a=component(-3), b=reshape([component(-2),component(-1)], [1,2,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1]), & ! derived types
50-
c=text, z=[character(len=len(text))::], i=(0.,1.), j=(2.,3.), k=4, l=5, r=.true., s=.true., t=7., u=8. & ! intrinsic types
51-
)
16+
type parent
17+
integer :: heritable=0
18+
end type
19+
20+
type component
21+
integer :: subcomponent=0
22+
end type
23+
24+
type, extends(parent) :: child
25+
26+
! Scalar and array derived-type components
27+
type(component) a, b(1,2,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1)
28+
29+
! Scalar and array intrinsic-type components
30+
character(len=len(text)) :: c="", z(0)
31+
complex :: i=(0.,0.), j(1)=(0.,0.)
32+
integer :: k=0, l(2,3)=0
33+
logical :: r=.false., s(1,2,3, 1,2,3, 1,2,3, 1,2,3, 1,2,3)=.false.
34+
real :: t=0., u(3,2,1)=0.
35+
36+
! Scalar and array pointer components
37+
character(len=len(text)), pointer :: &
38+
char_ptr=>null(), char_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
39+
complex, pointer :: cplx_ptr=>null(), cplx_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
40+
integer, pointer :: int_ptr =>null(), int_ptr_maxdim (:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
41+
logical, pointer :: bool_ptr=>null(), bool_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
42+
real, pointer :: real_ptr=>null(), real_ptr_maxdim(:,:,:, :,:,:, :,:,:, :,:,:, :,:,:)=>null()
43+
procedure(f), pointer :: procedure_pointer=>null()
44+
end type
45+
46+
type(child) message
47+
type(child) :: content = child( & ! define content using the insrinsic structure constructor
48+
parent=parent(heritable=-4), & ! parent
49+
a=component(-3), b=reshape([component(-2),component(-1)], [1,2,1, 1,1,1, 1,1,1, 1,1,1, 1,1,1]), & ! derived types
50+
c=text, z=[character(len=len(text))::], i=(0.,1.), j=(2.,3.), k=4, l=5, r=.true., s=.true., t=7., u=8. & ! intrinsic types
51+
)
5252

5353
associate(me=>this_image())
5454

55-
if (me==sender) then
56-
message = content
57-
allocate(message%char_ptr, message%char_ptr_maxdim(1,1,2, 1,1,1, 1,1,1, 1,1,1, 1,1,1), source=text )
58-
allocate(message%cplx_ptr, message%cplx_ptr_maxdim(1,1,1, 1,1,2, 1,1,1, 1,1,1, 1,1,1), source=(0.,1.))
59-
allocate(message%int_ptr , message%int_ptr_maxdim (1,1,1, 1,1,1, 1,1,2, 1,1,1, 1,1,1), source=2 )
60-
allocate(message%bool_ptr, message%bool_ptr_maxdim(1,1,1, 1,2,1, 1,1,1, 1,1,2, 1,1,1), source=.true. )
61-
allocate(message%real_ptr, message%real_ptr_maxdim(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1,2), source=3. )
62-
end if
63-
64-
call co_broadcast(message,source_image=sender)
65-
66-
if (me==sender) then
67-
deallocate(message%char_ptr, message%char_ptr_maxdim)
68-
deallocate(message%cplx_ptr, message%cplx_ptr_maxdim)
69-
deallocate(message%int_ptr , message%int_ptr_maxdim )
70-
deallocate(message%bool_ptr, message%bool_ptr_maxdim)
71-
deallocate(message%real_ptr, message%real_ptr_maxdim)
72-
end if
73-
74-
!! Verify correct broadcast of all non-pointer components (pointers become undefined on the receiving image).
75-
associate( failures => [ &
76-
message%parent%heritable /= content%parent%heritable, &
77-
message%a%subcomponent /= content%a%subcomponent, &
78-
message%c /= content%c, &
79-
message%z /= content%z, &
80-
message%i /= content%i, &
81-
message%j /= content%j, &
82-
message%k /= content%k, &
83-
message%l /= content%l, &
84-
message%r .neqv. content%r, &
85-
message%s .neqv. content%s, &
86-
message%t /= content%t, &
87-
any( message%u /= content%u ) &
88-
] )
89-
90-
if ( any(failures) ) error stop "Test failed. "
91-
92-
end associate
55+
if (me==sender) then
56+
message = content
57+
allocate(message%char_ptr, message%char_ptr_maxdim(1,1,2, 1,1,1, 1,1,1, 1,1,1, 1,1,1), source=text )
58+
allocate(message%cplx_ptr, message%cplx_ptr_maxdim(1,1,1, 1,1,2, 1,1,1, 1,1,1, 1,1,1), source=(0.,1.))
59+
allocate(message%int_ptr , message%int_ptr_maxdim (1,1,1, 1,1,1, 1,1,2, 1,1,1, 1,1,1), source=2 )
60+
allocate(message%bool_ptr, message%bool_ptr_maxdim(1,1,1, 1,2,1, 1,1,1, 1,1,2, 1,1,1), source=.true. )
61+
allocate(message%real_ptr, message%real_ptr_maxdim(1,1,1, 1,1,1, 1,1,1, 1,1,1, 1,1,2), source=3. )
62+
end if
63+
64+
call co_broadcast(message,source_image=sender)
65+
66+
if (me==sender) then
67+
deallocate(message%char_ptr, message%char_ptr_maxdim)
68+
deallocate(message%cplx_ptr, message%cplx_ptr_maxdim)
69+
deallocate(message%int_ptr , message%int_ptr_maxdim )
70+
deallocate(message%bool_ptr, message%bool_ptr_maxdim)
71+
deallocate(message%real_ptr, message%real_ptr_maxdim)
72+
end if
73+
74+
!! Verify correct broadcast of all non-pointer components (pointers become undefined on the receiving image).
75+
associate( failures => [ &
76+
message%parent%heritable /= content%parent%heritable, &
77+
message%a%subcomponent /= content%a%subcomponent, &
78+
message%c /= content%c, &
79+
message%z /= content%z, &
80+
message%i /= content%i, &
81+
message%j /= content%j, &
82+
message%k /= content%k, &
83+
message%l /= content%l, &
84+
message%r .neqv. content%r, &
85+
message%s .neqv. content%s, &
86+
message%t /= content%t, &
87+
any( message%u /= content%u ) &
88+
] )
89+
90+
if ( any(failures) ) error stop "Test failed. "
91+
92+
end associate
9393

9494
sync all ! Wait for each image to pass the test
9595
if (me==sender) print *,"Test passed."

0 commit comments

Comments
 (0)