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 |
+ |
|
271 |
+ |
allocate(u_l_Col(ndim,ncol),stat=alloc_stat) |
272 |
+ |
if (alloc_stat /= 0 ) then |
273 |
+ |
thisStat = 0 |
274 |
+ |
return |
275 |
+ |
endif |
276 |
+ |
|
277 |
+ |
|
278 |
+ |
allocate(A_row(9,nrow),stat=alloc_stat) |
279 |
+ |
if (alloc_stat /= 0 ) then |
280 |
+ |
thisStat = 0 |
281 |
+ |
return |
282 |
+ |
endif |
283 |
+ |
|
284 |
+ |
|
285 |
+ |
allocate(A_Col(9,ncol),stat=alloc_stat) |
286 |
+ |
if (alloc_stat /= 0 ) then |
287 |
+ |
thisStat = 0 |
288 |
+ |
return |
289 |
+ |
endif |
290 |
+ |
|
291 |
+ |
|
292 |
+ |
allocate(pot_row(nrow),stat=alloc_stat) |
293 |
+ |
if (alloc_stat /= 0 ) then |
294 |
+ |
thisStat = 0 |
295 |
+ |
return |
296 |
+ |
endif |
297 |
+ |
|
298 |
+ |
allocate(pot_Col(ncol),stat=alloc_stat) |
299 |
+ |
if (alloc_stat /= 0 ) then |
300 |
+ |
thisStat = 0 |
301 |
+ |
return |
302 |
+ |
endif |
303 |
+ |
|
304 |
+ |
allocate(pot_Temp(nlocal),stat=alloc_stat) |
305 |
+ |
if (alloc_stat /= 0 ) then |
306 |
+ |
thisStat = 0 |
307 |
+ |
return |
308 |
+ |
endif |
309 |
+ |
|
310 |
+ |
allocate(f_Row(ndim,nrow),stat=alloc_stat) |
311 |
+ |
if (alloc_stat /= 0 ) then |
312 |
+ |
thisStat = 0 |
313 |
+ |
return |
314 |
+ |
endif |
315 |
+ |
|
316 |
+ |
allocate(f_Col(ndim,ncol),stat=alloc_stat) |
317 |
+ |
if (alloc_stat /= 0 ) then |
318 |
+ |
thisStat = 0 |
319 |
+ |
return |
320 |
+ |
endif |
321 |
|
|
322 |
+ |
allocate(f_Temp(ndim,nlocal),stat=alloc_stat) |
323 |
+ |
if (alloc_stat /= 0 ) then |
324 |
+ |
thisStat = 0 |
325 |
+ |
return |
326 |
+ |
endif |
327 |
+ |
|
328 |
+ |
allocate(t_Row(ndim,nrow),stat=alloc_stat) |
329 |
+ |
if (alloc_stat /= 0 ) then |
330 |
+ |
thisStat = 0 |
331 |
+ |
return |
332 |
+ |
endif |
333 |
+ |
|
334 |
+ |
allocate(t_Col(ndim,ncol),stat=alloc_stat) |
335 |
+ |
if (alloc_stat /= 0 ) then |
336 |
+ |
thisStat = 0 |
337 |
+ |
return |
338 |
+ |
endif |
339 |
+ |
|
340 |
+ |
allocate(t_temp(ndim,nlocal),stat=alloc_stat) |
341 |
+ |
if (alloc_stat /= 0 ) then |
342 |
+ |
thisStat = 0 |
343 |
+ |
return |
344 |
+ |
endif |
345 |
+ |
|
346 |
+ |
allocate(atid_Row(nrow),stat=alloc_stat) |
347 |
+ |
if (alloc_stat /= 0 ) then |
348 |
+ |
thisStat = 0 |
349 |
+ |
return |
350 |
+ |
endif |
351 |
+ |
|
352 |
+ |
allocate(atid_Col(ncol),stat=alloc_stat) |
353 |
+ |
if (alloc_stat /= 0 ) then |
354 |
+ |
thisStat = 0 |
355 |
+ |
return |
356 |
+ |
endif |
357 |
+ |
|
358 |
+ |
#else |
359 |
+ |
|
360 |
+ |
allocate(atid(nlocal),stat=alloc_stat) |
361 |
+ |
if (alloc_stat /= 0 ) then |
362 |
+ |
thisStat = 0 |
363 |
+ |
return |
364 |
+ |
end if |
365 |
+ |
#endif |
366 |
+ |
|
367 |
|
end subroutine setupGlobals |
368 |
|
|
369 |
+ |
subroutine freeGlobals() |
370 |
+ |
|
371 |
+ |
!We free in the opposite order in which we allocate in. |
372 |
+ |
#ifdef IS_MPI |
373 |
+ |
|
374 |
+ |
if (allocated(atid_Col)) deallocate(atid_Col) |
375 |
+ |
if (allocated(atid_Row)) deallocate(atid_Row) |
376 |
+ |
if (allocated(t_Temp)) deallocate(t_Temp) |
377 |
+ |
if (allocated(t_Col)) deallocate(t_Col) |
378 |
+ |
if (allocated(t_Row)) deallocate(t_Row) |
379 |
+ |
if (allocated(f_Temp)) deallocate(f_Temp) |
380 |
+ |
if (allocated(f_Col)) deallocate(f_Col) |
381 |
+ |
if (allocated(f_Row)) deallocate(f_Row) |
382 |
+ |
if (allocated(pot_Temp)) deallocate(pot_Temp) |
383 |
+ |
if (allocated(pot_Col)) deallocate(pot_Col) |
384 |
+ |
if (allocated(pot_Row)) deallocate(pot_Row) |
385 |
+ |
if (allocated(A_Col)) deallocate(A_Col) |
386 |
+ |
if (allocated(A_Row)) deallocate(A_Row) |
387 |
+ |
if (allocated(u_l_Col)) deallocate(u_l_Col) |
388 |
+ |
if (allocated(u_l_Row)) deallocate(u_l_Row) |
389 |
+ |
if (allocated(q_Col)) deallocate(q_Col) |
390 |
+ |
if (allocated(q_Row)) deallocate(q_Row) |
391 |
+ |
|
392 |
+ |
#else |
393 |
+ |
|
394 |
+ |
if (allocated(atid)) deallocate(atid) |
395 |
+ |
|
396 |
+ |
#endif |
397 |
+ |
|
398 |
+ |
|
399 |
+ |
end subroutine freeGlobals |
400 |
+ |
|
401 |
+ |
|
402 |
+ |
|
403 |
+ |
|
404 |
|
|
405 |
|
subroutine initForce_Modules(thisStat) |
406 |
|
integer, intent(out) :: thisStat |