OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inter_color_coarse_voxel.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!|| inter_color_coarse_voxel ../engine/source/interfaces/generic/inter_color_coarse_voxel.F
25!||--- called by ------------------------------------------------------
26!|| inter_prepare_sort ../engine/source/interfaces/generic/inter_prepare_sort.F
27!||--- calls -----------------------------------------------------
28!|| my_barrier ../engine/source/system/machine.F
29!||--- uses -----------------------------------------------------
30!|| intbufdef_mod ../common_source/modules/interfaces/intbufdef_mod.F90
31!|| inter_sorting_mod ../engine/share/modules/inter_sorting_mod.F
32!||====================================================================
33 SUBROUTINE inter_color_coarse_voxel(ITASK,NB_INTER_SORTED,LIST_INTER_SORTED,IPARI,INTBUF_TAB,
34 . X,SORT_COMM)
35!$COMMENT
36! INTER_COLOR_COARSE_VOXEL description :
37! color the coarse grid with the secondary nodes only for large interfaces (= with more than NSPMD/2 processors)
38!
39! INTER_COLOR_COARSE_VOXEL organization :
40! loop over the secondary nodes (omp //)
41! compute the index of the coarse grid with the node position
42! color the cell of the coarse grid
43!$ENDCOMMENT
44C-----------------------------------------------
45C M o d u l e s
46C-----------------------------------------------
47 USE intbufdef_mod
49C-----------------------------------------------
50C I m p l i c i t T y p e s
51C-----------------------------------------------
52#include "implicit_f.inc"
53#include "comlock.inc"
54C-----------------------------------------------
55C C o m m o n B l o c k s
56C-----------------------------------------------
57#include "com01_c.inc"
58#include "com04_c.inc"
59#include "param_c.inc"
60#include "task_c.inc"
61C-----------------------------------------------
62C D u m m y A r g u m e n t s
63C-----------------------------------------------
64 INTEGER, INTENT(in) :: ITASK ! thread ID
65 INTEGER, INTENT(in) :: NB_INTER_SORTED ! number of interfaces that need to be sorted
66 INTEGER, DIMENSION(NB_INTER_SORTED), INTENT(in) :: LIST_INTER_SORTED ! list of interfaces that need to be sorted
67 INTEGER, DIMENSION(NPARI,NINTER), INTENT(in) :: IPARI ! interface data
68 my_real, DIMENSION(3,NUMNOD), INTENT(in), TARGET :: x ! position
69 TYPE(intbuf_struct_),DIMENSION(NINTER), INTENT(in) :: INTBUF_TAB ! interface data
70 TYPE(sorting_comm_type), DIMENSION(NINTER), INTENT(inout) :: SORT_COMM ! structure for interface sorting comm
71C-----------------------------------------------
72C L o c a l V a r i a b l e s
73C-----------------------------------------------
74 INTEGER :: KK,I,J
75 INTEGER :: NIN,NEXT
76 INTEGER :: IX,IY,IZ
77 INTEGER :: NSN
78 INTEGER :: FIRST,LAST
79 my_real :: VALUE
80 my_real :: xminb,yminb,zminb
81 my_real :: xmaxb,ymaxb,zmaxb
82! ----------------------------------------
83 ! ------------------
84 ! allocation of global omp array
85 IF(itask==0) THEN
88 ENDIF
89 CALL my_barrier()
90 ! ------------------
91 ! loop over the interface
92 DO kk=1,nb_inter_sorted
93 nin = list_inter_sorted(kk)
94 nsn = ipari(5,nin)
95 ! ------------------
96 ! coarse grid is generated only for large interface (nb of processor > nspm/2)
97 IF(sort_comm(nin)%PROC_NUMBER>nspmd/2) THEN
98 first = 1 + itask*nsn/nthread
99 last = (itask+1)*nsn/nthread
100 xmaxb = box_limit(1)
101 ymaxb = box_limit(2)
102 zmaxb = box_limit(3)
103 xminb = box_limit(4)
104 yminb = box_limit(5)
105 zminb = box_limit(6)
107 CALL my_barrier()
108 ! ------------------
109 ! loop over the secondary node to color the coarse grid
110 DO i=first,last
111 j=intbuf_tab(nin)%NSV(i)
112 VALUE = nb_box_coarse_grid*(x(1,j)-xminb)/(xmaxb-xminb)
113 ix = min(int(VALUE),nb_box_coarse_grid)
114 ix = max(ix,1)
115 VALUE = nb_box_coarse_grid*(x(2,j)-yminb)/(ymaxb-yminb)
116 iy = min(int(VALUE),nb_box_coarse_grid)
117 iy = max(iy,1)
118 VALUE = nb_box_coarse_grid*(x(3,j)-zminb)/(zmaxb-zminb)
119 iz = min(int(VALUE),nb_box_coarse_grid)
120 iz = max(iz,1)
121 cell_bool(ix,iy,iz) = .true.
122 ENDDO
123 CALL my_barrier()
124 ! ------------------
125 ! omp reduction
126 IF(itask==0) THEN
127 IF(.NOT.ALLOCATED(sort_comm(nin)%COARSE_GRID)) THEN
128 ALLOCATE(sort_comm(nin)%COARSE_GRID(nb_box_coarse_grid**3 + 1))
129 ENDIF
130 sort_comm(nin)%COARSE_GRID(1:nb_box_coarse_grid**3 + 1) = 0
131 next = 0
132 DO iz=1,nb_box_coarse_grid
133 DO iy=1,nb_box_coarse_grid
134 DO ix=1,nb_box_coarse_grid
135 IF(cell_bool(ix,iy,iz)) THEN
136 next = next + 1
137 sort_comm(nin)%COARSE_GRID(next) =
138 . ix+(iy-1)*nb_box_coarse_grid+(iz-1)*nb_box_coarse_grid**2
139 ENDIF
140 ENDDO
141 ENDDO
142 ENDDO
143 sort_comm(nin)%COARSE_GRID(nb_box_coarse_grid**3 + 1) = next
144 ENDIF
145 CALL my_barrier()
146 ! ------------------
147 ENDIF
148 ! ------------------
149 ENDDO
150 ! ------------------
151
152 CALL my_barrier()
153 IF(itask==0) THEN
154 DEALLOCATE(cell_bool)
155 ENDIF
156 ! ------------------
157 RETURN
158 END SUBROUTINE inter_color_coarse_voxel
#define my_real
Definition cppsort.cpp:32
subroutine inter_color_coarse_voxel(itask, nb_inter_sorted, list_inter_sorted, ipari, intbuf_tab, x, sort_comm)
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
logical, dimension(:,:,:), allocatable cell_bool
integer, parameter nb_box_coarse_grid
subroutine my_barrier
Definition machine.F:31