Question about interfaces and structs
From: Sandra Barsky (s.barsky_at_ucl.ac.uk)
Date: 10/27/04
- Previous message: James Giles: "Re: Inlining functions using *CONTAINS* statement"
- Next in thread: Richard E Maine: "Re: Question about interfaces and structs"
- Reply: Richard E Maine: "Re: Question about interfaces and structs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 23:17:55 +0100
Hi f9x experts,
I am trying to write a module which will use one of a number of
subroutines depending on the dimensionality of the passed variables.
Example:
-------------------------------------------
module foo
interface calculation
module procedure scalar,vector,matrix
end interface calculation
contains
subroutine scalar(s)
end ...
subroutine vector(v)
end ...
subroutine matrix(m)
end ...
end module foo
--------------------------------------------
the calling program would look like
--------------------------------------------
real :: s, v(10),m(10,10)
calculation(s)
calculation(v)
calculation(m)
---------------------------------------------
The above works fine, as sketched. My problem is when I try to write
something similar with an array of structs.
eg, if instead of real variables I have structs (with appropriate changes
in the module) I get the following message in
g95:
Generic subroutine 'calculation' at (1) is not an intrinsic subroutine
and intel fortran:
There is no matching specific subroutine for this generic subroutine call.
[calculation].
Is this somehow built into the spec of the language? Any ideas for
work-arounds for this?
Cheers & TIA
Sandy
- Previous message: James Giles: "Re: Inlining functions using *CONTAINS* statement"
- Next in thread: Richard E Maine: "Re: Question about interfaces and structs"
- Reply: Richard E Maine: "Re: Question about interfaces and structs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|