Mercurial > repos > public > sbplib
changeset 1112:835c8fa456ec feature/timesteppers
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 10 Apr 2019 22:22:46 +0200 |
parents | 1a265a376b36 (current diff) 3230e4cbdbb4 (diff) |
children | 47e86b5270ad |
files | |
diffstat | 4 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
diff -r 1a265a376b36 -r 835c8fa456ec +parametrization/Curve.m --- a/+parametrization/Curve.m Wed Apr 10 22:21:13 2019 +0200 +++ b/+parametrization/Curve.m Wed Apr 10 22:22:46 2019 +0200 @@ -103,7 +103,10 @@ % Construct arcLength function using splines tvec = linspace(0,1,N); arcVec = obj.arcLength(0,tvec); - tFunc = spline(arcVec,tvec); % t as a function of arcLength + + % t as a function of arcLength. Monotonicity-preserving cubic splines. + tFunc = @(arcLen) pchip(arcVec,tvec,arcLen); + L = obj.arcLength(0,1); arcPar = @(s) tFunc(s*L); @@ -349,8 +352,6 @@ end end - - function g_norm = normalize(g0) g1 = g0(1,:); g2 = g0(2,:);
diff -r 1a265a376b36 -r 835c8fa456ec +parametrization/dataSpline.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+parametrization/dataSpline.m Wed Apr 10 22:22:46 2019 +0200 @@ -0,0 +1,19 @@ +% dataSpline calculates a Curve through the points f_i using cubic spline interpolation. +% The spline curve is parametrized with the arc length parametrization +% to facilitate better grids. +% +% f - m x D matrix of m points in D dimensions +function C = dataSpline(f) + m = size(f, 1); + + t = linspace(0,1,m); + + pp_g = spapi(4, t, f'); + pp_gp = fnder(pp_g); + + g = @(t) fnval(pp_g, t); + gp = @(t) fnval(pp_gp, t); + + C = parametrization.Curve(g, gp); + C = C.arcLengthParametrization(); +end
diff -r 1a265a376b36 -r 835c8fa456ec runtestsAll.m --- a/runtestsAll.m Wed Apr 10 22:21:13 2019 +0200 +++ b/runtestsAll.m Wed Apr 10 22:22:46 2019 +0200 @@ -15,7 +15,7 @@ rootSuite = matlab.unittest.TestSuite.fromFolder(pwd); packageSuites = {}; for i = 1:length(packages) - packageSuites{i} = matlab.unittest.TestSuite.fromPackage(packages{i}); + packageSuites{i} = matlab.unittest.TestSuite.fromPackage(packages{i}, 'IncludingSubpackages', true); end ts = [rootSuite, packageSuites{:}];
diff -r 1a265a376b36 -r 835c8fa456ec runtestsPackage.m --- a/runtestsPackage.m Wed Apr 10 22:21:13 2019 +0200 +++ b/runtestsPackage.m Wed Apr 10 22:22:46 2019 +0200 @@ -1,4 +1,4 @@ function res = runtestsPackage(pkgName) - ts = matlab.unittest.TestSuite.fromPackage(pkgName); + ts = matlab.unittest.TestSuite.fromPackage(pkgName, 'IncludingSubpackages', true); res = ts.run(); -end \ No newline at end of file +end