Next: Constraints Up: Elemental Reference of Previous: Elemental Reference of
A user-defined pure subroutine may be referenced elementally, provided it satisfies the additional constraints that:
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) )