Changes between Version 7 and Version 8 of ticket/0829
- Timestamp:
- 2011-06-03T14:45:14+02:00 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ticket/0829
v7 v8 92 92 }}} 93 93 94 It was done in https://forge.ipsl.jussieu.fr/nemo/changeset/2771 94 It was done in https://forge.ipsl.jussieu.fr/nemo/changeset/2771[[BR]] 95 NOt that timing is not needed to change dynamic allocation, It's just an opportunity, in case of we edit all the routines. 95 96 96 97 ==== 2- Auto-assignement ==== 98 99 Instead 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 }}} 109 Then in each routine, we declare local arrays as pointers 110 {{{ 111 REAL(wp), DIMENSION (:,:,:), POINTER :: zwi, zwz 112 }}} 113 And 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 }}} 118 It 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]] 119 To avoid memory leaks, we could check for instance at the end of step that each counter is equal to one. 120 97 121 ==== 3- Dynamic dynamic memory ==== 98 122