[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I need an advice, please



Hallo,

perhaps the definition of the following Fortran-Statement
is that what you was searching for:

SAVE
 Declares that the values of data elements are to be saved across
 invocations of a subprogram.  Statement format:

    SAVE [a[,a]...]

    a  Is the symbolic name of a common block (enclosed in
       slashes), a variable, or an array.

 A SAVE statement cannot include a blank common block, names of
 entities in a common block, procedure names, and names of dummy
 arguments.

 Within a program unit, an entity listed in a SAVE statement does
 not become undefined upon execution of a RETURN or END statement
 within that program unit.

 Even though a common block can be included in a SAVE statement,
 individual entities within the common block could become undefined
 (or redefined) in another program unit.

 When a SAVE statement does not explicitly contain a list, it is
 treated as though all allowable items in the program unit are
 specified on the list.

 NOTE:  It is not necessary to use SAVE statements in DEC Fortran
 programs.  The definitions of data entities are retained
 automatically by default, unless you specify the /RECURSIVE
 compiler option.  (Optimizations can also affect this.  See your
 user manual for more information.) However, the ANSI FORTRAN
 Standard requires using SAVE statements for programs that depend on
 such retention for their correct operation.  If you want your
 programs to be portable, you should include SAVE statements where
 your programs require them.

 The omission of such SAVE statements in necessary instances is not
 flagged, even when you specify the /STANDARD=(SEMANTIC,SYNTAX)
 compiler option, because the compiler does not determine whether
 such dependences exist.
RegardsKarl-Christian Rauch
----- Original Message -----
From: "Marco Sangiorgi" <sangiorgim@inta.es>
To: <trnsys@relay.doit.wisc.edu>
Sent: Wednesday, May 07, 2003 3:01 PM
Subject: I need an advice, please


> Hello,
>
> I have a problem in my simulation. I have an EQUATION. In this equation I
> calculate a certain value, say X. I calculate a new X at each step of the
> simulation. The problem is that I should keep the old value of X in the
same
> equation in order to perform another calculation.
>
> In other words, in the same EQUATION, at the same time t, I should
> calculate:
>
> X = X(t)
> diff = X(t) - X(t-1)
>
>
> I can't suceed in keeping in memory the value of X at the previous time
> step, that is X(t-1)
>
> Any suggestion?
>
> Thank you,
>
> Marco
>