OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_i20exch_n.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/.
23C
24!||====================================================================
25!|| spmd_i20exch_n ../engine/source/mpi/interfaces/spmd_i20exch_n.F
26!||--- called by ------------------------------------------------------
27!|| i20mainf ../engine/source/interfaces/int20/i20mainf.F
28!||--- calls -----------------------------------------------------
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
31!||====================================================================
32 SUBROUTINE spmd_i20exch_n(XNORM,IAD_ELEM,FR_ELEM,LENR)
33C realise la sommation des normales aux points frontiere
34C-----------------------------------------------
35C I m p l i c i t T y p e s
36C-----------------------------------------------
37 USE spmd_comm_world_mod, ONLY : spmd_comm_world
38#include "implicit_f.inc"
39C-----------------------------------------------------------------
40C M e s s a g e P a s s i n g
41C-----------------------------------------------
42#include "spmd.inc"
43C-----------------------------------------------
44C C o m m o n B l o c k s
45C-----------------------------------------------
46#include "com01_c.inc"
47#include "task_c.inc"
48C-----------------------------------------------
49C D u m m y A r g u m e n t s
50C-----------------------------------------------
51 INTEGER IAD_ELEM(2,*),FR_ELEM(*), SIZE, LENR
52 INTEGER XNORM(3,*)
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
56#ifdef MPI
57 INTEGER MSGTYP,I,NOD,LOC_PROC,IERROR,MSGOFF,
58 . SIZ,J,K,L,NB_NOD,
59 . STATUS(MPI_STATUS_SIZE),
60 . IAD_SEND(NSPMD+1),IAD_RECV(NSPMD+1),
61 . REQ_R(NSPMD),REQ_S(NSPMD)
62 INTEGER SBUF(LENR*3),RBUF(LENR*3)
63 DATA msgoff/163/
64C-----------------------------------------------
65C S o u r c e L i n e s
66C-----------------------------------------------
67C
68 loc_proc = ispmd+1
69 l = 1
70 iad_recv(1)=1
71
72C Mise en place des buffers de reception
73 DO i=1,nspmd
74 siz = 3*(iad_elem(1,i+1)-iad_elem(1,i))
75 IF(siz/=0) THEN
76 msgtyp = msgoff
77 CALL mpi_irecv(
78 s rbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
79 g spmd_comm_world,req_r(i),ierror)
80 l = l+siz
81 END IF
82 iad_recv(i+1) = l
83 END DO
84
85C Remplissage des buffers d'envoi et envoi des donnees
86 l=1
87 iad_send(1)=1
88 DO i=1,nspmd
89 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
90 nod = fr_elem(j)
91 sbuf(l ) = xnorm(1,nod)
92 sbuf(l+1) = xnorm(2,nod)
93 sbuf(l+2) = xnorm(3,nod)
94 l = l+3
95 END DO
96 iad_send(i+1) = l
97 END DO
98
99 DO i=1,nspmd
100
101 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
102
103 msgtyp = msgoff
104 siz = iad_send(i+1)-iad_send(i)
105 l = iad_send(i)
106 CALL mpi_isend(
107 s sbuf(l),siz,mpi_integer,it_spmd(i),msgtyp,
108 g spmd_comm_world,req_s(i),ierror)
109 ENDIF
110 END DO
111
112C Reception et traitement
113 DO i = 1, nspmd
114C
115 nb_nod = iad_elem(1,i+1)-iad_elem(1,i)
116 IF(nb_nod>0)THEN
117 CALL mpi_wait(req_r(i),status,ierror)
118 l = iad_recv(i)
119
120 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
121
122 nod = fr_elem(j)
123 xnorm(1,nod) = xnorm(1,nod) + rbuf(l)
124 xnorm(2,nod) = xnorm(2,nod) + rbuf(l+1)
125 xnorm(3,nod) = xnorm(3,nod) + rbuf(l+2)
126 l = l+3
127 ENDDO
128 ENDIF
129 ENDDO
130
131 DO i = 1, nspmd
132 IF(iad_elem(1,i+1)-iad_elem(1,i)>0)THEN
133 CALL mpi_wait(req_s(i),status,ierror)
134 ENDIF
135 ENDDO
136
137#endif
138 RETURN
139 END
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
Definition mpi.f:382
subroutine mpi_wait(ireq, status, ierr)
Definition mpi.f:525
subroutine mpi_irecv(buf, cnt, datatype, source, tag, comm, ireq, ierr)
Definition mpi.f:372
subroutine spmd_i20exch_n(xnorm, iad_elem, fr_elem, lenr)