OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gather_nodal_scalar_mod Module Reference

Functions/Subroutines

subroutine spmd_gather_nodal_scalar (v_glob, num, v, numnod, weight, nodglob)

Function/Subroutine Documentation

◆ spmd_gather_nodal_scalar()

subroutine spmd_gather_nodal_scalar_mod::spmd_gather_nodal_scalar ( real(kind=wp), dimension(num) v_glob,
integer num,
real(kind=wp), dimension(*) v,
integer, intent(in) numnod,
integer, dimension(*) weight,
integer, dimension(*) nodglob )

Definition at line 47 of file spmd_gather_nodal_scalar.F.

48! ----------------------------------------------------------------------------------------------------------------------
49! Modules
50! ----------------------------------------------------------------------------------------------------------------------
51 use spmd_comm_world_mod, only : spmd_comm_world
52 use precision_mod , only : wp
53 use spmd_send_mod, only: spmd_send
54 use spmd_recv_mod, only: spmd_recv
55 use constant_mod , only : zero
56! ----------------------------------------------------------------------------------------------------------------------
57! Implicit none
58! ----------------------------------------------------------------------------------------------------------------------
59 implicit none
60! ----------------------------------------------------------------------------------------------------------------------
61! Included files
62! ----------------------------------------------------------------------------------------------------------------------
63#include "spmd.inc"
64#include "com01_c.inc"
65#include "spmd_c.inc"
66#include "task_c.inc"
67! ----------------------------------------------------------------------------------------------------------------------
68! Arguments
69! ----------------------------------------------------------------------------------------------------------------------
70 real(kind=wp) :: v(*)
71 INTEGER :: WEIGHT(*),NODGLOB(*),NUM
72 integer,intent(in) :: numnod
73 real(kind=wp) :: v_glob(num)
74! ----------------------------------------------------------------------------------------------------------------------
75! Local Variables
76! ----------------------------------------------------------------------------------------------------------------------
77#ifdef MPI
78 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
79 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2
80
81 DATA msgoff/7014/
82 DATA msgoff2/7015/
83 real(kind=wp), DIMENSION(:) , ALLOCATABLE :: bufsr
84 INTEGER, DIMENSION(:) , ALLOCATABLE :: IBUF
85! ----------------------------------------------------------------------------------------------------------------------
86! Body
87! ----------------------------------------------------------------------------------------------------------------------
88 ALLOCATE(bufsr(numnodm), ibuf(numnodm))
89 bufsr = zero
90 IF (ispmd /= 0) THEN
91 siz = 0
92 DO i=1,numnod
93 IF (weight(i)==1) THEN
94 siz = siz + 1
95 ibuf(siz) = nodglob(i)
96 bufsr(siz) = v(i)
97 END IF
98 END DO
99
100 msgtyp = msgoff2
101 CALL spmd_send(ibuf,siz,it_spmd(1),msgtyp)
102 msgtyp = msgoff
103 CALL spmd_send(bufsr,siz,it_spmd(1),msgtyp)
104
105 ELSE
106
107 siz = 0
108 DO i=1,numnod
109 IF (weight(i)==1) THEN
110 siz = siz +1
111 ng = nodglob(i)
112 v_glob(ng) = v(i)
113 ENDIF
114 ENDDO
115
116 DO i=2,nspmd
117 !--- Receiving the full buffer of NODGLOB addresses
118 msgtyp = msgoff2
119 CALL mpi_probe(it_spmd(i),msgtyp,spmd_comm_world,status,ierror)
120 CALL mpi_get_count(status,mpi_integer,siz,ierror)
121 CALL spmd_recv(ibuf,siz,it_spmd(i),msgtyp)
122 !--- Receiving the floating buffer of NODGLOB addresses
123 msgtyp = msgoff
124 CALL spmd_recv(bufsr,siz,it_spmd(i),msgtyp)
125 nrec = siz
126 DO k = 1, nrec
127 ng = ibuf(k)
128 v_glob(ng) = bufsr(k)
129 ENDDO
130 ENDDO
131
132 ENDIF
133 DEALLOCATE(bufsr,ibuf)
134#endif
135
subroutine mpi_get_count(status, datatype, cnt, ierr)
Definition mpi.f:296
subroutine mpi_probe(source, tag, comm, status, ierr)
Definition mpi.f:449