@@ -36,7 +36,9 @@ program main
3636
3737 integer , parameter :: standard_initial_value=- 1
3838
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."
4042
4143 call assert(team_number()==standard_initial_value," initial team number conforms with Fortran standard before 'change team'" )
4244
@@ -46,11 +48,17 @@ program main
4648 ! ! TODO: uncomment the above assertion after implementing support for team_number's optional argument:
4749
4850 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 )
5052 ! ! 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
5462 end team
5563 call assert(team_number()==standard_initial_value," initial team number conforms with Fortran standard" )
5664 end associate
0 commit comments