FrontISTR  5.2.0
Large-scale structural analysis program with finit element method
hecmw_solver_SR_22.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_22
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 = 2*nod_export(k)
67  ws(2*k-1)= x(ii-1)
68  ws(2*k )= x(ii )
69  enddo
70 
71  call mpi_isend (ws(2*istart+1), 2*inum,mpi_double_precision, &
72  & neibpe(neib), 0, solver_comm, req1(nreq1), ierr)
73  enddo
74 
75  !C
76  !C-- RECEIVE
77  nreq2=0
78  do neib= 1, neibpetot
79  istart= stack_import(neib-1)
80  inum = stack_import(neib ) - istart
81  if (inum==0) cycle
82  nreq2=nreq2+1
83  call mpi_irecv (wr(2*istart+1), 2*inum, mpi_double_precision, &
84  & neibpe(neib), 0, solver_comm, req2(nreq2), ierr)
85  enddo
86 
87  call mpi_waitall (nreq2, req2, sta2, ierr)
88 
89  do neib= 1, neibpetot
90  istart= stack_import(neib-1)
91  inum = stack_import(neib ) - istart
92  do k= istart+1, istart+inum
93  ii = 2*nod_import(k)
94  x(ii-1)= wr(2*k-1)
95  x(ii )= wr(2*k )
96  enddo
97  enddo
98 
99  call mpi_waitall (nreq1, req1, sta1, ierr)
100  deallocate (sta1, sta2, req1, req2)
101 #endif
102  end subroutine hecmw_solve_send_recv_22
103 end module hecmw_solver_sr_22
subroutine hecmw_solve_send_recv_22(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