Changes between Version 7 and Version 8 of ticket/0829


Ignore:
Timestamp:
2011-06-03T14:45:14+02:00 (9 years ago)
Author:
rblod
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ticket/0829

    v7 v8  
    9292}}} 
    9393 
    94 It was done in https://forge.ipsl.jussieu.fr/nemo/changeset/2771 
     94It was done in https://forge.ipsl.jussieu.fr/nemo/changeset/2771[[BR]] 
     95NOt that timing is not needed to change dynamic allocation, It's just an opportunity, in case of we edit all the routines. 
    9596 
    9697==== 2- Auto-assignement ==== 
     98 
     99Instead of choosing by hand the number of a working array, we introduce for each type of work arrays a structure a arrays, with an associated increment: 
     100{{{ 
     101   TYPE work_space_3d 
     102     LOGICAL ::  in_use 
     103     REAL(wp), DIMENSION(:,:,:), POINTER :: wrk 
     104   END TYPE 
     105   TYPE(work_space_3d), DIMENSION(num_3d_wrkspaces) :: s_wrk_3d 
     106   INTEGER :: n_wrk_3d 
     107 
     108}}} 
     109Then in each routine, we declare local arrays as pointers 
     110{{{ 
     111  REAL(wp), DIMENSION (:,:,:), POINTER ::   zwi, zwz 
     112}}} 
     113And  we call the subroutines nemo_allocate which points to a work arrays and increment the counter, and nemo_deallocate to decrement 
     114{{{ 
     115 CALL nemo_allocate(zwi)     ! begin routine 
     116 CALL nemo_deallocate(zwi)     ! end routine 
     117}}} 
     118It was implemented in wrk_nemo_2 and implemented for test in traadv_tvd. To avoid changing all routines before a definitive choice, we choose to keep the old way and duplicate wrk_nemo in wrk_nemo_2 (later saved as wrk_nemo_2_simple), so we declare the double amount of memory.[[BR]] 
     119To avoid memory leaks, we could check for instance at the end of step that each counter is equal to one. 
     120 
    97121==== 3- Dynamic dynamic memory ==== 
    98122