Index: palm/trunk/SOURCE/transpose.f90
===================================================================
--- palm/trunk/SOURCE/transpose.f90	(revision 1319)
+++ palm/trunk/SOURCE/transpose.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -55,27 +61,4 @@
 ! indices nxa, nya, etc. replaced by nx, ny, etc.
 !
-! 683 2011-02-09 14:25:15Z raasch
-! openMP parallelization of transpositions for 2d-domain-decomposition
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 164 2008-05-15 08:46:15Z raasch
-! f_inv changed from subroutine argument to automatic array in order to do
-! re-ordering from f_in to f_inv in one step, one array work is needed instead
-! of work1 and work2
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2004/04/30 13:12:17  raasch
-! Switched from mpi_alltoallv to the simpler mpi_alltoall,
-! all former transpose-routine files collected in this file, enlarged
-! transposition arrays introduced
-!
-! Revision 1.1  2004/04/30 13:08:16  raasch
-! Initial revision (collection of former routines transpose_xy, transpose_xz,
-!                   transpose_yx, transpose_yz, transpose_zx, transpose_zy)
-!
 ! Revision 1.1  1997/07/24 11:25:18  raasch
 ! Initial revision
@@ -88,15 +71,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nx
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_z, nxr_z, nyn_x, nyn_z, nys_x, nys_z, nzb_x, nzt_x
 
      IMPLICIT NONE
 
-     REAL ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-     REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x)  !: 
+     REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -128,16 +117,29 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nx, ny
+        
+    USE kinds
+
     USE pegrid
-    USE transpose_indices
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxr_y, nyn_x, nys_x, nzb_x, nzb_y, nzt_x, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, ys
-    
-    REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx), f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-
-    REAL, DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  ys !: 
+ 
+    REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+    REAL(wp) ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y) !: 
+
+    REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !: 
 
 
@@ -207,15 +209,17 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nxl, nxr, nyn, nys, nz
+
+     USE kinds
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz)
-     REAL ::  f_out(1:nz,nys:nyn,nxl:nxr)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+     REAL(wp) ::  f_out(1:nz,nys:nyn,nxl:nxr) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -249,16 +253,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nx, nxl, nxr, ny, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zx
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, xs
-    
-    REAL ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x), f_inv(nys:nyn,nxl:nxr,1:nz)
-
-    REAL, DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+
+    REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !: 
 
 
@@ -331,15 +350,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nx
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-     REAL ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+     REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -371,16 +396,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nx, ny
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dy, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               numprocs, pdims, sendrecvcount_xy
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxr_y, nyn_x, nys_x, nzb_x, nzb_y, nzt_x, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, ys
-    
-    REAL ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y), f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-
-    REAL, DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  ys !: 
+
+    REAL(wp) ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)  !: 
+    REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+
+    REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !: 
 
 
@@ -453,17 +493,32 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nny, nnz, nx, nxl, nxr, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_xy
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, m, xs
-
-    REAL ::  f_in(1:nz,nys:nyn,nxl:nxr), f_inv(nxl:nxr,1:nz,nys:nyn), &
-             f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x),                     &
-             work(nnx*nny*nnz)
-
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  m  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)          !: 
+    REAL(wp) ::  f_inv(nxl:nxr,1:nz,nys:nyn)         !: 
+    REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+    REAL(wp) ::  work(nnx*nny*nnz)                   !: 
 #if defined( __parallel )
 
@@ -517,14 +572,20 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  ny
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_y, nxr_y, nzb_y, nzt_y
 
      IMPLICIT NONE
 
-     REAL ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-     REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)  !: 
+     REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -557,16 +618,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_yz
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nyn_z, nys_z, nzb_y, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, zs
-    
-    REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny), f_out(nxl_z:nxr_z,nys_z:nyn_z,1:nz)
-
-    REAL, DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  zs !: 
+
+    REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+    REAL(wp) ::  f_out(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !: 
+
+    REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !: 
 
 
@@ -637,14 +713,17 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nxl, nxr, nyn, nys, nz
+
+     USE kinds
 
      IMPLICIT NONE
 
-     REAL ::  f_in(1:nz,nys:nyn,nxl:nxr)
-     REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)  !: 
+     REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -677,16 +756,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nx, nxl, nxr, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zx
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, xs
-    
-    REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz), f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-
-    REAL, DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz)         !: 
+    REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+
+    REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !: 
 
 
@@ -757,14 +851,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  ny
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_y, nxr_y, nzb_y, nzt_y
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-     REAL ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+     REAL(wp) ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -797,17 +898,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_yz
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nyn_z, nys_z, nzb_y, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, zs
-    
-    REAL ::  f_in(nxl_z:nxr_z,nys_z:nyn_z,1:nz), f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-
-    REAL, DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work
-
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  zs !: 
+
+    REAL(wp) ::  f_in(nxl_z:nxr_z,nys_z:nyn_z,1:nz)  !: 
+    REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+
+    REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !:
 
 !
@@ -881,16 +996,32 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nny, nnz, nxl, nxr, nyn, nys, ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dy, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zyd
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_yd, nxr_y, nxr_yd, nzb_y, nzb_yd, nzt_y, nzt_yd
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, m, ys
-    
-    REAL ::  f_in(1:nz,nys:nyn,nxl:nxr), f_inv(nys:nyn,nxl:nxr,1:nz), &
-             f_out(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd),                 &
-             work(nnx*nny*nnz)
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  m  !: 
+    INTEGER(iwp) ::  ys !: 
+
+    REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)              !: 
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz)             !: 
+    REAL(wp) ::  f_out(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) !: 
+    REAL(wp) ::  work(nnx*nny*nnz)                       !: 
 
 #if defined( __parallel )
