Next:
Constraints Up: Elemental Reference of Previous: Elemental Reference of


Elemental Reference of Pure Subroutines

A user-defined pure subroutine may be referenced elementally, provided it satisfies the additional constraints that:

  1. Its dummy arguments (except procedure dummy arguments) are scalar and do not have the POINTER attribute.
  2. The length of any character dummy argument is independent of argument values (though it may be assumed, or depend on the lengths of other character arguments).
  3. None of the dummy arguments allow alternate return specifiers.

We call user-written pure subroutines that satisfy these constraints ``elemental non-intrinsic subroutines'', and use the term ``elemental subroutine'' to include both elemental intrinsic and non-intrinsic subroutines.

The interpretation of an elemental reference of such a subroutine is as follows (adapted from Section 12.4.5 of the Fortran 90 standard):

A reference to an elemental subroutine is an elemental reference if all actual arguments corresponding to INTENT(OUT) and INTENT(INOUT) dummy arguments are arrays that have the same shape and the remaining actual arguments (except procedure dummy arguments) are conformable with them. If any actual argument is a function, its result must have the same shape as that of the corresponding function dummy procedure.

The values of the elements of the arrays that correspond to INTENT(OUT) and INTENT(INOUT) dummy arguments are the same as if the subroutine were invoked separately, in any order, using the scalar and procedure arguments and corresponding elements of the array arguments.

Example: INTERFACE ELEMENTAL SUBROUTINE solve_simul(tol, y, z) REAL, INTENT(IN) :: tol REAL, INTENT(INOUT) :: y, z END SUBROUTINE END INTERFACE

REAL a(100), b(100), c(100)

CALL solve_simul( 0.1, a, b ) CALL solve_simul( c(10:100:10), a(1:10), b(1:10) )

paula@erc.msstate.edu
Thu May 5 15:11:02 CDT 1994