Mercurial > repos > public > sbplib
comparison +multiblock/DiffOpTest.m @ 201:38f203f00f3a feature/grids
Exeendend tests of multiblock.DiffOp.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 14 Jun 2016 15:07:34 +0200 |
parents | 6054dcd3c8a9 |
children |
comparison
equal
deleted
inserted
replaced
199:d18096820ed4 | 201:38f203f00f3a |
---|---|
1 function tests = DiffOpTest() | 1 function tests = DiffOpTest() |
2 tests = functiontests(localfunctions); | 2 tests = functiontests(localfunctions); |
3 end | 3 end |
4 | 4 |
5 function testCreation(testCase) | 5 function testCreation(testCase) |
6 g = multiblock.Grid({},{}); | 6 do = newMultiblockOp(); |
7 doHand = @(grid,order)[]; | |
8 order = 0; | |
9 do = multiblock.DiffOp(doHand, g, order); | |
10 end | 7 end |
11 | 8 |
12 function testMissing(testCase) | 9 function testSplitOp(testCase) |
13 testCase.verifyFail(); | 10 testCase.verifyFail(); |
14 end | 11 end |
15 | 12 |
13 function testBoundary_condition(testCase) | |
14 testCase.verifyFail(); | |
15 end | |
16 | 16 |
17 % function do = mockDiffOp() | 17 function testInterface(testCase) |
18 % do.H = 1; | 18 testCase.verifyFail(); |
19 % do.D = 1; | 19 end |
20 % end | 20 |
21 function testSize(testCase) | |
22 mbDo = newMultiblockOp(); | |
23 testCase.verifyEqual(mbDo.size(), 15) | |
24 end | |
25 | |
26 | |
27 function do = mockDiffOp(size, bc, interface) | |
28 do.H = 1; | |
29 do.D = 1; | |
30 | |
31 do.size = size; | |
32 do.boundary_condition = bc; | |
33 do.interface = interface; | |
34 end | |
35 | |
36 | |
37 function do = newMultiblockOp() | |
38 grids = { | |
39 grid.Cartesian([0 1 2], [3 4 5]); | |
40 grid.Cartesian([1 2 3], [10 20]); | |
41 }; | |
42 | |
43 conn = cell(2,2); | |
44 conn{1, 2} = {'s','n'}; | |
45 | |
46 mbGrid = multiblock.Grid(grids, conn); | |
47 | |
48 function [c, p] = boundary_condition(~,~,~,~) | |
49 c = 1; p = 1; | |
50 end | |
51 | |
52 function [c, p] = interface(~,~,~,~) | |
53 c = 1; p = 1; | |
54 end | |
55 | |
56 doHand = @(grid,~)mockDiffOp(@(~)prod(grid.size()), @boundary_condition, @interface); | |
57 | |
58 do = multiblock.DiffOp(doHand, mbGrid, 0); | |
59 end |