1 | subroutine create_MPI_data_type(nx,ny,nz,locnx,locnz, |
---|
2 | * twoslice,subslice,myid,comm) |
---|
3 | |
---|
4 | c Routine to create a specialized data type for MPI data swaps |
---|
5 | c between processors. See real and complex data maps for details. |
---|
6 | |
---|
7 | implicit none |
---|
8 | #include "mpif.h" |
---|
9 | integer nx,ny,nz,locnx,locnz |
---|
10 | integer myid,comm,ierr |
---|
11 | integer sizeofreal,oneslice,twoslice,subslice |
---|
12 | |
---|
13 | call MPI_TYPE_EXTENT(MPI_REAL,sizeofreal,ierr) |
---|
14 | |
---|
15 | |
---|
16 | c data type for 1d section of basic data slice: 2*locnx |
---|
17 | call MPI_TYPE_VECTOR(2*locnx,1,1,MPI_REAL,oneslice,ierr) |
---|
18 | |
---|
19 | c data type for 2d section of basic data slice: ny+1 1d sections |
---|
20 | call MPI_TYPE_HVECTOR(ny+1,1,(nx+2)*sizeofreal,oneslice,twoslice,ierr) |
---|
21 | if( myid .eq. 0 ) then |
---|
22 | if( ierr .ne. 0 ) write(6,*) ' TYPE_HVECTOR twoslice failure' |
---|
23 | endif |
---|
24 | call MPI_TYPE_COMMIT(twoslice,ierr) |
---|
25 | |
---|
26 | c data type for 3d section of basic data slice: locnz 2d sections |
---|
27 | call MPI_TYPE_HVECTOR(locnz,1,(nx+2)*(ny+1)*sizeofreal, |
---|
28 | * twoslice,subslice,ierr) |
---|
29 | if( myid .eq. 0 ) then |
---|
30 | if( ierr .ne. 0 ) write(6,*) ' TYPE_HVECTOR subslice failure' |
---|
31 | endif |
---|
32 | call MPI_TYPE_COMMIT(subslice,ierr) |
---|
33 | |
---|
34 | return |
---|
35 | end |
---|