OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_userwi.F File Reference
#include "implicit_f.inc"
#include "spmd.inc"
#include "com01_c.inc"
#include "task_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine spmd_exch_userwi (a, ar, user_windows)

Function/Subroutine Documentation

◆ spmd_exch_userwi()

subroutine spmd_exch_userwi ( a,
ar,
type(user_windows_), intent(inout) user_windows )

Definition at line 32 of file spmd_exch_userwi.F.

33C-----------------------------------------------
34C M o d u l e s
35C-----------------------------------------------
37C-----------------------------------------------
38C I m p l i c i t T y p e s
39C-----------------------------------------------
40 USE spmd_comm_world_mod, ONLY : spmd_comm_world
41#include "implicit_f.inc"
42C-----------------------------------------------------------------
43C M e s s a g e P a s s i n g
44C-----------------------------------------------
45#include "spmd.inc"
46C-----------------------------------------------
47C C o m m o n B l o c k s
48C-----------------------------------------------
49#include "com01_c.inc"
50#include "task_c.inc"
51C-----------------------------------------------
52C D u m m y A r g u m e n t s
53C-----------------------------------------------
54 TYPE(USER_WINDOWS_),INTENT(INOUT) :: USER_WINDOWS
56 * a(3,*),ar(3,*)
57C-----------------------------------------------
58C L o c a l V a r i a b l e s
59C-----------------------------------------------
60#ifdef MPI
61 INTEGER MSGOFF,MSGTYP,P,I,ND,IAD,NUM,SIZ,
62 . STATUS(MPI_STATUS_SIZE),IERROR,LOC_PROC
63
65 * , DIMENSION(:,:), ALLOCATABLE :: rbuf,sbuf
66
67 DATA msgoff/227/
68C-----------------------------------------------
69 loc_proc = ispmd + 1
70 IF (ispmd==0)THEN
71 siz = user_windows%IAD_USERW(nspmd+1)-1
72 ALLOCATE( sbuf(6,siz))
73 DO p=2,nspmd
74 num = user_windows%IAD_USERW(p+1)-user_windows%IAD_USERW(p)
75
76 IF(num > 0)THEN
77 iad = user_windows%IAD_USERW(p)
78 DO i=1,num
79 nd = user_windows%FR_USERW(iad+i-1)
80 sbuf(1,iad+i-1)=a(1,nd)
81 sbuf(2,iad+i-1)=a(2,nd)
82 sbuf(3,iad+i-1)=a(3,nd)
83 sbuf(4,iad+i-1)=ar(1,nd)
84 sbuf(5,iad+i-1)=ar(2,nd)
85 sbuf(6,iad+i-1)=ar(3,nd)
86 ENDDO
87 ENDIF
88 ENDDO
89
90 DO p=2,nspmd
91 num = user_windows%IAD_USERW(p+1)-user_windows%IAD_USERW(p)
92 iad = user_windows%IAD_USERW(p)
93 IF(num > 0)THEN
94 msgtyp=msgoff
95 CALL mpi_send(sbuf(1,iad),6*num,real,it_spmd(p),msgtyp,
96 . spmd_comm_world,ierror)
97 ENDIF
98 ENDDO
99 DEALLOCATE(sbuf)
100 ELSE
101 num = user_windows%S_FR_USERW
102 ALLOCATE(rbuf(6,num))
103 IF(num > 0)THEN
104 msgtyp = msgoff
105 CALL mpi_recv(rbuf,6*num,real,it_spmd(1),msgtyp,
106 . spmd_comm_world,status,ierror)
107 DO i=1,num
108 nd=user_windows%FR_USERW(i)
109 a(1,nd)=a(1,nd)+rbuf(1,i)
110 a(2,nd)=a(2,nd)+rbuf(2,i)
111 a(3,nd)=a(3,nd)+rbuf(3,i)
112 ar(1,nd)=a(1,nd)+rbuf(4,i)
113 ar(2,nd)=a(2,nd)+rbuf(5,i)
114 ar(3,nd)=a(3,nd)+rbuf(6,i)
115 ENDDO
116 ENDIF
117 DEALLOCATE(rbuf)
118 ENDIF
119
120#endif
121 RETURN
#define my_real
Definition cppsort.cpp:32
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
Definition mpi.f:461
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
Definition mpi.f:480