10 |
|
|
11 |
|
logical, save :: atype_vector_initialized = .false. |
12 |
|
logical, save :: ff_initialized = .false. |
13 |
+ |
|
14 |
|
|
15 |
|
#ifdef IS_MPI |
16 |
|
real( kind = dp ), allocatable, dimension(:,:) :: q_Row |
231 |
|
|
232 |
|
subroutine setupGlobals(thisStat) |
233 |
|
integer, intent(out) :: thisStat |
234 |
+ |
integer :: nrow |
235 |
+ |
integer :: ncol |
236 |
+ |
integer :: nlocal |
237 |
+ |
integer :: ndim = 3 |
238 |
+ |
integer :: alloc_stat |
239 |
+ |
|
240 |
+ |
thisStat = 0 |
241 |
+ |
|
242 |
+ |
#ifdef IS_MPI |
243 |
+ |
nrow = getNrow(plan_row) |
244 |
+ |
ncol = getNcol(plan_col) |
245 |
+ |
#endif |
246 |
+ |
nlocal = getNlocal() |
247 |
+ |
|
248 |
+ |
call freeGlobals() |
249 |
+ |
|
250 |
+ |
allocate(q_Row(ndim,nrow),stat=alloc_stat) |
251 |
+ |
if (alloc_stat /= 0 ) then |
252 |
+ |
thisStat = 0 |
253 |
+ |
return |
254 |
+ |
endif |
255 |
|
|
256 |
+ |
|
257 |
+ |
allocate(q_Col(ndim,ncol),stat=alloc_stat) |
258 |
+ |
if (alloc_stat /= 0 ) then |
259 |
+ |
thisStat = 0 |
260 |
+ |
return |
261 |
+ |
endif |
262 |
+ |
|
263 |
+ |
|
264 |
+ |
allocate(u_l_Row(ndim,nrow),stat=alloc_stat) |
265 |
+ |
if (alloc_stat /= 0 ) then |
266 |
+ |
thisStat = 0 |
267 |
+ |
return |
268 |
+ |
endif |
269 |
+ |
|
270 |
+ |
allocate(u_l_Col(ndim,ncol),stat=alloc_stat) |
271 |
+ |
if (alloc_stat /= 0 ) then |
272 |
+ |
thisStat = 0 |
273 |
+ |
return |
274 |
+ |
endif |
275 |
+ |
|
276 |
+ |
|
277 |
+ |
allocate(A_row(9,nrow),stat=alloc_stat) |
278 |
+ |
if (alloc_stat /= 0 ) then |
279 |
+ |
thisStat = 0 |
280 |
+ |
return |
281 |
+ |
endif |
282 |
+ |
|
283 |
+ |
|
284 |
+ |
allocate(A_Col(9,ncol),stat=alloc_stat) |
285 |
+ |
if (alloc_stat /= 0 ) then |
286 |
+ |
thisStat = 0 |
287 |
+ |
return |
288 |
+ |
endif |
289 |
+ |
|
290 |
+ |
|
291 |
+ |
allocate(pot_row(nrow),stat=alloc_stat) |
292 |
+ |
if (alloc_stat /= 0 ) then |
293 |
+ |
thisStat = 0 |
294 |
+ |
return |
295 |
+ |
endif |
296 |
+ |
|
297 |
+ |
allocate(pot_Col(ncol),stat=alloc_stat) |
298 |
+ |
if (alloc_stat /= 0 ) then |
299 |
+ |
thisStat = 0 |
300 |
+ |
return |
301 |
+ |
endif |
302 |
+ |
|
303 |
+ |
allocate(pot_Temp(nlocal),stat=alloc_stat) |
304 |
+ |
if (alloc_stat /= 0 ) then |
305 |
+ |
thisStat = 0 |
306 |
+ |
return |
307 |
+ |
endif |
308 |
+ |
|
309 |
+ |
allocate(f_Row(ndim,nrow),stat=alloc_stat) |
310 |
+ |
if (alloc_stat /= 0 ) then |
311 |
+ |
thisStat = 0 |
312 |
+ |
return |
313 |
+ |
endif |
314 |
+ |
|
315 |
+ |
allocate(f_Col(ndim,ncol),stat=alloc_stat) |
316 |
+ |
if (alloc_stat /= 0 ) then |
317 |
+ |
thisStat = 0 |
318 |
+ |
return |
319 |
+ |
endif |
320 |
+ |
|
321 |
+ |
allocate(f_Temp(ndim,nlocal),stat=alloc_stat) |
322 |
+ |
if (alloc_stat /= 0 ) then |
323 |
+ |
thisStat = 0 |
324 |
+ |
return |
325 |
+ |
endif |
326 |
+ |
|
327 |
+ |
allocate(t_Row(ndim,nrow),stat=alloc_stat) |
328 |
+ |
if (alloc_stat /= 0 ) then |
329 |
+ |
thisStat = 0 |
330 |
+ |
return |
331 |
+ |
endif |
332 |
+ |
|
333 |
+ |
allocate(t_Col(ndim,ncol),stat=alloc_stat) |
334 |
+ |
if (alloc_stat /= 0 ) then |
335 |
+ |
thisStat = 0 |
336 |
+ |
return |
337 |
+ |
endif |
338 |
+ |
|
339 |
+ |
allocate(t_temp(ndim,nlocal),stat=alloc_stat) |
340 |
+ |
if (alloc_stat /= 0 ) then |
341 |
+ |
thisStat = 0 |
342 |
+ |
return |
343 |
+ |
endif |
344 |
+ |
|
345 |
+ |
allocate(atid_Row(nrow),stat=alloc_stat) |
346 |
+ |
if (alloc_stat /= 0 ) then |
347 |
+ |
thisStat = 0 |
348 |
+ |
return |
349 |
+ |
endif |
350 |
+ |
|
351 |
+ |
allocate(atid_Col(ncol),stat=alloc_stat) |
352 |
+ |
if (alloc_stat /= 0 ) then |
353 |
+ |
thisStat = 0 |
354 |
+ |
return |
355 |
+ |
endif |
356 |
+ |
|
357 |
+ |
#else |
358 |
+ |
|
359 |
+ |
allocate(atid(nlocal),stat=alloc_stat) |
360 |
+ |
if (alloc_stat /= 0 ) then |
361 |
+ |
thisStat = 0 |
362 |
+ |
return |
363 |
+ |
end if |
364 |
+ |
#endif |
365 |
+ |
|
366 |
|
end subroutine setupGlobals |
367 |
|
|
368 |
+ |
subroutine freeGlobals() |
369 |
+ |
|
370 |
+ |
!We free in the opposite order in which we allocate in. |
371 |
+ |
#ifdef IS_MPI |
372 |
+ |
|
373 |
+ |
if (allocated(atid_Col)) deallocate(atid_Col) |
374 |
+ |
if (allocated(atid_Row)) deallocate(atid_Row) |
375 |
+ |
if (allocated(t_Temp)) deallocate(t_Temp) |
376 |
+ |
if (allocated(t_Col)) deallocate(t_Col) |
377 |
+ |
if (allocated(t_Row)) deallocate(t_Row) |
378 |
+ |
if (allocated(f_Temp)) deallocate(f_Temp) |
379 |
+ |
if (allocated(f_Col)) deallocate(f_Col) |
380 |
+ |
if (allocated(f_Row)) deallocate(f_Row) |
381 |
+ |
if (allocated(pot_Temp)) deallocate(pot_Temp) |
382 |
+ |
if (allocated(pot_Col)) deallocate(pot_Col) |
383 |
+ |
if (allocated(pot_Row)) deallocate(pot_Row) |
384 |
+ |
if (allocated(A_Col)) deallocate(A_Col) |
385 |
+ |
if (allocated(A_Row)) deallocate(A_Row) |
386 |
+ |
if (allocated(u_l_Col)) deallocate(u_l_Col) |
387 |
+ |
if (allocated(u_l_Row)) deallocate(u_l_Row) |
388 |
+ |
if (allocated(q_Col)) deallocate(q_Col) |
389 |
+ |
if (allocated(q_Row)) deallocate(q_Row) |
390 |
+ |
|
391 |
+ |
#else |
392 |
+ |
|
393 |
+ |
if (allocated(atid)) deallocate(atid) |
394 |
+ |
|
395 |
+ |
#endif |
396 |
+ |
|
397 |
+ |
|
398 |
+ |
end subroutine freeGlobals |
399 |
+ |
|
400 |
+ |
|
401 |
+ |
|
402 |
+ |
|
403 |
|
|
404 |
|
subroutine initForce_Modules(thisStat) |
405 |
|
integer, intent(out) :: thisStat |