OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
table2d_intersect.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!|| table2d_intersect ../starter/source/tools/curve/table2d_intersect.F
25!||--- called by ------------------------------------------------------
26!|| law76_upd ../starter/source/materials/mat/mat076/law76_upd.F
27!||--- uses -----------------------------------------------------
28!|| table_mod ../starter/share/modules1/table_mod.F
29!||====================================================================
30 SUBROUTINE table2d_intersect(TABLE ,I1 ,I2 ,NPT ,
31 . XFAC ,XINT ,YINT )
32C-----------------------------------------------
33C M o d u l e s
34C-----------------------------------------------
35 USE table_mod
36C-----------------------------------------------
37C I m p l i c i t T y p e s
38C-----------------------------------------------
39#include "implicit_f.inc"
40C-----------------------------------------------
41 INTEGER ,INTENT(IN) :: I1,I2,NPT
42 my_real ,INTENT(IN) :: xfac
43 TYPE(ttable) ,INTENT(IN) :: TABLE
44 my_real ,INTENT(OUT) :: xint,yint
45C-----------------------------------------------
46C L o c a l V a r i a b l e s
47C-----------------------------------------------
48 INTEGER :: I,J1,J2,K
49 my_real :: s1,s2,t1,t2,x1,x2,y1,y2,ax,ay,bx,by,cx,cy,dm,alpha,beta
50c-----------------------------------------------
51c This routine checks if the functions in a 2 dim table do not intersect
52c with respect to the second independent variable
53C=======================================================================
54c Check segment intersections between 2 functions
55
56 xint = zero
57 yint = zero
58
59c I1 = index of first strain rate
60c I2 = index of second strain rate
61c
62 j1 = (i1 - 1)*npt
63 j2 = (i2 - 1)*npt
64
65 DO k = 2,npt
66 s1 = table%X(1)%VALUES(k-1)*xfac
67 s2 = table%X(1)%VALUES(k) *xfac
68 x1 = s1
69 x2 = s2
70 t1 = table%Y%VALUES(j1 + k-1)
71 t2 = table%Y%VALUES(j1 + k)
72 y1 = table%Y%VALUES(j2 + k-1)
73 y2 = table%Y%VALUES(j2 + k)
74c
75 ax = x2 - x1
76 ay = y2 - y1
77 bx = s1 - s2
78 by = t1 - t2
79 dm = ay*bx - ax*by
80 IF (dm /= zero) THEN ! check if segments are not parallel
81 cx = s1 - x1
82 cy = t1 - y1
83 alpha = (bx * cy - by * cx) / dm
84 beta = (ax * cy - ay * cx) / dm
85 IF (alpha >= zero .and. alpha < one .and.
86 . beta <= zero .and. beta >-one .and. s1 > zero) THEN
87 xint = x1 + alpha * ax
88 yint = y1 + alpha * ay
89 EXIT
90 ENDIF
91 ENDIF
92 END DO
93c-----------
94 RETURN
95 END
#define my_real
Definition cppsort.cpp:32
#define alpha
Definition eval.h:35
subroutine table2d_intersect(table, i1, i2, npt, xfac, xint, yint)