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
DIMpresent, required).DIM – default integer scalar (optional). If present,
DIMshall be between one and the corank ofCOARRAY.
- Returns:
Default integer. If
COARRAYis not present, it is scalar; ifDISTANCEis 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 ofDISTANCEfrom the invoking team. IfDISTANCEis larger than the distance to the initial team, the image index of the initial team is returned. Otherwise when theCOARRAYis present, ifDIMis not present, a rank-1 array with corank elements is returned, containing the cosubscripts forCOARRAYspecifying the invoking image. IfDIMis present, a scalar is returned, with the value of theDIMelement ofTHIS_IMAGE(COARRAY).
- Standard:
Fortran 2008 and later. With
DISTANCEargument, 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