Copy the elements of v1
into the locations of v2
which are unfixed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n2 |
Number of items in |
||
real(kind=wp), | intent(in) | :: | v1(n2) |
Vector of the unfixed items. |
||
real(kind=wp), | intent(out) | :: | v2(n2) |
Vector of the fixed and unfixed items into which the elements of |
||
integer, | intent(in) | :: | ifix(n2) |
Values designating whether the elements of |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
integer, | public | :: | n1 |
pure subroutine unpack_vec(n2, v1, v2, ifix) !! Copy the elements of `v1` into the locations of `v2` which are unfixed. integer, intent(in) :: n2 !! Number of items in `v2`. real(wp), intent(in) :: v1(n2) !! Vector of the unfixed items. real(wp), intent(out) :: v2(n2) !! Vector of the fixed and unfixed items into which the elements of `v1` are to !! be inserted. integer, intent(in) :: ifix(n2) !! Values designating whether the elements of `v2` are fixed at their input values !! or not. ! Local scalars integer :: i, n1 ! Variable Definitions (alphabetically) ! I: An indexing variable. ! N1: The number of items in V1. n1 = 0 if (ifix(1) >= 0) then do i = 1, n2 if (ifix(i) /= 0) then n1 = n1 + 1 v2(i) = v1(n1) end if end do else n1 = n2 v2 = v1 end if end subroutine unpack_vec