OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
rdbox.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!|| checkpara ../starter/source/model/box/rdbox.F
25!||--- called by ------------------------------------------------------
26!|| box_surf_sh ../starter/source/model/box/bigbox.F
27!|| boxtage ../starter/source/model/box/bigbox.F
28!|| boxtagn ../starter/source/model/box/bigbox.F
29!|| elstagbox ../starter/source/model/box/bigbox.F
30!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
31!|| simple_node_box ../starter/source/model/sets/simple_node_box.F
32!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.F
33!||--- calls -----------------------------------------------------
34!|| inside_parallelepiped ../starter/source/model/box/rdbox.F
35!|| projskew ../starter/source/model/box/rdbox.F
36!||====================================================================
37 SUBROUTINE checkpara(XP1,YP1,ZP1,XP2,YP2,ZP2,
38 . ISK,NODIN,SKEW,OK)
39C-----------------------------------------------
40C I m p l i c i t T y p e s
41C-----------------------------------------------
42#include "implicit_f.inc"
43C-----------------------------------------------
44C C o m m o n B l o c k s
45C-----------------------------------------------
46#include "param_c.inc"
47C-----------------------------------------------
48C D u m m y A r g u m e n t s
49C-----------------------------------------------
50 INTEGER ISK,OK
52 . xp1,yp1,zp1,xp2,yp2,zp2,skew(lskew,*),nodin(3)
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
56 INTEGER I
58 . p1(3),p2(3),p3(3),p4(3),pp2(3)
59C-----------------------------------------------
60 p1(1) = xp1
61 p1(2) = yp1
62 p1(3) = zp1
63 CALL projskew(p1,skew,isk)
64C
65 pp2(1) = xp2
66 pp2(2) = yp2
67 pp2(3) = zp2
68 CALL projskew(pp2,skew,isk)
69C
70 p2(1) = pp2(1)
71 p2(2) = p1(2)
72 p2(3) = p1(3)
73C
74 p3(1) = p1(1)
75 p3(2) = pp2(2)
76 p3(3) = p1(3)
77C
78 p4(1) = p1(1)
79 p4(2) = p1(2)
80 p4(3) = pp2(3)
81C
82 CALL projskew(nodin,skew,isk)
83C
84 CALL inside_parallelepiped(p1, p2, p3, p4, nodin, ok)
85C
86 RETURN
87 END
88!||====================================================================
89!|| projskew ../starter/source/model/box/rdbox.F
90!||--- called by ------------------------------------------------------
91!|| checkpara ../starter/source/model/box/rdbox.F
92!||====================================================================
93 SUBROUTINE projskew(PO,SK,ISK)
94C-----------------------------------------------
95C I m p l i c i t T y p e s
96C-----------------------------------------------
97#include "implicit_f.inc"
98C-----------------------------------------------
99C C o m m o n B l o c k s
100C-----------------------------------------------
101#include "param_c.inc"
102C-----------------------------------------------
103C D u m m y A r g u m e n t s
104C-----------------------------------------------
105 INTEGER ISK
106 my_real
107 . po(3),sk(lskew,*)
108C-----------------------------------------------
109C L o c a l V a r i a b l e s
110C-----------------------------------------------
111 INTEGER I,JSK
112 my_real
113 . sum,pn(3)
114C-----------------------------------------------
115 jsk = isk + 1
116C
117 pn(1) = po(1)*sk(1,jsk) + po(2)*sk(2,jsk) + po(3)*sk(3,jsk)
118 sum = sk(1,jsk)**2 + sk(2,jsk)**2 + sk(3,jsk)**2
119 sum = sqrt(sum)
120 pn(1) = pn(1) / sum
121C
122 pn(2) = po(1)*sk(4,jsk) + po(2)*sk(5,jsk) + po(3)*sk(6,jsk)
123 sum = sk(4,jsk)**2 + sk(5,jsk)**2 + sk(6,jsk)**2
124 sum = sqrt(sum)
125 pn(2) = pn(2) / sum
126C
127 pn(3) = po(1)*sk(7,jsk) + po(2)*sk(8,jsk) + po(3)*sk(9,jsk)
128 sum = sk(7,jsk)**2 + sk(8,jsk)**2 + sk(9,jsk)**2
129 sum = sqrt(sum)
130 pn(3) = pn(3) / sum
131C
132 po(1) = pn(1)
133 po(2) = pn(2)
134 po(3) = pn(3)
135C
136 RETURN
137 END
138!||====================================================================
139!|| inside_parallelepiped ../starter/source/model/box/rdbox.F
140!||--- called by ------------------------------------------------------
141!|| checkpara ../starter/source/model/box/rdbox.F
142!||====================================================================
143 SUBROUTINE inside_parallelepiped(P1, P2, P3, P4, P, OK)
144C nodes inside parallelepiped in 3D.
145C
146C
147C *------------------*
148C / . / \
149C / . / \
150C / . / \
151C P4------------------* \
152C \ . \ \
153C \ . \ \
154C \ . \ \
155C \ P2.........\.......\
156C \ . \ /
157C \ . \ /
158C \ . \ /
159C P1-----------------P3
160C
161C
162C Parameters:
163C
164C Input, reals: P1(3), P2(3), P3(3), P4(3), four corners
165C of the parallelepiped. It is assumed that P2, P3 and P4 are
166C immediate neighbors of P1.
167C
168C Input, real: P(3), the node to be checked.
169C
170C IF integer "OK == 1", the node P
171C is inside the parallelepiped, or on its boundary.
172C
173C-----------------------------------------------
174C I m p l i c i t T y p e s
175C-----------------------------------------------
176#include "implicit_f.inc"
177C-----------------------------------------------
178C D u m m y A r g u m e n t s
179C-----------------------------------------------
180 INTEGER OK
181 my_real
182 . p1(3),p2(3),p3(3),p4(3),p(3)
183C-----------------------------------------------
184C L o c a l V a r i a b l e s
185C-----------------------------------------------
186 my_real
187 . dot,suma
188C-----------------------------------------------
189 dot = dot_product( p(1:3) - p1(1:3),
190 . p2(1:3) - p1(1:3))
191 IF(dot < zero)RETURN
192 suma = sum((p2(1:3) - p1(1:3) )**2)
193 IF((suma == zero . and. p(1) /= p1(1)) .OR.
194 . suma < dot)RETURN
195C---
196 dot = dot_product( p(1:3) - p1(1:3),
197 . p3(1:3) - p1(1:3))
198 IF(dot < zero)RETURN
199 suma = sum((p3(1:3) - p1(1:3) )**2)
200 IF((suma == zero . and. p(2) /= p1(2)) .OR.
201 . suma < dot)RETURN
202C---
203 dot = dot_product( p(1:3) - p1(1:3),
204 . p4(1:3) - p1(1:3))
205 IF(dot < zero)RETURN
206 suma = sum((p4(1:3) - p1(1:3) )**2)
207 IF((suma == zero . and. p(3) /= p1(3)) .OR.
208 . suma < dot)RETURN
209C---
210 ok = 1
211C---
212 RETURN
213 END
214!||====================================================================
215!|| checkcyl ../starter/source/model/box/rdbox.f
216!||--- called by ------------------------------------------------------
217!|| box_surf_sh ../starter/source/model/box/bigbox.F
218!|| boxtage ../starter/source/model/box/bigbox.F
219!|| boxtagn ../starter/source/model/box/bigbox.F
220!|| elstagbox ../starter/source/model/box/bigbox.F
221!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
222!|| simple_node_box ../starter/source/model/sets/simple_node_box.f
223!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.F
224!||--- calls -----------------------------------------------------
225!|| inside_cylinder ../starter/source/model/box/rdbox.F
226!||====================================================================
227 SUBROUTINE checkcyl(XP1, YP1, ZP1, XP2, YP2, ZP2,
228 . NODIN, D, OK )
229C-----------------------------------------------
230C I m p l i c i t T y p e s
231C-----------------------------------------------
232#include "implicit_f.inc"
233C-----------------------------------------------
234C D u m m y A r g u m e n t s
235C-----------------------------------------------
236 INTEGER OK
237 my_real
238 . xp1,yp1,zp1,xp2,yp2,zp2,nodin(3),d
239C-----------------------------------------------
240C L o c a l V a r i a b l e s
241C-----------------------------------------------
242 my_real
243 . p1(3),p2(3)
244C-----------------------------------------------
245
246C-----------------------------------------------
247 p1(1) = xp1
248 p1(2) = yp1
249 p1(3) = zp1
250C
251 p2(1) = xp2
252 p2(2) = yp2
253 p2(3) = zp2
254C
255 CALL inside_cylinder(p1, p2, nodin, d, ok)
256C
257 RETURN
258 END
259!||====================================================================
260!|| inside_cylinder ../starter/source/model/box/rdbox.F
261!||--- called by ------------------------------------------------------
262!|| checkcyl ../starter/source/model/box/rdbox.F
263!||--- calls -----------------------------------------------------
264!|| vec_length ../starter/source/model/box/rdbox.F
265!||====================================================================
266 SUBROUTINE inside_cylinder(P1, P2, P, D, OK)
267C-----------------------------------------------
268C The surface and interior of a (finite) cylinder in 3D is defined
269C by an axis, which is the line segment from point P1 to P2, and a
270C diameter D. The points contained in the volume include:
271C * points at a distance less than or equal to D/2 from the line through P1
272C and P2, whose nearest point on the line through P1 and P2 is, in fact,
273C P1, P2, or any point between them.
274C---
275C Input, D, the diameter of the cylinder.
276C Input, P(3), the checked point.
277C Input, P1(3), P2(3), the points defining the cylinder axis.
278C-----------------------------------------------
279C I m p l i c i t T y p e s
280C-----------------------------------------------
281#include "implicit_f.inc"
282C-----------------------------------------------
283C D u m m y A r g u m e n t s
284C-----------------------------------------------
285 INTEGER OK
286 my_real
287 . p1(3),p2(3),p(3),d
288C-----------------------------------------------
289C L o c a l V a r i a b l e s
290C-----------------------------------------------
291 my_real
292 . axis(3),axis_length,vec_length,off_axix_component,
293 . p_dot_axis,p_length
294C-----------------------------------------------
295 axis(1:3) = p2(1:3) - p1(1:3)
296 axis_length = vec_length(3,axis)
297 IF(axis_length == zero)RETURN
298C
299 axis(1:3) = axis(1:3) / axis_length
300 p_dot_axis = dot_product(p(1:3) - p1(1:3),axis)
301C
302C If the point lies below or above the "caps" of the cylinder, we're done.
303C
304 IF(p_dot_axis < zero .or. axis_length < p_dot_axis)RETURN
305C
306C Otherwise, determine the distance from P to the axis.
307C
308 p_length = vec_length(3, p1(1:3) - (p(1:3) - p_dot_axis * axis(1:3)))
309 IF(p_length <= half*d)ok = 1
310C
311 RETURN
312 END
313C-----------------
314!||====================================================================
315!|| vec_length ../starter/source/model/box/rdbox.F
316!||--- called by ------------------------------------------------------
317!|| inside_cylinder ../starter/source/model/box/rdbox.F
318!||====================================================================
319 FUNCTION vec_length(DIMENS,X)
320C-----------------
321C VEC_LENGTH returns the Euclidean length of a vector.
322C
323 IMPLICIT NONE
324C
325 INTEGER dimens
326 my_real
327 . vec_length,x(dimens)
328C-------------------------------
329 vec_length = sqrt(sum((x(1:dimens))**2))
330C
331 RETURN
332 END
333!||====================================================================
334!|| checksphere ../starter/source/model/box/rdbox.F
335!||--- called by ------------------------------------------------------
336!|| box_surf_sh ../starter/source/model/box/bigbox.F
337!|| boxtage ../starter/source/model/box/bigbox.F
338!|| boxtagn ../starter/source/model/box/bigbox.F
339!|| elstagbox ../starter/source/model/box/bigbox.F
340!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
341!|| simple_node_box ../starter/source/model/sets/simple_node_box.F
342!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.f
343!||--- calls -----------------------------------------------------
344!|| inside_sphere ../starter/source/model/box/rdbox.F
345!||====================================================================
346 SUBROUTINE checksphere(XP, YP, ZP, NODIN, D, OK)
347C-----------------------------------------------
348C I m p l i c i t T y p e s
349C-----------------------------------------------
350#include "implicit_f.inc"
351C-----------------------------------------------
352C D u m m y A r g u m e n t s
353C-----------------------------------------------
354 INTEGER OK
355 my_real
356 . xp,yp,zp,nodin(3),d
357C-----------------------------------------------
358C L o c a l V a r i a b l e s
359C-----------------------------------------------
360 my_real
361 . p(3)
362C-----------------------------------------------
363 p(1) = xp
364 p(2) = yp
365 p(3) = zp
366C
367 CALL inside_sphere(p, nodin, d, ok)
368C
369 RETURN
370 END
371!||====================================================================
372!|| inside_sphere ../starter/source/model/box/rdbox.F
373!||--- called by ------------------------------------------------------
374!|| checksphere ../starter/source/model/box/rdbox.F
375!||====================================================================
376 SUBROUTINE inside_sphere(PC, P, D, OK)
377C-----------------------------------------------
378C Implicit sphere equation:
379C
380C SUM ( ( P(1:3) - PC(1:3) )**2 ) = D**2/4
381C-----------------------------------------------
382C I m p l i c i t T y p e s
383C-----------------------------------------------
384#include "implicit_f.inc"
385C-----------------------------------------------
386C D u m m y A r g u m e n t s
387C-----------------------------------------------
388 INTEGER OK
389 my_real
390 . pc(3),p(3),d
391C-----------------------------------------------
392C L o c a l V a r i a b l e s
393C-----------------------------------------------
394 my_real
395 . p1(3),p2(3),suma
396C-----------------------------------------------
397 suma = sum((p(1:3) - pc(1:3))**2)
398 suma = four*suma
399 IF(suma <= d**2) ok = 1
400C
401 RETURN
402 END
#define my_real
Definition cppsort.cpp:32
subroutine inside_parallelepiped(p1, p2, p3, p4, p, ok)
Definition rdbox.F:144
subroutine checkcyl(xp1, yp1, zp1, xp2, yp2, zp2, nodin, d, ok)
Definition rdbox.F:229
subroutine inside_cylinder(p1, p2, p, d, ok)
Definition rdbox.F:267
subroutine projskew(po, sk, isk)
Definition rdbox.F:94
subroutine checkpara(xp1, yp1, zp1, xp2, yp2, zp2, isk, nodin, skew, ok)
Definition rdbox.F:39
function vec_length(dimens, x)
Definition rdbox.F:320
subroutine inside_sphere(pc, p, d, ok)
Definition rdbox.F:377
subroutine checksphere(xp, yp, zp, nodin, d, ok)
Definition rdbox.F:347
subroutine simple_node_box(ibox, x, skew, ib, nd_array, nd_size)
subroutine simple_rbody_box(ibox, x, skew, ib, nd_array, nd_size, rby_msn)
program starter
Definition starter.F:39