OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
table2d_intersect.F File Reference
#include "implicit_f.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine table2d_intersect (table, i1, i2, npt, xfac, xint, yint)

Function/Subroutine Documentation

◆ table2d_intersect()

subroutine table2d_intersect ( type(ttable), intent(in) table,
integer, intent(in) i1,
integer, intent(in) i2,
integer, intent(in) npt,
intent(in) xfac,
intent(out) xint,
intent(out) yint )

Definition at line 30 of file table2d_intersect.F.

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
#define my_real
Definition cppsort.cpp:32
#define alpha
Definition eval.h:35