FORCES
FORtran lib for Comp. Env. Sys.
|
Swap to values or two elements in array. More...
Public Member Functions | |
elemental pure subroutine | swap_xy_dp (x, y) |
elemental pure subroutine | swap_xy_sp (x, y) |
elemental pure subroutine | swap_xy_i4 (x, y) |
subroutine | swap_vec_dp (x, i1, i2) |
subroutine | swap_vec_sp (x, i1, i2) |
subroutine | swap_vec_i4 (x, i1, i2) |
Swap to values or two elements in array.
Swaps either two entities, i.e. scalars, vectors, matrices, or two elements in a vector. The call is either
call swap(x,y)
or
call swap(vec,i,j)
Example
Swaps elements in vec1 and vec2
Swaps 1st and 3rd element of vec1
[in] | integer(i4) :: i | Index of first element to be swapped with second [case swap(vec,i,j)] |
[in] | integer(i4) :: j | Index of second element to be swapped with first [case swap(vec,i,j)] |
[in,out] | real(sp/dp/i4) :: x[(:,...)] | First scalar or array to swap with second [case swap(x,y)] |
[in,out] | real(sp/dp/i4) :: y[(:[,:])] | Second scalar or array to swap with first [case swap(x,y)] |
[in,out] | real(sp/dp/i4) :: x(:) | Vector of which to elements are swapped [case swap(vec,i,j)] |
Definition at line 447 of file mo_utils.F90.
subroutine mo_utils::swap::swap_vec_dp | ( | real(dp), dimension(:), intent(inout) | x, |
integer(i4), intent(in) | i1, | ||
integer(i4), intent(in) | i2 | ||
) |
Definition at line 1295 of file mo_utils.F90.
subroutine mo_utils::swap::swap_vec_i4 | ( | integer(i4), dimension(:), intent(inout) | x, |
integer(i4), intent(in) | i1, | ||
integer(i4), intent(in) | i2 | ||
) |
Definition at line 1323 of file mo_utils.F90.
subroutine mo_utils::swap::swap_vec_sp | ( | real(sp), dimension(:), intent(inout) | x, |
integer(i4), intent(in) | i1, | ||
integer(i4), intent(in) | i2 | ||
) |
Definition at line 1309 of file mo_utils.F90.
elemental pure subroutine mo_utils::swap::swap_xy_dp | ( | real(dp), intent(inout) | x, |
real(dp), intent(inout) | y | ||
) |
Definition at line 1255 of file mo_utils.F90.
elemental pure subroutine mo_utils::swap::swap_xy_i4 | ( | integer(i4), intent(inout) | x, |
integer(i4), intent(inout) | y | ||
) |
Definition at line 1281 of file mo_utils.F90.
elemental pure subroutine mo_utils::swap::swap_xy_sp | ( | real(sp), intent(inout) | x, |
real(sp), intent(inout) | y | ||
) |
Definition at line 1268 of file mo_utils.F90.