tem_bc_prop_sublist Subroutine

public subroutine tem_bc_prop_sublist(tree, bc, header, property, sublist, sub_bc)

Create the boundary property for a restricted set of elements given by sublist (position of elements in tree, usually from a subtree).

After creating a new tree with tem_create_tree_from_sub, this routine can be used to create the according boundary information on the restricted set of elements.

Arguments

Type IntentOptional Attributes Name
type(treelmesh_type), intent(in) :: tree

The original tree from which the subset is to be selected.

type(tem_BC_prop_type), intent(in) :: bc

The boundary condition property in the original mesh (tree).

type(tem_prophead_type), intent(in), target :: header

Header description of the boundary condition property in the sublist.

This information has to be gathered for the elements of the sublist beforehand.

type(tem_property_type), intent(in), target :: property

Property description of the boundary condition property in the sublist.

This information has to be gathered for the elements of the sublist beforehand.

integer, intent(in) :: sublist(:)

List of elements to get the boundary information for.

type(tem_BC_prop_type), intent(out) :: sub_bc

New boundary property description for just the elements provided in sublist.

This may be used to correctly describe the boundary conditions in a subtree for example.


Calls

proc~~tem_bc_prop_sublist~~CallsGraph proc~tem_bc_prop_sublist tem_bc_prop_sublist proc~tem_empty_bc_prop tem_empty_BC_prop proc~tem_bc_prop_sublist->proc~tem_empty_bc_prop

Source Code

  subroutine tem_bc_prop_sublist(tree, bc, header, property, sublist, sub_bc)
    ! -------------------------------------------------------------------- !
    !> The original tree from which the subset is to be selected.
    type(treelmesh_type), intent(in) :: tree

    !> The boundary condition property in the original mesh (tree).
    type(tem_BC_prop_type), intent(in) :: bc

    !> Header description of the boundary condition property in the sublist.
    !!
    !! This information has to be gathered for the elements of the sublist
    !! beforehand.
    type(tem_prophead_type), target, intent(in) :: header

    !> Property description of the boundary condition property in the sublist.
    !!
    !! This information has to be gathered for the elements of the sublist
    !! beforehand.
    type(tem_property_type), target, intent(in) :: property

    !> List of elements to get the boundary information for.
    integer, intent(in) :: sublist(:)

    !> New boundary property description for just the elements provided in
    !! sublist.
    !!
    !! This may be used to correctly describe the boundary conditions in
    !! a subtree for example.
    type(tem_BC_prop_type), intent(out) :: sub_bc
    ! -------------------------------------------------------------------- !
    integer :: iElem
    integer :: iBCElem
    integer :: iSubBCElem
    integer :: iSubElem
    integer :: nSubElems
    ! -------------------------------------------------------------------- !

    if (associated(bc%property)) then

      sub_bc%nSides   = bc%nSides
      sub_bc%nBCtypes = bc%nBCtypes
      if (allocated(bc%BC_label)) then
        allocate(sub_bc%BC_label(size(bc%BC_label)))
        sub_bc%BC_label = bc%BC_label
      end if
      sub_bc%header   => header
      sub_bc%property => property

      allocate(sub_bc%boundary_ID(bc%nSides, property%nElems))

      nSubElems = size(sublist)
      iSubElem = 1
      iBCElem = 0
      iSubBCElem = 0
      do iElem=1,tree%nElems
        if (iSubElem > nSubElems) EXIT
        if ( btest(tree%elemPropertyBits(iElem), prp_hasBnd) ) then
          iBCElem = iBCElem + 1
          if (sublist(iSubElem) == iElem) then
            iSubBCelem = iSubBCelem + 1
            sub_bc%boundary_id(:,iSubBCelem) = bc%boundary_ID(:,iBCElem)
          end if
        end if
        if (sublist(iSubElem) == iElem) iSubElem = iSubElem+1
      end do

    else

      call tem_empty_BC_prop(sub_bc)

    end if

  end subroutine tem_bc_prop_sublist