Index: palm/trunk/SOURCE/transpose.f90
===================================================================
--- palm/trunk/SOURCE/transpose.f90	(revision 623)
+++ palm/trunk/SOURCE/transpose.f90	(revision 683)
@@ -4,5 +4,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! openMP parallelization of transpositions for 2d-domain-decomposition
 !
 ! Former revisions:
@@ -61,4 +61,6 @@
 !-- Rearrange indices of input array in order to make data to be send
 !-- by MPI contiguous
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
     DO  i = 0, nxa
        DO  k = nzb_x, nzt_xa
@@ -68,4 +70,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -80,6 +83,9 @@
 !
 !-- Reorder transposed array
-    m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, ys )
+!$OMP  DO
     DO  l = 0, pdims(2) - 1
+       m  = l * ( nxr_ya - nxl_y + 1 ) * ( nzt_ya - nzb_y + 1 ) * &
+                ( nyn_xa - nys_x + 1 )
        ys = 0 + l * ( nyn_xa - nys_x + 1 )
        DO  i = nxl_y, nxr_ya
@@ -92,4 +98,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 #endif
@@ -131,6 +138,8 @@
 !
 !--    Reorder input array for transposition
-       m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, xs )
+!$OMP  DO
        DO  l = 0, pdims(1) - 1
+          m  = l * ( nzt_xa - nzb_x + 1 ) * nnx * ( nyn_xa - nys_x + 1 )
           xs = 0 + l * nnx
           DO  k = nzb_x, nzt_xa
@@ -143,4 +152,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -155,4 +165,6 @@
 !
 !--    Reorder transposed array in a way that the z index is in first position
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  k = 1, nza
           DO  i = nxl, nxra
@@ -162,7 +174,10 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
     ELSE
 !
 !--    Reorder the array in a way that the z index is in first position
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  i = nxl, nxra
           DO  j = nys, nyna
@@ -172,5 +187,8 @@
           ENDDO
        ENDDO
-
+!$OMP  END PARALLEL
+
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  k = 1, nza
           DO  i = nxl, nxra
@@ -180,4 +198,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
 
     ENDIF
@@ -218,6 +237,9 @@
 !
 !-- Reorder input array for transposition
-    m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, ys )
+!$OMP  DO
     DO  l = 0, pdims(2) - 1
+       m  = l * ( nxr_ya - nxl_y + 1 ) * ( nzt_ya - nzb_y + 1 ) * &
+                ( nyn_xa - nys_x + 1 )
        ys = 0 + l * ( nyn_xa - nys_x + 1 )
        DO  i = nxl_y, nxr_ya
@@ -230,4 +252,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -242,4 +265,6 @@
 !
 !-- Reorder transposed array in a way that the x index is in first position
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
     DO  i = 0, nxa
        DO  k = nzb_x, nzt_xa
@@ -249,4 +274,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 #endif
@@ -353,4 +379,6 @@
 !-- Rearrange indices of input array in order to make data to be send
 !-- by MPI contiguous
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
     DO  j = 0, nya
        DO  k = nzb_y, nzt_ya
@@ -360,4 +388,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -367,4 +396,6 @@
 !-- of the data is necessary and no transposition has to be done.
     IF ( pdims(1) == 1 )  THEN
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  j = 0, nya
           DO  k = nzb_y, nzt_ya
@@ -374,4 +405,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
        RETURN
     ENDIF
@@ -388,6 +420,9 @@
 !
 !-- Reorder transposed array
-    m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, zs )
+!$OMP  DO
     DO  l = 0, pdims(1) - 1
+       m  = l * ( nyn_za - nys_z + 1 ) * ( nzt_ya - nzb_y + 1 ) * &
+                ( nxr_za - nxl_z + 1 )
        zs = 1 + l * ( nzt_ya - nzb_y + 1 )
        DO  j = nys_z, nyn_za
@@ -400,4 +435,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 #endif
@@ -435,4 +471,6 @@
 !-- Rearrange indices of input array in order to make data to be send
 !-- by MPI contiguous
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
     DO  k = 1,nza
        DO  i = nxl, nxra
@@ -442,4 +480,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -449,4 +488,6 @@
 !-- of the data is necessary and no transposition has to be done.
     IF ( pdims(1) == 1 )  THEN
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  k = 1, nza
           DO  i = nxl, nxra
@@ -456,4 +497,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
        RETURN
     ENDIF
@@ -470,6 +512,8 @@
 !
 !-- Reorder transposed array
-    m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, xs )
+!$OMP  DO
     DO  l = 0, pdims(1) - 1
+       m  = l * ( nzt_xa - nzb_x + 1 ) * nnx * ( nyn_xa - nys_x + 1 )
        xs = 0 + l * nnx
        DO  k = nzb_x, nzt_xa
@@ -482,4 +526,5 @@
        ENDDO
     ENDDO
+!$OMP  END PARALLEL
 
 #endif
@@ -521,6 +566,9 @@
 !
 !--    Reorder input array for transposition
-       m = 0
+!$OMP  PARALLEL PRIVATE ( i, j, k, l, m, zs )
+!$OMP  DO
        DO  l = 0, pdims(1) - 1
+          m  = l * ( nyn_za - nys_z + 1 ) * ( nzt_ya - nzb_y + 1 ) * &
+                   ( nxr_za - nxl_z + 1 )
           zs = 1 + l * ( nzt_ya - nzb_y + 1 )
           DO  j = nys_z, nyn_za
@@ -533,4 +581,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
 
 !
@@ -545,4 +594,6 @@
 !
 !--    Reorder transposed array in a way that the y index is in first position
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  j = 0, nya
           DO  k = nzb_y, nzt_ya
@@ -552,7 +603,10 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
     ELSE
 !
 !--    Reorder the array in a way that the y index is in first position
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  k = nzb_y, nzt_ya
           DO  j = 0, nya
@@ -562,6 +616,9 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
 !
 !--    Move data to output array
+!$OMP  PARALLEL PRIVATE ( i, j, k )
+!$OMP  DO
        DO  k = nzb_y, nzt_ya
           DO  i = nxl_y, nxr_ya
@@ -571,4 +628,5 @@
           ENDDO
        ENDDO
+!$OMP  END PARALLEL
 
     ENDIF
