[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size
From: |
Jaroslav Hajek |
Subject: |
Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size |
Date: |
Mon, 13 Oct 2008 21:45:39 +0200 |
On Mon, Oct 13, 2008 at 9:01 PM, Marco2008 <address@hidden> wrote:
>
>
> dbateman wrote:
>>
>> I've done quite a bit of F77 programming in my time and the declaring a
>> variable with "SAVE" allows its value to be stored between invocations
>> of a function. Can't you arrange that the precalculated values are
>> stored and reused on the second call?
>>
>> D.
>>
>
> Thanks for the hint. I tried it with simple integer and real variables as
> well as with arrays of fixed size and it has worked well. But the SAVE
> attribute does not work with arrays of dynamic size:
> INTEGER, SAVE :: k1(:) ! does not work
> I am not sure if there is another trick to use SAVE and arrays with unknown
> size anyway. I tried something with a saved pointer. It compiled but some
> values of the array had changed in the second call.
>
You can't declare a deferred shape array variable (not a dummy
argument) without ALLOCATABLE or POINTER specification, no matter
whether it's SAVEd or not.
Note that for POINTER arrays (like in C++), there is no automatic
deallocation unless you do it. Automatic deallocation of ALLOCATABLE
arrays, either SAVEd or module variables, is a delicate issue. The
Fortran standard leaves it to be compiler dependent. So it's best to
deallocate these, too.
Maybe you could describe more closely the problem you are trying to solve?
> Marco
> --
> View this message in context:
> http://www.nabble.com/Include-Fortran-Code-which-Returns-Arrays-of-Dynamic-Unknown-Size-tp19845758p19960787.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, (continued)
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Jaroslav Hajek, 2008/10/09
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Marco2008, 2008/10/10
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, David Bateman, 2008/10/10
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Marco2008, 2008/10/13
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, David Bateman, 2008/10/13
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Jaroslav Hajek, 2008/10/13
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size,
Jaroslav Hajek <=
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Marco2008, 2008/10/13
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Jaroslav Hajek, 2008/10/14
- Re: Include Fortran Code which Returns Arrays of Dynamic/Unknown Size, Marco2008, 2008/10/16