GET_TEAM (The GNU Fortran Compiler)

### 8.136 `GET_TEAM` — Get the handle of a team ¶

Synopsis:

  `RESULT = GET_TEAM([LEVEL])`

Description:

  Returns the handle of the current team, if LEVEL is not given. Or the team specified by LEVEL, where LEVEL is one of the constants `INITIAL_TEAM`, `PARENT_TEAM` or `CURRENT_TEAM` from the intrinsic module `ISO_FORTRAN_ENV`. Calling the function with `PARENT_TEAM` while being on the initial team, returns a handle to the initial team. This ensures that always a valid team is returned, given that team handles can neither be checked for validity nor compared with each other or null.

Class:

  Transformational function

Return value:

  An opaque handle of `TEAM_TYPE` from the intrinsic module `ISO_FORTRAN_ENV`.

Example:

      program info
        use, intrinsic :: iso_fortran_env
        type(team_type) :: init, curr, par, nt

        init = get_team()
        curr = get_team(current_team) ! init equals curr here
        form team(1, nt)
        change team(nt)
          curr = get_team() ! or get_team(current_team)
          par = get_team(parent_team) ! par equals init here
        end team
      end program info

Standard:

  Fortran 2018 or later

See also:

  `THIS_IMAGE` — Function that returns the cosubscript index of this image,
  `ISO_FORTRAN_ENV`