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