integer, parameter :: dp = selected_real_kind(p=15)
:
real(rp), dimension(:), allocatable :: x, y
:
npts = ...
:
allocate(x(npts), y(npts))
:
call print_vec (x, y, filename) ! stack overflow
:
subroutine print_vec (x, y, filename)
real(rp), dimension(:), intent(in) :: x, y
character(len=*), intent(in) :: filename
:
write (unt,fmt,iostat=ios) ( x(i), y(i), i=1, size(x) )
:
end subroutine print_vec
Thanks in advance,
Bernhard Enders.
The compiler you use ... well, which compiler are you using? On which
platform?
Regards,
Mike Metcalf
Bernhard.
Joost
Bernhard.
Joost
interface print_vec
module procedure print_1D
module procedure print_2D
end interface print_vec
And also that I'm using a beta version (9.1.015) of the Intel Fortran
Compiler for windows.
Bernhard.
> I don't know if it does matter, but one thing that I omitted was the
> interface to the procedure:
>
> interface print_vec
> module procedure print_1D
> module procedure print_2D
> end interface print_vec
This makes no sense.
1. This is *NOT* the interface to print_vec. This is a generic interface
block that does nothing but say that print_1D and print_2D are part of
the generic. I just finished chiding someone else about misuse of the
term "interface". An interface block is not the same thing as an
interface. To determine the interface to the specific procedures
print_1D and print_2D, one would have to look at theirt source code.
2. You show here an interface block for a generic print_vec, while in
the original post you had a specific subroutine print_vec. You can't
have both.... well not both accessible in the same place....
well...anyway not without some subtleties. Do you really have both? Or
were you just trying to describe what you thought was the essense. It is
pretty hard to help someone based on ooking at code that isn't actually
what they have, particularly when the odss seem high that they
misunderstand the problem and thus have left out the critical parts. I
suggest that you need to show the actual code, and much more of it.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
The above is a good example. You see 'interface' and 'print_vec', so it
is easy to think the phrase "interface to print_vec". Even experienced
programmers can do this. It leads to a lot of unintentional confusion.
So, remember: learning Fortran means learning both the Fortran language
syntax and the Fortran Standard language syntax. (I think that's a good
way to say it, or maybe I'm making a mistake on an even higher level of
syntax?)
Joe
I think it's more of a "people" thing than a Fortran thing. By that I mean people are
imprecise in everyday speech (usenet posts qualify? :o) that has nothing to do with
Fortran. The definitions for one language (spoken or programmed) may mean something
completely different in another.
cheers,
paulv
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC