region_obj_Expand Subroutine

private pure subroutine region_obj_Expand(this)

Resizes array to accomodate a new element.

Type Bound

region_obj

Arguments

Type IntentOptional Attributes Name
class(region_obj), intent(inout) :: this

A boundary region object


Called by

proc~~region_obj_expand~~CalledByGraph proc~region_obj_expand region_obj%region_obj_Expand proc~region_obj_add region_obj%region_obj_Add proc~region_obj_add->proc~region_obj_expand proc~bc_set_setbc bc_set%bc_set_SetBC proc~bc_set_setbc->proc~region_obj_add proc~cdifs_obj_preparesolverbcs cdifs_obj_PrepareSolverBCS proc~cdifs_obj_preparesolverbcs->proc~bc_set_setbc proc~grans_obj_preparesolverbcs grans_obj_PrepareSolverBCS proc~grans_obj_preparesolverbcs->proc~bc_set_setbc proc~cdifs_obj_preparesolver cdifs_obj_PrepareSolver proc~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolverbcs proc~grans_obj_preparesolver grans_obj_PrepareSolver proc~grans_obj_preparesolver->proc~grans_obj_preparesolverbcs interface~cdifs_obj_preparesolver cdifs_obj%cdifs_obj_PrepareSolver interface~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolver interface~grans_obj_preparesolver grans_obj%grans_obj_PrepareSolver interface~grans_obj_preparesolver->proc~grans_obj_preparesolver

Source Code

    pure subroutine region_obj_Expand(this)
      !> Resizes array to accomodate a new element.
      class(region_obj), intent(inout) :: this                                 !! A boundary region object
      ! Work variables
      type(bc_obj), allocatable :: tmp_array(:)

      ! First resize arrays to accomodate a new element
      if (.not.allocated(this%BC)) then
        allocate(this%BC(1))
        this%count = 1
      else
        ! New size
        this%count = size(this%BC) + 1

        ! Allocate temporary array
        allocate(tmp_array(this%count))

        ! Store old values
        tmp_array(1:this%count-1) = this%BC(:)

        ! Move the allocation from the
        ! temporary array to the final one
        call move_alloc(tmp_array,this%BC)
      end if

      return
    end subroutine region_obj_Expand