bc_set_Expand Subroutine

private pure subroutine bc_set_Expand(this)

Resizes array to accomodate a new element.

Type Bound

bc_set

Arguments

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

Boundary conditions utility


Called by

proc~~bc_set_expand~~CalledByGraph proc~bc_set_expand bc_set%bc_set_Expand proc~bc_set_add bc_set%bc_set_Add proc~bc_set_add->proc~bc_set_expand proc~bc_set_read bc_set%bc_set_Read proc~bc_set_read->proc~bc_set_add

Source Code

    pure subroutine bc_set_Expand(this)
      !> Resizes array to accomodate a new element.
      class(bc_set), intent(inout) :: this                                     !! Boundary conditions utility
      ! Work bariables
      type(region_obj), allocatable :: tmp_array(:)

      if (.not.allocated(this%region)) then
        allocate(this%region(1))
        this%count = 1
      else
        ! New size
        this%count = size(this%region)+1

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

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

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

      return
    end subroutine bc_set_Expand