Hi Mike,
Thanks for this long needed clean up of the stack interface.
I look forward to reading its source code.
Here is a suggestion for the variable named routine: use a parameter,
let the compiler do the math, and use uppercase for parameter names:
Instead of this
character(kind=1, len=###) :: routine="ROUTINE_NAME"
Do this
character(kind=1, len=*), parameter :: ROUTINE = 'ROUTINE_NAME'
> where ROUTINE_NAME is the name of the routine that will call get_rstack,
...
BTW, why is the kind specification required ?
Why not omit it and thus get the default kind which is guaranteed (?)
to contain the Fortran lnguage characters ?
Scott
On Wed, 16 Nov 2005, Michael Crowley wrote:
> Dear all,
> Please update your trees carefully and check out the
> new method of using r_stack and i_stack. I think I have
> made the changes correctly, but there may be some hidden
> bugs.
>
> The idea behind the change was to release us from the lastist/lastrst
> restriction, meaning that one can blow the stacks if they are not
> estimated correctly. Instead, the current method will make a new and
> larger stack when it detects that the stack size is exceeded. Thus we
> start with a default stack size of 1 and increase as needed.
>
> There is a new restriction which, as it turns out, was never violated
> anyway in the current code so it does not break anything at the moment.
> The restriction is that one must start getting stack from a clean stack,
> all get's must be in a single routine, and then all must be freed from
the
> same routine. THe "gotten" stack can be passed into routines as usual.
The
> catch is that one cannot then allocate more stack from a routine that is
> called while the stack is not clean.
>
> One nice result of the changes is that we do not have to pass r_stack
all
> the way down the line from sander() to wherever it is going to be used.
>
> If you want stack (real or integer), you just add "use stack" to the
> routine and also add
> character(kind=1, len=###) :: routine="ROUTINE_NAME"
> where ROUTINE_NAME is the name of the routine that will call get_rstack,
> get_istack, free_stack, and free_istack, and ### is the length of that
> character string.
> Then each call to get or free has the added argument "routine"
> Look at short_ene.f for an example.
>
> There is debugging available to check for improper calling of the get
and
> free routines which only developers should use and use when they are
> adding, new gets and frees: DEBUG_STACK preprocessor keyword.
>
> Best wishes as always
> Mike
Received on Wed Apr 05 2006 - 23:49:47 PDT