OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spmd_wrt_xyznor.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_wrt_xyznor ../engine/source/mpi/anim/spmd_wrt_xyznor.F
25!||--- called by ------------------------------------------------------
26!|| xyznor ../engine/source/output/anim/generate/xyznor.F
27!||--- calls -----------------------------------------------------
28!|| write_s_c ../common_source/tools/input_output/write_routines.c
29!||--- uses -----------------------------------------------------
30!|| spmd_comm_world_mod ../engine/source/mpi/spmd_comm_world.F90
31!||====================================================================
32 SUBROUTINE spmd_wrt_xyznor(XNORM,WEIGHT,NODGLOB,NUM)
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 "scr14_c.inc"
45#include "task_c.inc"
46#include "spmd_c.inc"
47C-----------------------------------------------
48C D u m m y A r g u m e n t s
49C-----------------------------------------------
51 . xnorm(3,*)
52 INTEGER WEIGHT(*),NODGLOB(*),NUM
53C-----------------------------------------------
54C L O C A L V A R I A B L E S
55C-----------------------------------------------
56#ifdef MPI
57 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
58 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2
59
60 INTEGER, DIMENSION(:,:), ALLOCATABLE :: IBUF,RNGLOB
61 DATA msgoff/7030/
62 DATA msgoff2/7031/
63
64C Table used by Pro 0
66 . s3000,s,xn1,xn2,xn3,ixnn
67C-----------------------------------------------
68 ALLOCATE(ibuf(4,numnodm))
69 ALLOCATE(rnglob(3,num))
70
71 s3000 = three1000
72
73
74 ixnn = s3000
75 IF(fmt_ani==4)ixnn=0
76
77 IF (ispmd/=0) THEN
78
79 siz = 0
80 DO i=1,numnod
81 IF (weight(i)==1) THEN
82 siz = siz + 1
83 ibuf(1,siz) = nodglob(i)
84 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
85 IF(s/=zero)THEN
86 s = s3000 / s
87 xn1 = xnorm(1,i) * s
88 xn2 = xnorm(2,i) * s
89 xn3 = xnorm(3,i) * s
90 ibuf(2,siz) = xn1
91 ibuf(3,siz) = xn2
92 ibuf(4,siz) = xn3
93 ELSE
94 ibuf(2,siz) = 0
95 ibuf(3,siz) = 0
96 ibuf(4,siz) = ixnn
97 END IF
98 END IF
99 END DO
100
101C Because of the simple precision version, we cannot put the integer
102C In the floating buffer because there are only 2 24 bits available ~ 16 million
103C maximum number of nodes
104
105 msgtyp = msgoff2
106 CALL mpi_send(ibuf,4*siz,mpi_integer,it_spmd(1),msgtyp,
107 . spmd_comm_world,ierror)
108
109 ELSE
110 DO i=1,numnod
111 IF (weight(i)==1) THEN
112 ng = nodglob(i)
113 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
114 IF(s/=zero)THEN
115 s = s3000 / s
116 xn1 = xnorm(1,i) * s
117 xn2 = xnorm(2,i) * s
118 xn3 = xnorm(3,i) * s
119 rnglob(1,ng) = xn1
120 rnglob(2,ng) = xn2
121 rnglob(3,ng) = xn3
122 ELSE
123 rnglob(1,ng) = 0
124 rnglob(2,ng) = 0
125 rnglob(3,ng) = ixnn
126 END IF
127 END IF
128 ENDDO
129
130 DO i=2,nspmd
131
132 msgtyp = msgoff2
133
134 CALL mpi_probe(it_spmd(i),msgtyp,
135 . spmd_comm_world,status,ierror)
136 CALL mpi_get_count(status,mpi_integer,siz,ierror)
137
138 CALL mpi_recv(ibuf,siz,mpi_integer,it_spmd(i),msgtyp,
139 . spmd_comm_world,status,ierror)
140
141
142 nrec = siz/4
143
144 DO k = 1, nrec
145 ng = ibuf(1,k)
146 rnglob(1,ng) = ibuf(2,k)
147 rnglob(2,ng) = ibuf(3,k)
148 rnglob(3,ng) = ibuf(4,k)
149 ENDDO
150 ENDDO
151
152 CALL write_s_c(rnglob,3*numnodg)
153
154 ENDIF
155
156 DEALLOCATE(ibuf)
157 DEALLOCATE(rnglob)
158
159#endif
160 RETURN
161 END
#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
subroutine spmd_wrt_xyznor(xnorm, weight, nodglob, num)
void write_s_c(int *w, int *len)