THIS_IMAGE — Function that returns the cosubscript index of this image#
-
THIS_IMAGE(COARRAY, DIM)#
Returns the cosubscript for this image.
- Parameters:
DISTANCE – (optional, intent(in)) Nonnegative scalar integer (not permitted together with
COARRAY
).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 ofCOARRAY
.
- Returns:
Default integer. If
COARRAY
is not present, it is scalar; ifDISTANCE
is not present or has value 0, its value is the image index on the invoking image for the current team, for values smaller or equal distance to the initial team, it returns the image index on the ancestor team which has a distance ofDISTANCE
from the invoking team. IfDISTANCE
is larger than the distance to the initial team, the image index of the initial team is returned. Otherwise when theCOARRAY
is present, ifDIM
is not present, a rank-1 array with corank elements is returned, containing the cosubscripts forCOARRAY
specifying the invoking image. IfDIM
is present, a scalar is returned, with the value of theDIM
element ofTHIS_IMAGE(COARRAY)
.
- Standard:
Fortran 2008 and later. With
DISTANCE
argument, Technical Specification (TS) 18508 or later- Class:
Transformational function
- Syntax:
RESULT = THIS_IMAGE() RESULT = THIS_IMAGE(DISTANCE) RESULT = THIS_IMAGE(COARRAY [, DIM])
- 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 ! Check whether the current image is the initial image IF (THIS_IMAGE(HUGE(1)) /= THIS_IMAGE()) error stop "something is rotten here"
- See also:
NUM_IMAGES — Function that returns the number of images, IMAGE_INDEX — Function that converts a cosubscript to an image index