Hello,
when a subroutine in a module (implicit interface) is written for a 2D array
module Mfoo
contains
subroutine foo(a,n1,n2)
real :: a(n1,n2)
....
end subroutine
it is still possible to call it with a 1D array, as if it was a 2D one with only 1 column:
real :: x(n)
...
call foo(x,n,1)
works OK
Now, if foo is an interface to several routines (say for single and double prec versions), it is no more possible:
module Mfoo
interface foo
module procedure sfoo, dfoo
end interface
contains
subroutine sfoo(a,n1,n2)
real :: a(n1,n2)
....
end subroutine
subroutine dfoo(a,n1,n2)
double precision :: a(n1,n2)
....
end subroutine
then
real :: x(n)
call foo(x,n,1)
results in a compilation error
Question: is there a solution without having to write separate versions for 1D arrays, 2D arrays, (3D arrays,....) ?
Regards,
Pierre
--
+-----------------------------------+----------------------------+
| Pierre Hugonnet | mail....CGG |
| | 1, rue Leon Migaux |
| R&D Data Processing | 91341 MASSY cedex |
| | FRANCE |
| COMPAGNIE GENERALE DE GEOPHYSIQUE | phone...(33) 164 47 45 59 |
| Paris Processing Centre | fax.....(33) 164 47 32 49 |
| http://www.cgg.com | [log in to unmask] |
+-----------------------------------+----------------------------+
My opinions are not necessarily those of CGG
--------------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|