tem_stencil_map_toTreelmDef Subroutine

public subroutine tem_stencil_map_toTreelmDef(me)

Map the stencil offsets to the internally defined treelm offsets.

Arguments

Type IntentOptional Attributes Name
type(tem_stencilHeader_type) :: me

stencil to map


Source Code

  subroutine tem_stencil_map_toTreelmDef( me )
    ! -------------------------------------------------------------------- !
    !> stencil to map
    type(tem_stencilHeader_type) :: me
    ! -------------------------------------------------------------------- !
    ! counters
    integer :: iQQQ, iDir
    ! -------------------------------------------------------------------- !

    if ( allocated(me%map) ) deallocate(me%map)

    allocate( me%map(me%QQ) )
    me%map = 0

    do iDir = 1,me%QQ

      if ( maxval( abs( me%cxDir(:,iDir) ) ) <= 1 ) then

        ! Now match the stencil offset with the treelm definition offsets
        qqqLoop: do iQQQ=1,qQQQ
          if ( me%cxDir(1, iDir) == qOffset(iQQQ, 1)      &
            & .and. me%cxDir(2, iDir) == qOffset(iQQQ, 2) &
            & .and. me%cxDir(3, iDir) == qOffset(iQQQ, 3) ) then
            me%map( iDir ) = iQQQ
            exit qqqLoop
          end if
        end do qqqLoop

      end if

    end do ! iDir = 1, QQ

  end subroutine tem_stencil_map_toTreelmDef