OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_velvec2.F File Reference
#include "implicit_f.inc"
#include "spmd.inc"
#include "com01_c.inc"
#include "com04_c.inc"
#include "task_c.inc"
#include "spmd_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine spmd_velvec2 (v, nodglob, rbuf, numpog)

Function/Subroutine Documentation

◆ spmd_velvec2()

subroutine spmd_velvec2 ( v,
integer, dimension(*) nodglob,
integer rbuf,
integer numpog )

Definition at line 32 of file spmd_velvec2.F.

33C-----------------------------------------------
34C I m p l i c i t T y p e s
35C-----------------------------------------------
36 USE spmd_comm_world_mod, ONLY : spmd_comm_world
37#include "implicit_f.inc"
38#include "spmd.inc"
39C-----------------------------------------------
40C C o m m o n B l o c k s
41C-----------------------------------------------
42#include "com01_c.inc"
43#include "com04_c.inc"
44#include "task_c.inc"
45#include "spmd_c.inc"
46C-----------------------------------------------
47C D u m m y A r g u m e n t s
48C-----------------------------------------------
49 INTEGER NODGLOB(*),RBUF,NUMPOG
50
51 my_real
52 . v(3,*)
53
54C-----------------------------------------------
55C L O C A L V A R I A B L E S
56C-----------------------------------------------
57#ifdef MPI
58 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
59 INTEGER SIZ, MSGTYP, I, J, K, MSGOFF2
60 INTEGER, DIMENSION(:), ALLOCATABLE :: NGLOBI
61 my_real,
62 * DIMENSION(:,:),ALLOCATABLE :: vrecv
63 REAL, DIMENSION(:,:),ALLOCATABLE :: VTOTAL
64
65
66 DATA msgoff/7024/
67 DATA msgoff2/7025/
68C-----------------------------------------------
69 ALLOCATE(nglobi(rbuf))
70 ALLOCATE(vrecv(3,rbuf))
71 ALLOCATE(vtotal(3,numpog))
72
73 IF (ispmd/=0) THEN
74C sending the nodglob
75 msgtyp = msgoff
76
77 CALL mpi_send(nodglob,numnod,mpi_integer,it_spmd(1),msgtyp,
78 . spmd_comm_world,ierror)
79
80 msgtyp = msgoff2
81 CALL mpi_send(v,3*numnod,real,it_spmd(1),msgtyp,
82 . spmd_comm_world,ierror)
83
84 ELSE
85 DO i=1,numnodg
86 vtotal(1,i) = zero
87 vtotal(2,i) = zero
88 vtotal(3,i) = zero
89 ENDDO
90
91 DO i=1,numnod
92 k = nodglob(i)
93 vtotal(1,k)= vtotal(1,k) + v(1,i)
94 vtotal(2,k)= vtotal(2,k) + v(2,i)
95 vtotal(3,k)= vtotal(3,k) + v(3,i)
96 ENDDO
97 DO i=2,nspmd
98
99C reception of the entire buffer of NODGLOB addresses
100 msgtyp = msgoff
101
102 CALL mpi_probe(it_spmd(i),msgtyp,
103 . spmd_comm_world,status,ierror)
104 CALL mpi_get_count(status,mpi_integer,siz,ierror)
105
106 CALL mpi_recv(nglobi,siz,mpi_integer,it_spmd(i),msgtyp,
107 . spmd_comm_world,status,ierror)
108
109 msgtyp = msgoff2
110 CALL mpi_recv(vrecv,3*siz,real,it_spmd(i),msgtyp,
111 . spmd_comm_world,status,ierror)
112
113 DO j = 1, siz
114 k = nglobi(j)
115 vtotal(1,k)= vtotal(1,k) + vrecv(1,j)
116 vtotal(2,k)= vtotal(2,k) + vrecv(2,j)
117 vtotal(3,k)= vtotal(3,k) + vrecv(3,j)
118 ENDDO
119 ENDDO
120 CALL write_r_c(vtotal,3*numnodg)
121
122 ENDIF
123
124 DEALLOCATE(nglobi)
125 DEALLOCATE(vrecv)
126
127#endif
128 RETURN
#define my_real
Definition cppsort.cpp: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
void write_r_c(float *w, int *len)