OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_fvb_aoff.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_fvb_aoff ../engine/source/mpi/anim/spmd_fvb_aoff.F
25!||--- called by ------------------------------------------------------
26!|| genani ../engine/source/output/anim/generate/genani.F
27!||--- calls -----------------------------------------------------
28!|| write_c_c ../common_source/tools/input_output/write_routtines.c
29!||--- uses -----------------------------------------------------
30!|| fvbag_mod ../engine/share/modules/fvbag_mod.F
31!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
32!||====================================================================
33 SUBROUTINE spmd_fvb_aoff(FVEL2FA)
34C-----------------------------------------------
35C M o d u l e s
36C-----------------------------------------------
37 USE fvbag_mod
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 "task_c.inc"
51C-----------------------------------------------
52C D u m m y A r g u m e n t s
53C-----------------------------------------------
54 INTEGER FVEL2FA(*)
55C-----------------------------------------------
56C L o c a l V a r i a b l e s
57C-----------------------------------------------
58#ifdef MPI
59 INTEGER ELOFF, I, PMAIN, J, K, KK, N, NN, N1, N2, N3, NND,
60 . ITAG, NNTR, IERR, STAT(MPI_STATUS_SIZE), JJ, IAD,
61 . LEN, MSGOFF,MSGOFF2
62 INTEGER, DIMENSION(:), ALLOCATABLE :: OFFTR, IBUF, ITAGT
63C-----------------------------------------------
64 DATA msgoff/7041/
65 DATA msgoff2/7042/
66C-----------------------------------------------
67C
68 eloff=0
69 DO i=1,nfvbag
70 pmain=fvspmd(i)%PMAIN
71 IF (ispmd==0) THEN
72 IF (ispmd==pmain-1) THEN
73 ALLOCATE(offtr(fvdata(i)%NNTR))
74 DO j=1,fvdata(i)%NNTR
75 offtr(j)=0
76 ENDDO
77 DO j=1,fvdata(i)%NPOLH
78 DO k=fvdata(i)%IFVPADR(j),fvdata(i)%IFVPADR(j+1)-1
79 kk=fvdata(i)%IFVPOLH(k)
80 DO n=fvdata(i)%IFVTADR(kk),
81 . fvdata(i)%IFVTADR(kk+1)-1
82 nn=fvdata(i)%IFVPOLY(n)
83 IF (nn>0) THEN
84 n1=fvdata(i)%IFVTRI_ANIM(1,nn)
85 n2=fvdata(i)%IFVTRI_ANIM(2,nn)
86 n3=fvdata(i)%IFVTRI_ANIM(3,nn)
87 nnd=1
88 IF (n2/=n1) nnd=nnd+1
89 IF (n3/=n2.AND.n3/=n1) nnd=nnd+1
90C
91 nn=fvel2fa(eloff+nn)-eloff
92 IF (nnd==3) offtr(nn)=1
93 ENDIF
94 ENDDO
95 ENDDO
96 ENDDO
97 eloff=eloff+fvdata(i)%NNTR
98 CALL write_c_c(offtr,fvdata(i)%NNTR)
99 DEALLOCATE(offtr)
100 ELSE
101 itag=msgoff
102 CALL mpi_recv(nntr, 1, mpi_integer, it_spmd(pmain),
103 . itag, spmd_comm_world, stat, ierr)
104C
105 len=2*nntr
106 ALLOCATE(ibuf(len), offtr(nntr))
107 itag=msgoff2
108 CALL mpi_recv(ibuf, len, mpi_integer, it_spmd(pmain),
109 . itag, spmd_comm_world, stat, ierr)
110C
111 DO j=1,nntr
112 offtr(j)=0
113 ENDDO
114 jj=0
115 DO j=1,nntr
116 nn=ibuf(jj+1)
117 IF (nn /=0 ) THEN
118 nn=fvel2fa(eloff+nn)-eloff
119 offtr(nn)=ibuf(jj+2)
120 ENDIF
121 jj=jj+2
122 ENDDO
123 eloff=eloff+nntr
124 CALL write_c_c(offtr,nntr)
125 DEALLOCATE(ibuf, offtr)
126 ENDIF
127 ELSE
128 IF (ispmd==pmain-1) THEN
129 itag=msgoff
130 CALL mpi_send(fvdata(i)%NNTR, 1, mpi_integer,
131 . it_spmd(1), itag, spmd_comm_world,
132 . ierr)
133C
134 len=2*fvdata(i)%NNTR
135 ALLOCATE(ibuf(len), itagt(fvdata(i)%NNTR))
136 DO j=1,len
137 ibuf(j)=0
138 ENDDO
139 DO j=1,fvdata(i)%NNTR
140 itagt(j)=0
141 ENDDO
142 iad=0
143 DO j=1,fvdata(i)%NPOLH
144 DO k=fvdata(i)%IFVPADR(j),fvdata(i)%IFVPADR(j+1)-1
145 kk=fvdata(i)%IFVPOLH(k)
146 DO n=fvdata(i)%IFVTADR(kk),
147 . fvdata(i)%IFVTADR(kk+1)-1
148 nn=fvdata(i)%IFVPOLY(n)
149 IF (nn>0.AND.itagt(nn)==0) THEN
150 n1=fvdata(i)%IFVTRI_ANIM(1,nn)
151 n2=fvdata(i)%IFVTRI_ANIM(2,nn)
152 n3=fvdata(i)%IFVTRI_ANIM(3,nn)
153 nnd=1
154 IF (n2/=n1) nnd=nnd+1
155 IF (n3/=n2.AND.n3/=n1) nnd=nnd+1
156C
157 ibuf(iad+1)=nn
158 IF (nnd==3) ibuf(iad+2)=1
159 iad=iad+2
160 itagt(nn)=1
161 ENDIF
162 ENDDO
163 ENDDO
164 ENDDO
165 itag=msgoff2
166 CALL mpi_send(ibuf, len, mpi_integer, it_spmd(1),
167 . itag, spmd_comm_world, ierr)
168C
169 DEALLOCATE(ibuf, itagt)
170 ENDIF
171 ENDIF
172 ENDDO
173C
174#endif
175 RETURN
176 END
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
type(fvbag_spmd), dimension(:), allocatable fvspmd
Definition fvbag_mod.F:129
type(fvbag_data), dimension(:), allocatable fvdata
Definition fvbag_mod.F:128
integer nfvbag
Definition fvbag_mod.F:127
subroutine spmd_fvb_aoff(fvel2fa)
void write_c_c(int *w, int *len)