ChangeTeam

Runs a block with a team as the current team.

Declaration

Syntax

ChangeTeam(expr team, expr? stat, expr? errmsg, stmt* body,
    expr? end_stat, expr? end_errmsg)

Arguments

Argument

Description

team

the team to switch to.

stat

a variable receiving the status on entry.

errmsg

a character variable receiving the error message on entry.

body

the statements executed with that team current.

end_stat

a variable receiving the status on exit.

end_errmsg

a character variable receiving the error message on exit.

Return values

None.

Description

Inside the block, image indices and coarray coindices are relative to the new team, and leaving the block synchronises its images. The construct has a status on entry and another on exit, because both the switch and the implied barrier at the end can fail.

Examples

(ChangeTeam
  :team (Var
    :v (SymbolRef 1 "team")
  )
  :stat nil
  :errmsg nil
  :body [
    (Assignment
      :target (Var
        :v (SymbolRef 1 "n")
      )
      :value (IntegerConstant
        :n 0
        :type (Integer
          :kind 4
        )
        :intboz_type :Decimal
      )
      :overloaded nil
      :realloc_lhs false
      :move_allocation false
    )
  ]
  :end_stat nil
  :end_errmsg nil
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "n" (Variable
              :parent_symtab 1
              :name "n"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "stat" (Variable
              :parent_symtab 1
              :name "stat"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
            "team" (Variable
              :parent_symtab 1
              :name "team"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Integer
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (SyncAll
            :stat (Var
              :v (SymbolRef 1 "stat")
            )
            :errmsg nil
          )
          (SyncImages
            :image_set (Var
              :v (SymbolRef 1 "n")
            )
            :stat (Var
              :v (SymbolRef 1 "stat")
            )
            :errmsg nil
          )
          (SyncMemory
            :stat (Var
              :v (SymbolRef 1 "stat")
            )
            :errmsg nil
          )
          (FormTeam
            :team_number (IntegerConstant
              :n 1
              :type (Integer
                :kind 4
              )
              :intboz_type :Decimal
            )
            :team (Var
              :v (SymbolRef 1 "team")
            )
            :new_index (Var
              :v (SymbolRef 1 "n")
            )
            :stat nil
            :errmsg nil
          )
          (SyncTeam
            :team (Var
              :v (SymbolRef 1 "team")
            )
            :stat (Var
              :v (SymbolRef 1 "stat")
            )
            :errmsg nil
          )
          (ChangeTeam
            :team (Var
              :v (SymbolRef 1 "team")
            )
            :stat nil
            :errmsg nil
            :body [
              (Assignment
                :target (Var
                  :v (SymbolRef 1 "n")
                )
                :value (IntegerConstant
                  :n 0
                  :type (Integer
                    :kind 4
                  )
                  :intboz_type :Decimal
                )
                :overloaded nil
                :realloc_lhs false
                :move_allocation false
              )
            ]
            :end_stat nil
            :end_errmsg nil
          )
        ]
      )
    }
  )
  :items []
)

See Also

FormTeam, SyncTeam