OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
test_support_fct.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!|| test_support_fct ../starter/source/elements/ige3d/test_support_fct.F
25!||--- called by ------------------------------------------------------
26!|| prerafig3d ../starter/source/elements/ige3d/prerafig3d.F
27!||--- calls -----------------------------------------------------
28!||====================================================================
29 SUBROUTINE test_support_fct(IXIG3D, KXIG3D, KNOTLOCPC, DEGTANG1, DEGTANG2, DIR,
30 . TAB_ELCUT, L_TAB_ELCUT,
31 . TAB_COINKNOT,L_TAB_COINKNOT,
32 . TAB_FCTCUT,L_TAB_FCTCUT,DECALGEO,FLAG)
33C----------------------------------------------------------------------
34C ------------------------> case of quads <-----------------------c
35C ENSEMBLE D'ELEMENTS DU PATCH QUI VONT POTENTIELLEMENT ETRE MODIFIEES
36C by inserting the knot of the meshsurf
37C this routine uses an inclusion detection algorithm
38C of segments in a surface (slightly modified)
39C----------------------------------------------------------------------
40C-----------------------------------------------
41C I m p l i c i t T y p e s
42C-----------------------------------------------
43#include "implicit_f.inc"
44C-----------------------------------------------
45C C o m m o n B l o c k s
46C-----------------------------------------------
47#include "param_c.inc"
48#include "ige3d_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C-----------------------------------------------
52 INTEGER IXIG3D(*),KXIG3D(NIXIG3D,*),DEGTANG1,DEGTANG2,DIR,DECALGEO,
53 . TAB_ELCUT(L_TAB_ELCUT),L_TAB_ELCUT,L_TAB_COINKNOT,
54 . TAB_FCTCUT(L_TAB_FCTCUT),L_TAB_FCTCUT,FLAG
55 my_real knotlocpc(deg_max,3,*),tab_coinknot(2,*)
56C-----------------------------------------------
57C L o c a l V a r i a b l e s
58C-----------------------------------------------
59 INTEGER I,J,K,DIRTANG1,DIRTANG2,
60 . IEL,INTERSEC,
61 . WORK(70000),SIZ_LIST_FCTTOT,IDFCT,IOUT
62 my_real det, t1, t2, xa(5),ya(5),coin(2,2),
63 . xb, yb, xc, yc, xd, yd, tol
64 INTEGER, DIMENSION(:), ALLOCATABLE :: INDEX, LIST_FCTTOT, LIST_FCTTRI
65C-----------------------------------------------
66c
67 l_tab_fctcut = 0
68 tol = em06
69c
70 IF(dir==1) THEN
71 dirtang1 = 2
72 dirtang2 = 3
73 ELSEIF(dir==2) THEN
74 dirtang1 = 3
75 dirtang2 = 1
76 ELSEIF(dir==3) THEN
77 dirtang1 = 1
78 dirtang2 = 2
79 ELSE
80 dirtang1 = -huge(dirtang1)
81 dirtang2 = -huge(dirtang2)
82 ENDIF
83c
84C----------------------------------------------------------------------
85c all functions to be processed are listed and sorted for
86c Do not treat the same function twice
87C----------------------------------------------------------------------
88c
89 siz_list_fcttot = l_tab_elcut*kxig3d(3,tab_elcut(1))
90 ALLOCATE(list_fcttot(siz_list_fcttot))
91 ALLOCATE(list_fcttri(siz_list_fcttot))
92 list_fcttot(:) = ep06
93c
94 DO i=1,l_tab_elcut
95 iel=tab_elcut(i)
96 DO j=1,kxig3d(3,iel)
97 list_fcttot((i-1)*kxig3d(3,iel)+j) = ixig3d(kxig3d(4,iel)+j-1)
98 ENDDO
99 ENDDO
100c
101 ALLOCATE(index(2*siz_list_fcttot))
102 CALL my_orders(0, work, list_fcttot, index, siz_list_fcttot , 1)
103c
104 DO i=1,siz_list_fcttot
105 list_fcttri(i)=list_fcttot(index(i))
106 ENDDO
107c
108 DEALLOCATE(list_fcttot)
109 DEALLOCATE(index)
110c
111 coin(1,1) = minval(tab_coinknot(1,1:(l_tab_coinknot)))
112 coin(2,1) = minval(tab_coinknot(2,1:(l_tab_coinknot)))
113 coin(1,2) = maxval(tab_coinknot(1,1:(l_tab_coinknot)))
114 coin(2,2) = maxval(tab_coinknot(2,1:(l_tab_coinknot)))
115c
116 DO i=1,siz_list_fcttot
117c
118 IF(i/=1) THEN
119 IF(list_fcttri(i-1)==list_fcttri(i)) cycle
120 ENDIF
121c
122 idfct = list_fcttri(i)
123 iout=0
124c
125C----------------------------------------------------------------------
126c creation of working variables: corner of the knot extents of the function
127c A TESTER
128C----------------------------------------------------------------------
129c
130 xa(1) = knotlocpc(1,dirtang1,decalgeo+idfct) + tol
131 xa(2) = knotlocpc(degtang1+1,dirtang1,decalgeo+idfct) - tol
132 xa(3) = knotlocpc(degtang1+1,dirtang1,decalgeo+idfct) - tol
133 xa(4) = knotlocpc(1,dirtang1,decalgeo+idfct) + tol
134 xa(5) = xa(1)
135c
136 ya(1) = knotlocpc(1,dirtang2,decalgeo+idfct) + tol
137 ya(2) = knotlocpc(1,dirtang2,decalgeo+idfct) + tol
138 ya(3) = knotlocpc(degtang2+1,dirtang2,decalgeo+idfct) - tol
139 ya(4) = knotlocpc(degtang2+1,dirtang2,decalgeo+idfct) - tol
140 ya(5) = ya(1)
141c
142C----------------------------------------------------------------------
143c 1st test: test of the 4 points according to the 4 convex corners of the meshsurf
144C----------------------------------------------------------------------
145c
146 IF(xa(1)<coin(1,1).OR.ya(1)<coin(2,1)) cycle
147 IF(xa(3)>coin(1,2).OR.ya(3)>coin(2,2)) cycle
148c
149C----------------------------------------------------------------------
150c2nd test: test if the segment formed with a distant point intersects a side of the polygon
151C----------------------------------------------------------------------
152c
153 xb=coin(1,1)-1000 ! a point far enough from the meshsurf is taken
154 yb=coin(2,1)-2000
155 DO j=1,4 ! loop over the 4 corners of the extent
156 intersec=0
157 DO k=1,l_tab_coinknot-1
158 xc=tab_coinknot(1,k)
159 yc=tab_coinknot(2,k)
160 xd=tab_coinknot(1,k+1)
161 yd=tab_coinknot(2,k+1)
162 det = (xb-xa(j))*(yc-yd) - (xc-xd)*(yb-ya(j))
163 IF(det==0) THEN
164c parallel or collinear segments
165 ELSE
166 t1 = ((xc-xa(j))*(yc-yd)-(xc-xd)*(yc-ya(j)))/det
167 t2 = ((xb-xa(j))*(yc-ya(j))-(xc-xa(j))*(yb-ya(j)))/det
168 IF(t1>1.OR.t1<0.OR.t2>1.OR.t2<=0) THEN ! pas d'intersection
169c ! pas d'intersection
170 ELSE
171 intersec = intersec + 1
172c intersection: increment the counter by 1
173 ENDIF
174 ENDIF
175 ENDDO
176 IF(mod(intersec,2)==0) iout=1 ! even number of intersections, the point is outside the meshsurf
177 ENDDO
178c
179 IF(iout==1) cycle
180c
181C----------------------------------------------------------------------
182c 3rd test: to handle concave polygons, the segments formed by the extents must be tested
183C----------------------------------------------------------------------
184c
185 DO j=1,4 ! loop over the 4 corners of the extent
186 DO k=1,l_tab_coinknot-1
187 xc=tab_coinknot(1,k)
188 yc=tab_coinknot(2,k)
189 xd=tab_coinknot(1,k+1)
190 yd=tab_coinknot(2,k+1)
191 det = (xa(j+1)-xa(j))*(yc-yd) - (xc-xd)*(ya(j+1)-ya(j))
192 IF(det==0) THEN
193c parallel or collinear segments, so loop over another segment of the polygon
194 ELSE
195 t1 = ((xc-xa(j))*(yc-yd)-(xc-xd)*(yc-ya(j)))/det
196 t2 = ((xa(j+1)-xa(j))*(yc-ya(j))-(xc-xa(j))*(ya(j+1)-ya(j)))/det
197 IF(t1>1.OR.t1<0.OR.t2>1.OR.t2<=0) THEN ! pas d'intersection
198c ! pas d'intersection
199 ELSE
200 iout=1 ! intersection : fonction a exclure
201 cycle
202 ENDIF
203 ENDIF
204 ENDDO
205 ENDDO
206C
207C----------------------------------------------------------------------
208C sizing and storage of the array of functions to be refined
209C----------------------------------------------------------------------
210C
211 IF(iout==0) THEN
212 IF(flag==0) THEN
213 l_tab_fctcut = l_tab_fctcut + 1
214 ELSE
215 l_tab_fctcut = l_tab_fctcut + 1
216 tab_fctcut(l_tab_fctcut) = idfct
217 ENDIF
218 ENDIF
219c
220 ENDDO
221c
222 DEALLOCATE(list_fcttri)
223C
224 RETURN
225 END
226c
227
#define my_real
Definition cppsort.cpp:32
void my_orders(int *mode, int *iwork, int *data, int *index, int *n, int *irecl)
Definition my_orders.c:82
subroutine test_support_fct(ixig3d, kxig3d, knotlocpc, degtang1, degtang2, dir, tab_elcut, l_tab_elcut, tab_coinknot, l_tab_coinknot, tab_fctcut, l_tab_fctcut, decalgeo, flag)