Rename variable nblocks to mblocks.
BLOCK STRUCTURE - the global variable nblocks tells how many metablocks are allocated, thus its name is changed to mblocks; - remove unnecessary checking of the list allocation;
This commit is contained in:
parent
c2e6333aab
commit
c72b862db4
@ -161,7 +161,7 @@ module blocks
|
||||
|
||||
! store number of allocated blocks and leafs
|
||||
!
|
||||
integer(kind=4) , save :: nblocks, dblocks, nleafs
|
||||
integer(kind=4) , save :: mblocks, dblocks, nleafs
|
||||
|
||||
! the effective resolution at all levels
|
||||
!
|
||||
@ -183,24 +183,14 @@ module blocks
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
! check if metadata list is empty
|
||||
!
|
||||
if (associated(list_meta)) &
|
||||
call print_warning("blocks::init_blocks", "Block metadata list is already associated!")
|
||||
|
||||
! check if data list is empty
|
||||
!
|
||||
if (associated(list_data)) &
|
||||
call print_warning("blocks::init_blocks", "Block data list is already associated!")
|
||||
|
||||
! nullify all pointers
|
||||
! nullify list pointers
|
||||
!
|
||||
nullify(list_meta)
|
||||
nullify(list_data)
|
||||
|
||||
! reset number of blocks and leafs
|
||||
! reset the number of meta and data blocks, and leafs
|
||||
!
|
||||
nblocks = 0
|
||||
mblocks = 0
|
||||
dblocks = 0
|
||||
nleafs = 0
|
||||
|
||||
@ -218,7 +208,7 @@ module blocks
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine clear_blocks
|
||||
subroutine clear_blocks()
|
||||
|
||||
implicit none
|
||||
|
||||
@ -344,7 +334,7 @@ module blocks
|
||||
|
||||
! increase the number of allocated meta blocks
|
||||
!
|
||||
nblocks = nblocks + 1
|
||||
mblocks = mblocks + 1
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -474,7 +464,7 @@ module blocks
|
||||
|
||||
! decrease the number of allocated blocks
|
||||
!
|
||||
nblocks = nblocks - 1
|
||||
mblocks = mblocks - 1
|
||||
|
||||
end if
|
||||
!
|
||||
|
14
src/io.F90
14
src/io.F90
@ -237,7 +237,7 @@ module io
|
||||
|
||||
! references to other modules
|
||||
!
|
||||
use blocks , only : ndims, last_id, nblocks, dblocks, nleafs
|
||||
use blocks , only : ndims, last_id, mblocks, dblocks, nleafs
|
||||
use config , only : nghost, maxlev, xmin, xmax, ymin, ymax, zmin, zmax
|
||||
use config , only : in, jn, kn, rdims
|
||||
use error , only : print_error
|
||||
@ -273,7 +273,7 @@ module io
|
||||
!
|
||||
call write_attribute_integer_h5(gid, 'ndims' , ndims)
|
||||
call write_attribute_integer_h5(gid, 'last_id', last_id)
|
||||
call write_attribute_integer_h5(gid, 'nblocks', nblocks)
|
||||
call write_attribute_integer_h5(gid, 'mblocks', mblocks)
|
||||
call write_attribute_integer_h5(gid, 'dblocks', dblocks)
|
||||
call write_attribute_integer_h5(gid, 'nleafs' , nleafs)
|
||||
call write_attribute_integer_h5(gid, 'nghost' , nghost)
|
||||
@ -711,7 +711,7 @@ module io
|
||||
! references to other modules
|
||||
!
|
||||
use blocks , only : block_meta, list_meta
|
||||
use blocks , only : last_id, nblocks, nchild, ndims, nsides, nfaces
|
||||
use blocks , only : last_id, mblocks, nchild, ndims, nsides, nfaces
|
||||
use error , only : print_error
|
||||
use hdf5 , only : hid_t, hsize_t
|
||||
use hdf5 , only : h5gcreate_f, h5gclose_f
|
||||
@ -758,13 +758,13 @@ module io
|
||||
|
||||
! prepate dimensions
|
||||
!
|
||||
am(1) = nblocks
|
||||
am(1) = mblocks
|
||||
cm(1) = last_id
|
||||
dm(1) = nblocks
|
||||
dm(1) = mblocks
|
||||
dm(2) = nchild
|
||||
pm(1) = nblocks
|
||||
pm(1) = mblocks
|
||||
pm(2) = ndims
|
||||
qm(1) = nblocks
|
||||
qm(1) = mblocks
|
||||
qm(2) = ndims
|
||||
qm(3) = nsides
|
||||
qm(4) = nfaces
|
||||
|
20
src/mesh.F90
20
src/mesh.F90
@ -52,8 +52,8 @@ module mesh
|
||||
use config , only : im, jm, km, xmin, xmax, ymin, ymax, zmin, zmax &
|
||||
, ncells, maxlev, rdims
|
||||
use blocks , only : block_meta, block_data, list_meta, list_data &
|
||||
, init_blocks, clear_blocks, refine_block &
|
||||
, deallocate_datablock, nblocks, nleafs, dblocks &
|
||||
, init_blocks, refine_block &
|
||||
, deallocate_datablock, mblocks, nleafs, dblocks &
|
||||
, nchild, ndims, nsides, nfaces, res
|
||||
use error , only : print_info, print_error
|
||||
use mpitools, only : is_master, ncpu, ncpus
|
||||
@ -74,17 +74,9 @@ module mesh
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
! check if the list is allocated, if yes deallocate it
|
||||
!
|
||||
if (associated(list_meta)) then
|
||||
call print_info("mesh::init_mesh", "Block list is allocated, deallocate it!")
|
||||
|
||||
call clear_blocks
|
||||
end if
|
||||
|
||||
! initialize blocks
|
||||
!
|
||||
call init_blocks
|
||||
call init_blocks()
|
||||
|
||||
! allocate the effective resolution array
|
||||
!
|
||||
@ -156,7 +148,7 @@ module mesh
|
||||
! if there is only one block, and it is set not to be refined, refine it anyway
|
||||
! because the resolution for the problem initiation may be too small
|
||||
!
|
||||
if (nblocks .eq. 1 .and. l .eq. 1) &
|
||||
if (mblocks .eq. 1 .and. l .eq. 1) &
|
||||
pdata_block%meta%refine = 1
|
||||
end if
|
||||
|
||||
@ -333,14 +325,14 @@ module mesh
|
||||
p = p * rdims(1) * rdims(2) * rdims(3)
|
||||
k = k * rdims(1) * rdims(2) * rdims(3)
|
||||
|
||||
i = nint(alog10(1.0*nblocks + 1)) + 1
|
||||
i = nint(alog10(1.0*mblocks + 1)) + 1
|
||||
j = nint(alog10(1.0*p + 1)) + 1
|
||||
|
||||
write(fmt, "(a,i1,a,i1,a)") "(4x,a,1x,i", i, ",' / ',i", j, ",' = ',f8.4,' %')"
|
||||
|
||||
write(*,*)
|
||||
write(*,fmt) "leafs /cover blocks =", nleafs , k, (100.0 * nleafs ) / k
|
||||
write(*,fmt) "allocated/total blocks =", nblocks, p, (100.0 * nblocks) / p
|
||||
write(*,fmt) "allocated/total blocks =", mblocks, p, (100.0 * mblocks) / p
|
||||
end if
|
||||
|
||||
! allocating space for coordinate variables
|
||||
|
Loading…
x
Reference in New Issue
Block a user