tem_addFace Subroutine

private subroutine tem_addFace(leftElemId, leftElemPos, leftElemPrp, rightElemId, rightElemPos, rightElemPrp, faces)

Adds a new face to the face description.

If the face already exists in the face description, only the properties of the already existing face will be overwritten.

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(in) :: leftElemId

Element id of the left element

integer, intent(in) :: leftElemPos

Position of the left element in the level descriptor's total list.

integer, intent(in) :: leftElemPrp

Properties of the left element.

integer(kind=long_k), intent(in) :: rightElemId

Element id of the right element

integer, intent(in) :: rightElemPos

Position of the right element in the level desriptor's total list.

integer, intent(in) :: rightElemPrp

Properties of the right element

type(tem_face_descriptor_type), intent(inout) :: faces

The face description the new face will be added to. If the face already exists in this face description. The existing face's property will be overwritten by the new ones.


Source Code

  subroutine tem_addFace( leftElemId, leftElemPos, leftElemPrp,          &
    &                     rightElemId, rightElemPos, rightElemPrp, faces )
    ! --------------------------------------------------------------------------
    !> Element id of the left element
    integer(kind=long_k), intent(in) :: leftElemId
    !> Element id of the right element
    integer(kind=long_k), intent(in) :: rightElemId
    !> Position of the left element in the level descriptor's total list.
    integer, intent(in) :: leftElemPos
    !> Properties of the left element.
    integer, intent(in) :: leftElemPrp
    !> Position of the right element in the level desriptor's total list.
    integer, intent(in) :: rightElemPos
    !> Properties of the right element
    integer, intent(in) :: rightElemPrp
    !> The face description the new face will be added to. If the face already
    !! exists in this face description. The existing face's property will be
    !! overwritten by the new ones.
    type(tem_face_descriptor_type), intent(inout) :: faces
    ! --------------------------------------------------------------------------
    logical :: wasAdded
    integer :: pos
    ! --------------------------------------------------------------------------


    ! Try to add the left tree id to the face id list of the faces
    call append( me       = faces%faceList%faceId, &
      &          val      = leftElemId,            &
      &          wasAdded = wasAdded,              &
      &          pos      = pos                    )

    ! Check if the face already existed in the face descriptor.
    ! If yes, we overwrite the properties. If no, we overwrite
    ! the existing properties.
    if(wasAdded) then ! New face
      ! Append right element, element positions and new properties
      call append( me = faces%faceList%rightElemId, val = rightElemId )
      call append( me = faces%faceList%leftElemPos, val = leftElemPos )
      call append( me = faces%faceList%rightElemPos, val = rightElemPos )
      call append( me = faces%faceList%leftPrp, val = leftElemPrp )
      call append( me = faces%faceList%rightPrp, val = rightElemPrp )
    else ! Face already existed
      ! Overwrite existing properies
      faces%faceList%leftPrp%val(pos) = leftElemPrp
      faces%faceList%rightPrp%val(pos) = rightElemPrp
    end if

  end subroutine tem_addFace