Resizes array to accomodate a new element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(region_obj), | intent(inout) | :: | this |
A boundary region object |
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