BLOCKS: Remove set_block_dimensions().

Instead, initialize block dimensions through initialize_blocks().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2019-02-11 13:30:02 -02:00
parent 905004951e
commit e6faf7dea9
3 changed files with 23 additions and 73 deletions

View File

@ -44,9 +44,9 @@ module blocks
#ifdef PROFILE
! timer indices
!
integer, save :: imi, ima, imu, imp, imq, imr, imd
integer, save :: imi, ima, imu, imp, imq, imr, imd
#ifdef DEBUG
integer, save :: imc
integer, save :: imc
#endif /* DEBUG */
#endif /* PROFILE */
@ -66,20 +66,20 @@ module blocks
!
! the identification of the last allocated block (always increases)
!
integer(kind=4), save :: last_id
integer(kind=4), save :: last_id = 0
! the number of allocated meta and data blocks (inserted in the lists),
! and the number of leafs
!
integer(kind=4), save :: mblocks, dblocks, nleafs
integer(kind=4), save :: mblocks = 0, dblocks = 0, nleafs = 0
! the number of variables and fluxes stored in data blocks
!
integer(kind=4), save :: nvars, nflux
integer(kind=4), save :: nvars = 1, nflux = 1
! the spacial dimensions of allocatable data block arrays
!
integer(kind=4), save :: nx, ny, nz
integer(kind=4), save :: nx = 1, ny = 1, nz = 1
! BLOCK STRUCTURE POINTERS:
! ========================
@ -333,7 +333,6 @@ module blocks
! declare public subroutines
!
public :: initialize_blocks, finalize_blocks
public :: set_block_dimensions
public :: append_metablock, remove_metablock
public :: append_datablock, remove_datablock
public :: allocate_metablock, deallocate_metablock
@ -372,13 +371,15 @@ module blocks
!
! Arguments:
!
! bdims - block dimensions;
! nv - the number of variables stored in the block;
! nf - the number of fluxes stored in the block;
! nc - the number of cells per block dimension;
! verbose - flag determining if the subroutine should be verbose;
! status - return flag of the procedure execution status;
!
!===============================================================================
!
subroutine initialize_blocks(bdims, verbose, status)
subroutine initialize_blocks(nv, nf, nc, verbose, status)
! local variables are not implicit by default
!
@ -386,9 +387,9 @@ module blocks
! subroutine arguments
!
integer, dimension(5), intent(in) :: bdims
logical , intent(in) :: verbose
integer , intent(out) :: status
integer, intent(in) :: nv, nf, nc
logical, intent(in) :: verbose
integer, intent(out) :: status
!
!-------------------------------------------------------------------------------
!
@ -413,7 +414,7 @@ module blocks
! reset the status flag
!
status = 0
status = 0
! reset identification counter
!
@ -427,14 +428,16 @@ module blocks
! set the initial number of variables and fluxes
!
nvars = bdims(1)
nflux = bdims(2)
nvars = nv
nflux = nf
! set the initial data block resolution
!
nx = bdims(3)
ny = bdims(4)
nz = bdims(5)
nx = nc
ny = nc
#if NDIMS == 3
nz = nc
#endif /* NDIMS == 3 */
! nullify pointers defining the meta and data lists
!
@ -536,53 +539,6 @@ module blocks
!
!===============================================================================
!
! subroutine SET_BLOCK_DIMENSIONS:
! -------------------------------
!
! Subroutine sets the number of variables, fluxes and block dimensions
! (without ghost cells) for arrays allocated in data blocks.
!
! Arguments:
!
! nv - the number of variables stored in %u and %q;
! nf - the number of fluxes stored in %f;
! ni - the block dimension along X;
! nj - the block dimension along Y;
! nk - the block dimension along Z;
!
!===============================================================================
!
subroutine set_block_dimensions(nv, nf, ni, nj, nk)
! local variables are not implicit by default
!
implicit none
! subroutine arguments
!
integer(kind=4), intent(in) :: nv, nf, ni, nj, nk
!
!-------------------------------------------------------------------------------
!
! set the number of variables and fluxes
!
nvars = nv
nflux = nf
! set the block dimensions
!
nx = ni
ny = nj
#if NDIMS == 3
nz = nk
#endif /* NDIMS == 3 */
!-------------------------------------------------------------------------------
!
end subroutine set_block_dimensions
!
!===============================================================================
!
! subroutine APPEND_METABLOCK:
! ---------------------------
!

View File

@ -349,11 +349,7 @@ program amun
call initialize_coordinates(ncells, nghosts, toplev, bdims, xmin, xmax, &
ymin, ymax, zmin, zmax, master, iret)
if (iret > 0) go to 160
#if NDIMS == 3
call initialize_blocks((/ nv, nv, nn, nn, nn /), master, iret)
#else /* NDIMS == 3 */
call initialize_blocks((/ nv, nv, nn, nn, 1 /), master, iret)
#endif /* NDIMS == 3 */
call initialize_blocks(nv, nv, nn, master, iret)
if (iret > 0) go to 150
call initialize_operators(master, iret)
if (iret > 0) go to 140

View File

@ -86,9 +86,7 @@ module mesh
! import external procedures and variables
!
use blocks , only : set_block_dimensions
use coordinates, only : xmin, xmax, ymin, ymax, zmin, zmax, toplev
use equations , only : nv
use coordinates, only : toplev
use mpitools , only : master, nprocs
! local variables are not implicit by default