@@ -36,7 +36,9 @@ program main
36
36
37
37
integer , parameter :: standard_initial_value=- 1
38
38
39
- type (team_type), target :: home
39
+ type (team_type) :: parent, child
40
+
41
+ if (num_images() < 8 ) error stop " I need at least 8 images to function."
40
42
41
43
call assert(team_number()==standard_initial_value," initial team number conforms with Fortran standard before 'change team'" )
42
44
@@ -46,11 +48,17 @@ program main
46
48
! ! TODO: uncomment the above assertion after implementing support for team_number's optional argument:
47
49
48
50
after_change_team: block
49
- associate(my_team = > mod (this_image(), 2 ) + 1 )
51
+ associate(parent_team_number = > 100 + (num_images() - 1 ) / 4 , child_team_number = > 1000 + mod (num_images() - 1 , 4 ) / 2 )
50
52
! ! Prepare for forming two teams: my_team = 1 for even image numbers in the initial team; 2 for odd image numbers
51
- form team(my_team,home)
52
- change team(home)
53
- call assert(team_number()==my_team," team number conforms with Fortran standard after 'change team'" )
53
+ form team(parent_team_number,parent)
54
+ change team(parent)
55
+ call assert(team_number()==parent_team_number," team number conforms with Fortran standard after 'change team'" )
56
+ form team (child_team_number, child)
57
+ change team(child)
58
+ call assert(team_number()==child_team_number," team number conforms with Fortran standard after 'change team'" )
59
+ call assert(team_number(child)==child_team_number," team_number(child) conforms with Fortran standard after 'change team'" )
60
+ call assert(team_number(parent)==parent_team_number," team_number(parent) conforms with Fortran standard" )
61
+ end team
54
62
end team
55
63
call assert(team_number()==standard_initial_value," initial team number conforms with Fortran standard" )
56
64
end associate
0 commit comments