|
|
Up |
|
|
  |
Author: rudrarudra
Date: May 22, 2008 22:57
dera friends,
i have a module containning a subroutine:
module mrdf
use kinds, only : DP
contains
subroutine crdf(filrdf,x,y,z,boxl, &
ntot,nap,rrl,gr, &
rmin,refgr_sm)
.....
......
open(16,file=filrdf,status='replace')
.....
......
where filerdf is name of a file. now i call this subroutine in another
subroutine twice with different variable for filrdf. but its not
working.
can I do that?
|
| |
|
| |
7 Comments |
|
  |
Author: Daniel KraftDaniel Kraft
Date: May 22, 2008 11:45
Hi,
the May 10th, 2004 working draft of F2003 (I don't have access to the
final standard) says in the section about FINAL procedures about the
dummy argument of a FINAL procedure:
"... All length type parameters of the dummy argument shall be assumed. ..."
First I thought that means something like
TYPE(mytype) :: arg(:)
but found out that was "assumed size" (IIRC). All I can think about for
"length type parameters assumed" is something like CHARACTER(len=*), but
that does not make sense to me as a CHARACTER-value could never be
finalized, could it? My original conception of array with assumed size
on the other hand does make sense to me (the procedure should be able to
finalize all shapes), which is why I originally assumed it was meant
like that.
Can someone clarify this please? What do I understand wrong, or is this
a problem with the working draft? How is it really?
Thank you very much,
Daniel
|
| Show full article (1.07Kb) |
|
| |
2 Comments |
|
  |
Author: LorentsLorents
Date: May 22, 2008 07:03
Hello,
I have a simple question about how allocatable arrays should be passed
to a subroutine. Do I obligatory have to pass all the dimensions?
Consider a main program of the kind:
<<<<<<<< CODE BEGINS HERE <<<<<<<<
program my_program
integer :: dim1, dim2
double precision, allocatable :: A(:,:)
dim1=5 ; dim2=3
allocate( A(dim1,dim2) )
call my_subroutine( A, dim1, dim2 )
deallocate( A )
end program my_program
subroutine my_subroutine( A, dim1, dim2 )
integer :: dim1, dim2
double precision :: A(dim1, dim2)
(...)
end subroutine my_subroutine
>>>>>>>>>> CODE ENDS HERE >>>>>>>>>>>>
|
| Show full article (0.70Kb) |
|
3 Comments |
|
  |
|
|
  |
Author: Arjen MarkusArjen Markus
Date: May 22, 2008 02:22
Hello,
I was just checking some information on the random_number and
random_seed
intrinsic subroutines and I came across this text fragment (in the
Compaq Visual
Fortran documentation):
If no argument is specified, a random number based on the date and
time is assigned to the seed.
I wondered if this is standard behaviour, so I wrote the following
program:
program rnd
integer :: seed_size
integer, allocatable, dimension(:) :: seed_data
call random_seed( size = seed_size )
allocate( seed_data(seed_size) )
call random_seed( get = seed_data )
write(*,*) 'Seed size:', seed_size
write(*,*) 'Seed data:', seed_data
|
| Show full article (1.05Kb) |
|
17 Comments |
|
|
|
|