Folks, I am new here; besides sorry for using a wrong language:-) -- hope I will not get my a** kicked on both accounts...
My question is about ratfor90/fortran90:
how can I change dynamic allocation of an array without erasing my data?
Example: I first declare
allocate ( a( n1:n2) )
...define a( n1:n2) ....
... and now I want to e.g. increase the size of the array a( n1:n2) to a( n1:n3); n2!=n3
If I do it by
deallocate (a)
allocate ( a( n1:n3))
etc..
I'll erase the old a( n1:n2)...
Of course, I can do it by introducing a "temporary" storage temp(n1,n3) by
allocate (temp(n1:n3))
(temp(n1:n2)=a( n1:n2)
deallocate (a)
allocate (a(n1:n3))
a( n1:n2)=temp(n1:n2)
....define a(n1+1:n3)...
deallocate (tmp)
and so on...
but this will double the size of memory I need, and I work close to the RAM limit,
and want to avoid this cumbersome procedure.
So, is there a simple procedure in ratfor90/fortran90 for extending, changing,
or reducing the size of allocation without destroying generated data?
Thanks a lot for your help!!! (if possible in English! my German is a bit rusty...:-)
Alex
My question is about ratfor90/fortran90:
how can I change dynamic allocation of an array without erasing my data?
Example: I first declare
allocate ( a( n1:n2) )
...define a( n1:n2) ....
... and now I want to e.g. increase the size of the array a( n1:n2) to a( n1:n3); n2!=n3
If I do it by
deallocate (a)
allocate ( a( n1:n3))
etc..
I'll erase the old a( n1:n2)...
Of course, I can do it by introducing a "temporary" storage temp(n1,n3) by
allocate (temp(n1:n3))
(temp(n1:n2)=a( n1:n2)
deallocate (a)
allocate (a(n1:n3))
a( n1:n2)=temp(n1:n2)
....define a(n1+1:n3)...
deallocate (tmp)
and so on...
but this will double the size of memory I need, and I work close to the RAM limit,
and want to avoid this cumbersome procedure.
So, is there a simple procedure in ratfor90/fortran90 for extending, changing,
or reducing the size of allocation without destroying generated data?
Thanks a lot for your help!!! (if possible in English! my German is a bit rusty...:-)
Alex