FrontISTR  5.2.0
Large-scale structural analysis program with finit element method
hecmw_solver_SR_44.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
5 
6 !C
7 !C***
8 !C*** module hecmw_solver_SR_44
9 !C***
10 !C
12 contains
13  !C
14  !C*** SOLVER_SEND_RECV
15  !C
17  & ( n, neibpetot, neibpe, stack_import, nod_import, &
18  & stack_export, nod_export, &
19  & ws, wr, x, solver_comm,my_rank)
20 
21  use hecmw_util
22  implicit real*8 (a-h,o-z)
23  ! include 'mpif.h'
24  ! include 'hecmw_config_f.h'
25 
26  integer(kind=kint ) , intent(in) :: N
27  integer(kind=kint ) , intent(in) :: NEIBPETOT
28  integer(kind=kint ), pointer :: NEIBPE (:)
29  integer(kind=kint ), pointer :: STACK_IMPORT(:)
30  integer(kind=kint ), pointer :: NOD_IMPORT (:)
31  integer(kind=kint ), pointer :: STACK_EXPORT(:)
32  integer(kind=kint ), pointer :: NOD_EXPORT (:)
33  real (kind=kreal), dimension(: ), intent(inout):: ws
34  real (kind=kreal), dimension(: ), intent(inout):: wr
35  real (kind=kreal), dimension(: ), intent(inout):: x
36  integer(kind=kint ) , intent(in) ::SOLVER_COMM
37  integer(kind=kint ) , intent(in) :: my_rank
38 
39 #ifndef HECMW_SERIAL
40  integer(kind=kint ), dimension(:,:), allocatable :: sta1
41  integer(kind=kint ), dimension(:,:), allocatable :: sta2
42  integer(kind=kint ), dimension(: ), allocatable :: req1
43  integer(kind=kint ), dimension(: ), allocatable :: req2
44 
45  integer(kind=kint ), save :: NFLAG
46  data nflag/0/
47 
48  ! local valiables
49  integer(kind=kint ) :: neib,istart,inum,k,ii,ierr,nreq1,nreq2
50  !C
51  !C-- INIT.
52  allocate (sta1(mpi_status_size,neibpetot))
53  allocate (sta2(mpi_status_size,neibpetot))
54  allocate (req1(neibpetot))
55  allocate (req2(neibpetot))
56 
57  !C
58  !C-- SEND
59  nreq1=0
60  do neib= 1, neibpetot
61  istart= stack_export(neib-1)
62  inum = stack_export(neib ) - istart
63  if (inum==0) cycle
64  nreq1=nreq1+1
65  do k= istart+1, istart+inum
66  ii = 4*nod_export(k)
67  ws(4*k-3)= x(ii-3)
68  ws(4*k-2)= x(ii-2)
69  ws(4*k-1)= x(ii-1)
70  ws(4*k )= x(ii )
71  enddo
72 
73  call mpi_isend (ws(4*istart+1), 4*inum,mpi_double_precision, &
74  & neibpe(neib), 0, solver_comm, req1(nreq1), ierr)
75  enddo
76 
77  !C
78  !C-- RECEIVE
79  nreq2=0
80  do neib= 1, neibpetot
81  istart= stack_import(neib-1)
82  inum = stack_import(neib ) - istart
83  if (inum==0) cycle
84  nreq2=nreq2+1
85  call mpi_irecv (wr(4*istart+1), 4*inum, mpi_double_precision, &
86  & neibpe(neib), 0, solver_comm, req2(nreq2), ierr)
87  enddo
88 
89  call mpi_waitall (nreq2, req2, sta2, ierr)
90 
91  do neib= 1, neibpetot
92  istart= stack_import(neib-1)
93  inum = stack_import(neib ) - istart
94  do k= istart+1, istart+inum
95  ii = 4*nod_import(k)
96  x(ii-3)= wr(4*k-3)
97  x(ii-2)= wr(4*k-2)
98  x(ii-1)= wr(4*k-1)
99  x(ii )= wr(4*k )
100  enddo
101  enddo
102 
103  call mpi_waitall (nreq1, req1, sta1, ierr)
104  deallocate (sta1, sta2, req1, req2)
105 #endif
106  end subroutine hecmw_solve_send_recv_44
107 end module hecmw_solver_sr_44
subroutine hecmw_solve_send_recv_44(N, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, X, SOLVER_COMM, my_rank)
I/O and Utility.
Definition: hecmw_util_f.F90:7
integer(kind=4), parameter kreal