OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spline_interpol_2d.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!|| spline_interpol_2d ../starter/source/materials/tools/spline_interpol_2d.F
25!||--- called by ------------------------------------------------------
26!|| test_spline ../starter/source/materials/tools/test_splines.F
27!||====================================================================
28 SUBROUTINE spline_interpol_2d(PTX, PTY ,KNOTS, T, NX ,NY )
29C-----------------------------------------------
30 ! FOR A GIVEN POSITION T in [0,1] which is position on [P1,P2],
31 ! GET VALUE ON SPLINE P0-P1-P2-P3
32C-----------------------------------------------
33C I m p l i c i t T y p e s
34C-----------------------------------------------
35#include "implicit_f.inc"
36C-----------------------------------------------
37C D e s c r i p t i o n
38C-----------------------------------------------
39 ! INPUT - PTS(0:3,:) are 4 control points
40 ! INPUT - T is in [0,1] : T=0 => VAL = P(2,:)
41 ! OUTPUT - C is interpolated value.
42 ! OUTPUT - C_D is 1st derivative
43 ! OUTPUT - C_DD is 2nd derivatice
44C-----------------------------------------------
45C D u m m y A r g u m e n t s
46C-----------------------------------------------
47 my_real, INTENT(IN) :: t
48 my_real, INTENT(IN) :: ptx(4)
49 my_real, INTENT(IN) :: pty(4)
50 my_real, INTENT(IN) :: knots(4)
51 my_real, INTENT(OUT) :: nx,ny
52c my_real, INTENT(INOUT) :: C(4),C_D(4),C_DD(4)
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
56 my_real :: dk21,dk32,dk43,dk31,dk42,kt1,kt2,kt3,kt4
57 my_real :: tt ! in [T1,T2]=[KNOT(2),KNOT(3)]
58 my_real :: a1x,a1y,a2x,a2y,a3x,a3y,b1x,b1y,b2x,b2y
59 my_real :: cx,cy,c_dx,c_dy,c_ddx,c_ddy
60 my_real :: a1px,a1py,a2px,a2py,a3px,a3py,b1px,b1py,b2px,b2py
61 my_real :: b1ppx,b1ppy,b2ppx,b2ppy
62C-----------------------------------------------
63C S o u r c e L i n e s
64c=======================================================================
65 dk21 = knots(2) - knots(1)
66 dk32 = knots(3) - knots(2)
67 dk43 = knots(4) - knots(3)
68 dk31 = knots(3) - knots(1)
69 dk42 = knots(4) - knots(2)
70 tt = knots(2) + t * dk32
71 kt1 = knots(1) - tt
72 kt2 = knots(2) - tt
73 kt3 = knots(3) - tt
74 kt4 = knots(4) - tt
75c
76 a1x = (kt2*ptx(1) - kt1*ptx(2)) / dk21
77 a1y = (kt2*pty(1) - kt1*pty(2)) / dk21
78 a2x = (kt3*ptx(2) - kt2*ptx(3)) / dk32
79 a2y = (kt3*pty(2) - kt2*pty(3)) / dk32
80 a3x = (kt4*ptx(3) - kt3*ptx(4)) / dk43
81 a3y = (kt4*pty(3) - kt3*pty(4)) / dk43
82c
83 b1x = (kt3*a1x - kt1*a2x) / dk31
84 b1y = (kt3*a1y - kt1*a2y) / dk31
85 b2x = (kt4*a2x - kt2*a3x) / dk42
86 b2y = (kt4*a2y - kt2*a3y) / dk42
87c
88 nx = (kt3*b1x - kt2*b2x) / dk32
89 ny = (kt3*b1y - kt2*b2y) / dk32
90c
91 a1px = (ptx(2) - ptx(1)) / dk21
92 a1py = (pty(2) - pty(1)) / dk21
93 a2px = (ptx(3) - ptx(2)) / dk32
94 a2py = (pty(3) - pty(2)) / dk32
95 a3px = (ptx(4) - ptx(3)) / dk43
96 a3py = (pty(4) - pty(3)) / dk43
97 b1px = (a2x-a1x)/ dk31 + kt3 / dk31*a1px - kt1 / dk31*a2px
98 b1py = (a2y-a1y)/ dk31 + kt3 / dk31*a1py - kt1 / dk31*a2py
99 b2px = (a3x-a2x)/ dk42 + kt4 / dk42*a2px - kt2 / dk42*a3px
100 b2py = (a3y-a2y)/ dk42 + kt4 / dk42*a2py - kt2 / dk42*a3py
101! C_DX = (B2-B1Y)/ DK32 + KT3 / DK32*B1P - KT2 / DK32*B2P
102! C_DY = (B2-B1)/ DK32 + KT3 / DK32*B1P - KT2 / DK32*B2P
103 b1ppx= two*(a2px - a1px) / dk31
104 b1ppy= two*(a2py - a1py) / dk31
105 b2ppx= two*(a3px - a2px) / dk42
106 b2ppy= two*(a3py - two*a2py) / dk42
107! C_DDX= (TWO*B2P-TWO*B1P + KT3*B1PP - KT2*B2PP) / DK32
108! C_DDY= (TWO*B2P-TWO*B1P + KT3*B1PP - KT2*B2PP) / DK32
109c------------
110 RETURN
111 END SUBROUTINE spline_interpol_2d
#define my_real
Definition cppsort.cpp:32
subroutine spline_interpol_2d(ptx, pty, knots, t, nx, ny)