view +parametrization/TiTest.m @ 774:66eb4a2bbb72 feature/grids

Remove default scaling of the system. The scaling doens't seem to help actual solutions. One example that fails in the flexural code. With large timesteps the solutions seems to blow up. One particular example is profilePresentation on the tdb_presentation_figures branch with k = 0.0005
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 18 Jul 2018 15:42:52 -0700
parents 77ad5de4432e
children
line wrap: on
line source

function tests = TiTest()
    tests = functiontests(localfunctions);
end

function testScalarInput(testCase)
    ti = getMinimumTi();

    cases = {
        % {u, v, out},
        {0, 0, [1; 2]},
        {0, 1, [1; 4]},
        {1, 0, [3; 2]},
        {1, 1, [3; 4]},
        {0.5, 0.5, [2; 3]},
    };

    for i = 1:length(cases)
        u = cases{i}{1};
        v = cases{i}{2};
        expected = cases{i}{3};

        testCase.verifyEqual(ti.S(u,v), expected, sprintf('Case: %d',i));
    end
end

function testRowVectorInput(testCase)
    ti = getMinimumTi();

    u = [0, 0.5, 1];
    v = [0, 0, 0.5];
    expected = [
        1, 2, 3;
        2, 2, 3;
    ];

    testCase.verifyEqual(ti.S(u,v), expected);
end

function testColumnvectorInput(testCase)
   ti = getMinimumTi();

    u = [0; 0.5; 1];
    v = [0; 0; 0.5];
    expected = [1; 2; 3; 2; 2; 3];

    testCase.verifyEqual(ti.S(u,v), expected);
end


function ti = getMinimumTi()
    ti = parametrization.Ti.rectangle([1; 2], [3; 4]);
end