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