| 84 | ''opa_alloc()'' oversees the allocation of all of the module-level arrays: |
| 85 | {{{ |
| 86 | SUBROUTINE opa_alloc |
| 87 | #if defined key_mpp_dyndist |
| 88 | |
| 89 | #if defined key_lim2 |
| 90 | USE limwri_2, ONLY: lim_wri_2_malloc |
| 91 | USE limdmp_2, ONLY: lim_dmp_2_malloc |
| 92 | USE limhdf_2, ONLY: lim_hdf_2_malloc |
| 93 | USE ice_2, ONLY: ice_2_malloc |
| 94 | USE limsbc_2, ONLY: lim_sbc_2_malloc |
| 95 | USE thd_ice_2, ONLY: thd_ice_2_malloc |
| 96 | USE limdia_2, ONLY: lim_dia_2_malloc |
| 97 | USE dom_ice_2, ONLY: dom_ice_2_malloc |
| 98 | #endif |
| 99 | USE ldfslp, ONLY: ldf_slp_malloc |
| 100 | USE ldftra_oce, ONLY: ldftra_oce_malloc |
| 101 | USE ldfdyn_oce, ONLY: ldfdyn_oce_malloc |
| 102 | #if defined key_vvl |
| 103 | USE domvvl, ONLY: dom_vvl_malloc |
| 104 | #endif |
| 105 | USE dom_oce, ONLY: dom_oce_malloc |
| 106 | ... |
| 107 | ... |
| 108 | IMPLICIT none |
| 109 | INTEGER, PARAMETER :: NUMCALLS = 58 |
| 110 | INTEGER, DIMENSION(NUMCALLS) :: ierr |
| 111 | INTEGER :: i, icount |
| 112 | |
| 113 | ierr = 0 |
| 114 | icount = 1 |
| 115 | |
| 116 | #if defined key_lim2 |
| 117 | ierr = ierr + lim_wri_2_malloc() |
| 118 | ierr = ierr + lim_dmp_2_malloc() |
| 119 | ierr = ierr + lim_hdf_2_malloc() |
| 120 | ierr = ierr + ice_2_malloc() |
| 121 | ierr = ierr + lim_sbc_2_malloc() |
| 122 | ierr = ierr + thd_ice_2_malloc() |
| 123 | ierr = ierr + lim_dia_2_malloc() |
| 124 | ierr = ierr + dom_ice_2_malloc() |
| 125 | #endif |
| 126 | ierr = ierr + ldf_slp_malloc() |
| 127 | ierr = ierr + ldftra_oce_malloc() |
| 128 | ierr = ierr + ldfdyn_oce_malloc() |
| 129 | #if defined key_vvl |
| 130 | ierr = ierr + dom_vvl_malloc() |
| 131 | #endif |
| 132 | ierr = ierr + dom_oce_malloc() |
| 133 | ... |
| 134 | ... |
| 135 | ! Should do an MPI_SUM on ierr and then everyone can MPI_FINALIZE() if the |
| 136 | ! memory allocation has failed on any one PE |
| 137 | IF(ierr > 0)THEN |
| 138 | WRITE(numout,*) |
| 139 | WRITE(numout,*) 'ERROR: Allocation of memory failed in opa_alloc' |
| 140 | STOP 'ERROR: Allocation of memory failed in opa_alloc' |
| 141 | END IF |
| 142 | #else |
| 143 | RETURN ! Not using dynamic memory therefore do nothing |
| 144 | #endif |
| 145 | |
| 146 | END SUBROUTINE opa_alloc |
| 147 | }}} |