OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_iget_partn.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!||====================================================================
25!|| spmd_iget_partn ../engine/source/mpi/anim/spmd_iget_partn.F
26!||--- called by ------------------------------------------------------
27!|| anioff0 ../engine/source/output/anim/generate/anioff0.F
28!|| anioffc ../engine/source/output/anim/generate/anioffc.F
29!|| anioffc_crk ../engine/source/output/anim/generate/anioffc_crk.F
30!|| anioffc_ply ../engine/source/output/anim/generate/anioffc_ply.F
31!|| aniofff ../engine/source/output/anim/generate/aniofff.F
32!|| anioffs ../engine/source/output/anim/generate/anioff6.f
33!|| delnumb0 ../engine/source/output/anim/generate/delnumb0.F
34!|| delnumbc ../engine/source/output/anim/generate/delnumbc.F
35!|| delnumbc_crk ../engine/source/output/anim/generate/delnumbc_crk.F
36!|| delnumbf ../engine/source/output/anim/generate/delnumbf.F
37!|| delnumbs ../engine/source/output/anim/generate/delnumb6.F
38!|| parsor0 ../engine/source/output/anim/generate/parsor0.F
39!|| parsor_crk ../engine/source/output/anim/generate/parsor_crk.F
40!|| parsorc ../engine/source/output/anim/generate/parsorc.F
41!|| parsorf ../engine/source/output/anim/generate/parsorf.F
42!|| parsors ../engine/source/output/anim/generate/parsors.F
43!||--- calls -----------------------------------------------------
44!|| write_c_c ../common_source/tools/input_output/write_routines.c
45!|| write_i_c ../common_source/tools/input_output/write_routines.c
46!||--- uses -----------------------------------------------------
47!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
48!||====================================================================
49 SUBROUTINE spmd_iget_partn(SIZE,NBF_L,NP,NBPART,IADG,SRBUF,IFLAG)
50C gather on p0 of the wa array according to the parts (IADG)
51C-----------------------------------------------
52C I m p l i c i t T y p e s
53C-----------------------------------------------
54 USE spmd_comm_world_mod, ONLY : spmd_comm_world
55#include "implicit_f.inc"
56C-----------------------------------------------
57C M e s s a g e P a s s i n g
58C-----------------------------------------------
59
60#include "spmd.inc"
61
62C-----------------------------------------------
63C C o m m o n B l o c k s
64C-----------------------------------------------
65#include "com01_c.inc"
66#include "task_c.inc"
67C-----------------------------------------------
68C D u m m y A r g u m e n t s
69C-----------------------------------------------
70 INTEGER NBF_L, NP(*),IADG(NSPMD,*),SIZE
71 INTEGER NBPART, IFLAG,SRBUF
72C-----------------------------------------------
73C L o c a l V a r i a b l e s
74C-----------------------------------------------
75#ifdef MPI
76 INTEGER MSGOFF,MSGTYP,IDEB,K,N,NB_TMP,LEN,IADP(NSPMD)
77
78 INTEGER STATUS(MPI_STATUS_SIZE),IERROR
79 INTEGER, DIMENSION(:),ALLOCATABLE :: RBUF
80 DATA msgoff/7029/
81C-----------------------------------------------
82C S o u r c e L i n e s
83C-----------------------------------------------
84C Bug here: The actual recieve buffer size is not the same
85C as the size written. Removing the initialization to -HUGE(IERROR)
86C will cause valgrind errors about uninitialized memory.
87 ALLOCATE(rbuf(srbuf+1))
88 rbuf(1:srbuf) = -huge(ierror)
89
90 IF (ispmd/=0) THEN
91 msgtyp= msgoff
92
93 CALL mpi_send(np,nbf_l,mpi_integer,it_spmd(1),msgtyp,
94 . spmd_comm_world,ierror)
95
96 ELSE
97 DO k=1,nbf_l
98 rbuf(k) = np(k)
99 ENDDO
100 ideb = nbf_l + 1
101 iadp(1) = 1
102C
103 DO k=2,nspmd
104 iadp(k) = ideb
105 msgtyp= msgoff
106
107 CALL mpi_probe(it_spmd(k),msgtyp,
108 . spmd_comm_world,status,ierror)
109 CALL mpi_get_count(status,mpi_integer,nb_tmp,ierror)
110
111 CALL mpi_recv(rbuf(ideb),nb_tmp,mpi_integer,it_spmd(k),msgtyp,
112 . spmd_comm_world,status,ierror)
113
114 ideb = ideb + nb_tmp
115 END DO
116C
117 DO n = 1, nbpart
118 DO k = 1, nspmd
119 IF (n>1) THEN
120 len = (iadg(k,n) - iadg(k,n-1))*SIZE
121 ELSE
122 len = iadg(k,n)*SIZE
123 ENDIF
124
125 IF (iflag==1) THEN
126 IF(len>0)CALL write_i_c(rbuf(iadp(k)),len)
127 ELSEIF(iflag==2) THEN
128 IF(len>0)CALL write_c_c(rbuf(iadp(k)),len)
129 ENDIF
130 iadp(k) = iadp(k) + len
131 ENDDO
132 ENDDO
133 ENDIF
134C
135 DEALLOCATE(rbuf)
136#endif
137 RETURN
138 END
subroutine anioffs(elbuf_tab, iparg, ioff, el2fa, nbf, nbpart, isph3d)
Definition anioffs.F:32
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
Definition mpi.f:461
subroutine mpi_get_count(status, datatype, cnt, ierr)
Definition mpi.f:296
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
Definition mpi.f:480
subroutine mpi_probe(source, tag, comm, status, ierr)
Definition mpi.f:449
subroutine spmd_iget_partn(size, nbf_l, np, nbpart, iadg, srbuf, iflag)
void write_i_c(int *w, int *len)
void write_c_c(int *w, int *len)