RefineNode_OctreeMesh3D Subroutine

public subroutine RefineNode_OctreeMesh3D(this, node)

Subdivide one leaf node into eight children. Does nothing (with a warning) if the node is already refined. The caller is responsible for rebuilding the leaf list afterwards (or calling AdaptFromFlags, which does so).

Arguments

TypeIntentOptionalAttributesName
class(OctreeMesh3D), intent(inout) :: this
integer, intent(in) :: node

Contents


Source Code

  subroutine RefineNode_OctreeMesh3D(this,node)
    !! Subdivide one leaf node into eight children. Does nothing (with a warning) if the
    !! node is already refined. The caller is responsible for rebuilding the leaf list
    !! afterwards (or calling AdaptFromFlags, which does so).
    implicit none
    class(OctreeMesh3D),intent(inout) :: this
    integer,intent(in) :: node
    ! Local
    integer :: c,newid

    if(this%child(1,node) /= 0) then
      print*,__FILE__,':',__LINE__,' : Warning : RefineNode called on an already-refined node.'
      return
    endif

    call this%EnsureCapacity(this%nNodes+8)
    do c = 1,8
      newid = this%nNodes+c
      this%level(newid) = this%level(node)+1
      this%parent(newid) = node
      this%octant(newid) = c
      this%rootElem(newid) = this%rootElem(node)
      this%child(1:8,newid) = 0
      this%child(c,node) = newid
    enddo
    this%nNodes = this%nNodes+8

  endsubroutine RefineNode_OctreeMesh3D