0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_utils::swap Interface Reference

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)
 

Detailed Description

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

vec1 = (/ 1., 2., 3., -999., 5., 6. /)
vec2 = (/ 1., 1., 3., -999., 10., 6. /)

Swaps elements in vec1 and vec2

call swap(vec1, vec2)

Swaps 1st and 3rd element of vec1

call swap(vec1, 1, 3)
Parameters
[in]integer(i4) :: iIndex of first element to be swapped with second [case swap(vec,i,j)]
[in]integer(i4) :: jIndex 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)]
Note
No mask or undef.
Author
Matthias Cuntz
Date
May 2014

Definition at line 447 of file mo_utils.F90.

Member Function/Subroutine Documentation

◆ swap_vec_dp()

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.

◆ swap_vec_i4()

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.

◆ swap_vec_sp()

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.

◆ swap_xy_dp()

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.

◆ swap_xy_i4()

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.

◆ swap_xy_sp()

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.


The documentation for this interface was generated from the following file: