OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_exch_userwi.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| spmd_exch_userwi ../engine/source/mpi/user_interface/spmd_exch_userwi.F
25!||--- called by ------------------------------------------------------
26!|| user_windows_routine ../engine/source/user_interface/user_windows.F
27!||--- calls -----------------------------------------------------
28!||--- uses -----------------------------------------------------
29!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
30!|| user_windows_mod ../common_source/modules/user_windows_mod.F
31!||====================================================================
32 SUBROUTINE spmd_exch_userwi(A,AR,USER_WINDOWS)
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
122 END
#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
subroutine spmd_exch_userwi(a, ar, user_windows)