Re: help with module
- From: alexei.matveev@xxxxxxxxx
- Date: Wed, 8 Apr 2009 03:18:27 -0700 (PDT)
On Apr 8, 11:32 am, rudra <bnrj.ru...@xxxxxxxxx> wrote:
well, let me explain what i want to do.i have some variables that
should be available to all other prgrams; so i use the module.
The "protected" attribute was a good idea, dont give up too early.
This is natural next step between fortran "parameter"s and and those
of your computation. All you need is an updater routine:
module params
real, protected, public :: speed_of_light = 3.0E8
public :: set_speed_of_light
contains
subroutine set_speed_of_light(c)
implicit none
real, intent(in) :: c
print *,'warning, somebody is trying to change speed of light
to',c
speed_of_light = c
end subroutine set_speed_of_light
end module
And no one is allowed to modify the speed of light
except when explicitly calling set_speed_of_light().
Alexei
.
- References:
- help with module
- From: rudra
- Re: help with module
- From: Jan Gerrit Kootstra
- Re: help with module
- From: Ian Bush
- Re: help with module
- From: rudra
- help with module
- Prev by Date: Re: a query !!!
- Next by Date: How to deal with the ftnchek warning message? Thanks!
- Previous by thread: Re: help with module
- Next by thread: Re: help with module
- Index(es):
Relevant Pages
|