OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_gather_nodal_scalar.F
Go to the documentation of this file.
1!Copyright> OpenRadioss
2!Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3!Copyright>
4!Copyright> This program is free software: you can redistribute it and/or modify
5!Copyright> it under the terms of the GNU Affero General Public License as published by
6!copyright> the free software foundation, either version 3 of the license, or
7!Copyright> (at your option) any later version.
8!Copyright>
9!Copyright> This program is distributed in the hope that it will be useful,
10!Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11!Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12!Copyright> GNU Affero General Public License for more details.
13!Copyright>
14!Copyright> You should have received a copy of the GNU Affero General Public License
15!Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16!Copyright>
17!Copyright>
18!Copyright> Commercial Alternative: Altair Radioss Software
19!Copyright>
20!Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21!Copyright> software under a commercial license. Contact Altair to discuss further if the
22!Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| spmd_gather_nodal_scalar_mod ../engine/source/mpi/nodes/spmd_gather_nodal_scalar.f
25!||--- called by ------------------------------------------------------
26!|| spmd_exch_output_noda_pext ../engine/source/mpi/output/spmd_exch_output_noda_pext.F
27!||====================================================================
29 contains
30! ======================================================================================================================
31! procedures
32! ======================================================================================================================
33!! \brief generic subroutine gather all domain array to domain 0 in a global array v_glob(num)
34!! \details
35!||====================================================================
36!|| spmd_gather_nodal_scalar ../engine/source/mpi/nodes/spmd_gather_nodal_scalar.F
37!||--- called by ------------------------------------------------------
38!|| spmd_exch_output_noda_pext ../engine/source/mpi/output/spmd_exch_output_noda_pext.F
39!||--- calls -----------------------------------------------------
40!||--- uses -----------------------------------------------------
41!|| constant_mod ../common_source/modules/constant_mod.F
42!|| precision_mod ../common_source/modules/precision_mod.F90
43!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
44!|| spmd_recv_mod ../engine/source/mpi/spmd_recv.F90
45!|| spmd_send_mod ../engine/source/mpi/spmd_send.F90
46!||====================================================================
47 subroutine spmd_gather_nodal_scalar(v_glob,num,v,numnod,weight,nodglob)
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
136 end subroutine spmd_gather_nodal_scalar
end diagonal values have been computed in the(sparse) matrix id.SOL
subroutine mpi_get_count(status, datatype, cnt, ierr)
Definition mpi.f:296
subroutine mpi_probe(source, tag, comm, status, ierr)
Definition mpi.f:449
subroutine spmd_gather_nodal_scalar(v_glob, num, v, numnod, weight, nodglob)