OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
cr_spline_interpol.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!|| cr_spline_interpol ../common_source/tools/interpolation/cr_spline_interpol.F
25!||--- called by ------------------------------------------------------
26!|| cr_spline_length ../common_source/tools/interpolation/cr_spline_length.F
27!|| cr_spline_point_proj ../common_source/tools/interpolation/cr_spline_point_proj.F
28!||====================================================================
29 SUBROUTINE cr_spline_interpol( PTS , KNOTS, T, C, C_D, C_DD)
30C-----------------------------------------------
31 !FOR A GIVEN POSITION T in [0,1] which is position on [P1,P2], 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) :: pts(0:3,3),knots(0:3),t
48 my_real, INTENT(INOUT) :: c(3),c_d(3),c_dd(3)
49C-----------------------------------------------
50C L o c a l V a r i a b l e s
51C-----------------------------------------------
52 my_real :: a1(3),a2(3),a3(3)
53 my_real :: b1(3),b2(3)
54 my_real :: a1p(3),a2p(3),a3p(3), b1p(3),b2p(3),b1pp(3),b2pp(3)
55 my_real :: tt !in [T1,T2]=[KNOT(1),KNOT(2)]
56C-----------------------------------------------
57C S o u r c e L i n e s
58C-----------------------------------------------
59 tt=knots(1)+t*(knots(2)-knots(1))
60 a1(1:3) = ((knots(1)-tt)*pts(0,1:3)+(tt-knots(0))*pts(1,1:3)) /(knots(1)-knots(0))
61 a2(1:3) = ((knots(2)-tt)*pts(1,1:3)+(tt-knots(1))*pts(2,1:3)) /(knots(2)-knots(1))
62 a3(1:3) = ((knots(3)-tt)*pts(2,1:3)+(tt-knots(2))*pts(3,1:3)) /(knots(3)-knots(2))
63 b1(1:3) = ((knots(2)-tt)*a1(1:3) + (tt-knots(0))*a2(1:3)) / (knots(2)-knots(0))
64 b2(1:3) = ((knots(3)-tt)*a2(1:3) + (tt-knots(1))*a3(1:3)) / (knots(3)-knots(1))
65 c(1:3) = ((knots(2)-tt)*b1(1:3) + (tt-knots(1))*b2(1:3)) / (knots(2)-knots(1))
66 a1p(1:3) = (pts(1,1:3)-pts(0,1:3))/(knots(1)-knots(0))
67 a2p(1:3) = (pts(2,1:3)-pts(1,1:3))/(knots(2)-knots(1))
68 a3p(1:3) = (pts(3,1:3)-pts(2,1:3))/(knots(3)-knots(2))
69 b1p(1:3) = (a2(1:3)-a1(1:3))/(knots(2)-knots(0))
70 . + (knots(2)-tt)/(knots(2)-knots(0))*a1p(1:3)
71 . + (tt-knots(0))/(knots(2)-knots(0))*a2p(1:3)
72 b2p(1:3) = (a3(1:3)-a2(1:3))/(knots(3)-knots(1))
73 . + (knots(3)-tt)/(knots(3)-knots(1))*a2p(1:3)
74 . + (tt-knots(1))/(knots(3)-knots(1))*a3p(1:3)
75 c_d(1:3) = (b2(1:3)-b1(1:3))/(knots(2)-knots(1))
76 . + (knots(2)-tt)/(knots(2)-knots(1))*b1p(1:3)
77 . + (tt-knots(1))/(knots(2)-knots(1))*b2p(1:3)
78 b1pp(1:3) = (2.*a2p(1:3)-2.*a1p(1:3))/(knots(2)-knots(0))
79 b2pp(1:3) = (2.*a3p(1:3)-2.*a2p(1:3))/(knots(3)-knots(1))
80 c_dd(1:3) = (2.*b2p(1:3)-2.*b1p(1:3)+(knots(2)-tt)*b1pp(1:3)+(tt-knots(1))*b2pp(1:3))/(knots(2)-knots(1))
81 RETURN
82 END SUBROUTINE cr_spline_interpol
#define my_real
Definition cppsort.cpp:32
subroutine cr_spline_interpol(pts, knots, t, c, c_d, c_dd)