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

@ -66,20 +66,20 @@ module blocks
! !
! the identification of the last allocated block (always increases) ! 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), ! the number of allocated meta and data blocks (inserted in the lists),
! and the number of leafs ! 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 ! 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 ! 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: ! BLOCK STRUCTURE POINTERS:
! ======================== ! ========================
@ -333,7 +333,6 @@ module blocks
! declare public subroutines ! declare public subroutines
! !
public :: initialize_blocks, finalize_blocks public :: initialize_blocks, finalize_blocks
public :: set_block_dimensions
public :: append_metablock, remove_metablock public :: append_metablock, remove_metablock
public :: append_datablock, remove_datablock public :: append_datablock, remove_datablock
public :: allocate_metablock, deallocate_metablock public :: allocate_metablock, deallocate_metablock
@ -372,13 +371,15 @@ module blocks
! !
! Arguments: ! 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; ! verbose - flag determining if the subroutine should be verbose;
! status - return flag of the procedure execution status; ! 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 ! local variables are not implicit by default
! !
@ -386,7 +387,7 @@ module blocks
! subroutine arguments ! subroutine arguments
! !
integer, dimension(5), intent(in) :: bdims integer, intent(in) :: nv, nf, nc
logical, intent(in) :: verbose logical, intent(in) :: verbose
integer, intent(out) :: status integer, intent(out) :: status
! !
@ -427,14 +428,16 @@ module blocks
! set the initial number of variables and fluxes ! set the initial number of variables and fluxes
! !
nvars = bdims(1) nvars = nv
nflux = bdims(2) nflux = nf
! set the initial data block resolution ! set the initial data block resolution
! !
nx = bdims(3) nx = nc
ny = bdims(4) ny = nc
nz = bdims(5) #if NDIMS == 3
nz = nc
#endif /* NDIMS == 3 */
! nullify pointers defining the meta and data lists ! 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: ! subroutine APPEND_METABLOCK:
! --------------------------- ! ---------------------------
! !

View File

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

View File

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