- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have a problem using optional parameters in a function. i allways get the error #7836 (if the actual element is scalar, the corresponding dummy argument shall be scalar....)
the function's code is a follows:
FUNCTION get_wgprop_fn(this, wgcf, wgct, t)
IMPLICIT NONE
CLASS(tprop) :: this
REAL, DIMENSION(5) :: get_wgprop_fn
REAL, DIMENSION(4), INTENT(IN), OPTIONAL :: wgcf
REAL,DIMENSION(3), INTENT(IN), OPTIONAL :: wgct
REAL, INTENT(IN), OPTIONAL :: t
IF (PRESENT(wgcf)) THEN
get_wgprop_fn = 1
END IF
IF (PRESENT(wgct)) THEN
get_wgprop_fn = 2
END IF
IF (PRESENT(t)) THEN
wgprop_fn = wgprop_fn * 2
END IF
END FUNCTION get_wgprop_fn
calling the function from extern like
test = get_wgprop(ac) with ac as a real dimension(4) array results in no error.
but
t = get_wgprop(ac, t) with ac as defined above and t as real result in the error described a the top of this topic.
perhaps somebody sees the mistake in my code? i think, the optional-keyword says that a dummy-argments
must no be present? in the second case (get_wgprop(ac, t) the compiler searches for a dimension(3)-array what in my understanding cant be because of the optional argument???
greetings moritz
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
t = get_wgprop(ac,T=t)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page