8.242 THIS_IMAGE — Function that returns the cosubscript index of this image

Description:
Returns the cosubscript for this image.
Standard:
Fortran 2008 and later
Class:
Transformational function
Syntax:
RESULT = THIS_IMAGE()
RESULT = THIS_IMAGE(COARRAY [, DIM])
Arguments:
COARRAY Coarray of any type (optional; if DIM present, required).
DIM default integer scalar (optional). If present, DIM shall be between one and the corank of COARRAY.
Return value:
Default integer. If COARRAY is not present, it is scalar and its value is the index of the invoking image. Otherwise, if DIM is not present, a rank-1 array with corank elements is returned, containing the cosubscripts for COARRAY specifying the invoking image. If DIM is present, a scalar is returned, with the value of the DIM element of THIS_IMAGE(COARRAY).
Example:
INTEGER :: value[*]
INTEGER :: i
value = THIS_IMAGE()
SYNC ALL
IF (THIS_IMAGE() == 1) THEN
  DO i = 1, NUM_IMAGES()
    WRITE(*,'(2(a,i0))') 'value[', i, '] is ', value[i]
  END DO
END IF
See also:
NUM_IMAGES, IMAGE_INDEX

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/THIS_005fIMAGE.html