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

Go to the source code of this file.

Functions/Subroutines

subroutine test_spline (npt0, nsub, xf, yf, xx, yy)

Function/Subroutine Documentation

◆ test_spline()

subroutine test_spline ( integer, intent(in) npt0,
integer, intent(in) nsub,
intent(in) xf,
intent(in) yf,
intent(out) xx,
intent(out) yy )

Definition at line 28 of file test_splines.F.

29C-----------------------------------------------
30C D e s c r i p t i o n
31C-----------------------------------------------
32 !compute SPLINE length with third order method (SIMPSON)
33 ! INPUT - LOCAL_PT : 4 control points P0,P1,P2,P3
34 ! INPUT - ALPHA : CCR SPLINE PARAMETER
35 ! INPUT - T : position [0,1] on SPLINE [T1,T2]. 1.0 means full spline length
36 ! OUTPUT - LEN : length of the curve parametrised with t in [0,T] T<=1.0
37C-----------------------------------------------
38C I m p l i c i t T y p e s
39C-----------------------------------------------
40#include "implicit_f.inc"
41C-----------------------------------------------
42C D u m m y A r g u m e n t s
43C-----------------------------------------------
44 INTEGER ,INTENT(IN) :: NPT0 ! number of points of input function
45 INTEGER ,INTENT(IN) :: NSUB !
46 my_real ,DIMENSION(NPT0) ,INTENT(IN) :: xf,yf ! initial curve coordinates
47 my_real ,DIMENSION((NPT0-1)*NSUB+1) ,INTENT(OUT) :: xx,yy ! curve coordinates build with splines
48C-----------------------------------------------
49C L o c a l V a r i a b l e s
50C-----------------------------------------------
51 INTEGER :: I,J,K,NPTS,NSEG
52 my_real :: tt,dx,dy,nx,ny
53 my_real ,DIMENSION(:,:) ,ALLOCATABLE :: spline_knots
54 my_real ,DIMENSION(:) ,ALLOCATABLE :: ctrl_ptx,ctrl_pty
55 my_real ,DIMENSION(4) :: ptx,pty,knots
56 my_real ,PARAMETER :: alpha = 0.5
57C-----------------------------------------------
58C S o u r c e L i n e s
59c=======================================================================
60 npts = npt0 + 2
61 nseg = npt0 - 1
62
63 ALLOCATE (ctrl_ptx(npts))
64 ALLOCATE (ctrl_pty(npts))
65 ALLOCATE (spline_knots(nseg,4))
66
67c calculate spline control points
68 ctrl_ptx(2:npts-1) = xf(1:npt0)
69 ctrl_pty(2:npts-1) = yf(1:npt0)
70 ! Add start point - minimum of bending energy
71 ctrl_ptx(1) = (half*ctrl_ptx(2) - four*ctrl_ptx(3) + ctrl_ptx(4)) * half
72 ctrl_pty(1) = (half*ctrl_pty(2) - four*ctrl_pty(3) + ctrl_pty(4)) * half
73 ! Add end point - minimum of bending energy
74 ctrl_ptx(npts) = (ctrl_ptx(npts-3) - four*ctrl_ptx(npts-2) + five*ctrl_ptx(npts-1)) * half
75 ctrl_pty(npts) = (ctrl_pty(npts-3) - four*ctrl_pty(npts-2) + five*ctrl_pty(npts-1)) * half
76c
77 k = 0
78 DO i = 1,nseg
79 ptx(1) = ctrl_ptx(i)
80 ptx(2) = ctrl_ptx(i+1)
81 ptx(3) = ctrl_ptx(i+2)
82 ptx(4) = ctrl_ptx(i+3)
83 pty(1) = ctrl_pty(i)
84 pty(2) = ctrl_pty(i+1)
85 pty(3) = ctrl_pty(i+2)
86 pty(4) = ctrl_pty(i+3)
87c
88 knots(1) = zero
89 dx = ptx(2) - ptx(1)
90 dy = pty(2) - pty(1)
91 knots(2) = spline_knots(i,1) + exp(alpha*log(sqrt(dx**2 + dy**2)))
92 dx = ptx(3) - ptx(2)
93 dy = pty(3) - pty(2)
94 knots(3) = knots(2) + exp(alpha*log(sqrt(dx**2 + dy**2)))
95 dx = ptx(4) - ptx(3)
96 dy = pty(4) - pty(3)
97 knots(4) = knots(3) + exp(alpha*log(sqrt(dx**2 + dy**2)))
98 spline_knots(i,1:4) = knots(1:4)
99c
100 DO j = 1,nsub
101 tt = (j-one) / nsub
102 k = k + 1
103 CALL spline_interpol_2d(ptx, pty ,knots, tt, nx ,ny )
104 xx(k) = nx
105 yy(k) = ny
106 ENDDO
107
108 ENDDO
109 ! last point
110 tt = one
111 k = k + 1
112 xx(k) = xf(npt0)
113 yy(k) = yf(npt0)
114
115c CALL SPLINE_INTERPOL_2D(PTX, PTY ,KNOTS, TT, NX ,NY )
116c XX(K) = NX
117c YY(K) = NY
118c
119 DEALLOCATE (spline_knots)
120 DEALLOCATE (ctrl_pty)
121 DEALLOCATE (ctrl_ptx)
122c-----------
123 RETURN
#define my_real
Definition cppsort.cpp:32
#define alpha
Definition eval.h:35
subroutine spline_interpol_2d(ptx, pty, knots, t, nx, ny)