init_stencilHeader Subroutine

private subroutine init_stencilHeader(me, QQN, QQ, nElems, useAll, nDims, label, cxDir)

initialize stencil

Arguments

Type IntentOptional 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 :: QQ

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(:,:)

Calls

proc~~init_stencilheader~~CallsGraph proc~init_stencilheader init_stencilHeader interface~init~22 init proc~init_stencilheader->interface~init~22 proc~tem_stencil_createcxcx tem_stencil_createCxcx proc~init_stencilheader->proc~tem_stencil_createcxcx proc~tem_identify_inversedirections tem_identify_inverseDirections proc~init_stencilheader->proc~tem_identify_inversedirections proc~init_ga2d_real init_ga2d_real interface~init~22->proc~init_ga2d_real

Called by

proc~~init_stencilheader~~CalledByGraph proc~init_stencilheader init_stencilHeader proc~tem_loadstencil tem_loadStencil proc~tem_loadstencil->proc~init_stencilheader interface~init~42 init interface~init~42->proc~init_stencilheader

Contents

Source Code


Source Code

  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