initialize stencil
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_stencilHeader_type), | intent(out) | :: | me |
stencil header to be initialized |
||
integer, | intent(in) | :: | QQN |
number of discrete velocities in the model (without the center one) |
||
integer, | intent(in), | optional | :: |
number of discrete velocities in the model (incl. the center one) |
||
integer, | intent(in), | optional | :: | nElems |
The number of elements to use this stencil for |
|
logical, | intent(in), | optional | :: | useAll |
use this stencil for all elements? |
|
integer, | intent(in), | optional | :: | nDims | ||
character(len=*), | intent(in), | optional | :: | label | ||
integer, | intent(in), | optional | :: | cxDir(:,:) |
subroutine init_stencilHeader( me, QQN, QQ, nElems, useAll, &
& nDims, label, cxDir )
! -------------------------------------------------------------------- !
!> stencil header to be initialized
type( tem_stencilHeader_type ), intent(out) :: me
!> number of discrete velocities in the model (without the center one)
integer, intent(in) :: QQN
!> number of discrete velocities in the model (incl. the center one)
integer, intent(in), optional :: QQ
!> The number of elements to use this stencil for
integer, intent(in), optional :: nElems
!> use this stencil for all elements?
logical, intent(in), optional :: useAll
! Number of dimensions considered by the stencil
integer, intent(in), optional :: nDims
! A label to describe the stencil
character(len=*), intent(in), optional :: label
! Directions describing the neighboring elements in the stencil
integer, intent(in), optional :: cxDir(:,:)
! -------------------------------------------------------------------- !
integer :: iElem
! -------------------------------------------------------------------- !
me%QQN = QQN
if( present( QQ )) me%QQ = QQ
if( present( useAll )) then
me%useAll = useAll
me%nElems = 0
else if( present( nElems ) ) then
me%useAll = .false.
me%nElems = nElems
call init( me%elem, nElems )
allocate( me%elemLvl( nElems ) )
do iElem = 1, nElems
call init( me%elemLvl(iElem) )
end do
else
me%useAll = .false.
me%nElems = 0
end if
if ( .not. allocated(me%cxDir) ) allocate( me%cxDir( 3, me%QQ ) )
if ( .not. allocated(me%cxDirRK) ) allocate( me%cxDirRK( 3, me%QQ ) )
if ( .not. allocated(me%cxDirInv) ) allocate( me%cxDirInv( me%QQ ) )
if ( .not. allocated(me%cxcx) ) allocate( me%cxcx( 6, me%QQ ) )
if (present(nDims)) me%nDims = nDims
if (present(label)) me%label = label
if (present(cxDir)) then
me%cxDir = cxDir
me%cxDirRK(:,:) = real( cxDir(:,:), rk )
call tem_identify_inverseDirections( me%cxDirInv, me%cxDir )
call tem_stencil_createCxcx( me )
else
me%cxDir = 0
me%cxDirRK = 0.0_rk
me%cxDirInv = 0
me%cxcx = 0.0_rk
end if
end subroutine init_stencilHeader