comparison +grid/primalDual1DTest.m @ 1259:99f92bfc1157 feature/poroelastic

Add staggered operators and 1D grids
author Martin Almquist <malmquist@stanford.edu>
date Tue, 14 Apr 2020 17:50:49 -0700
parents
children
comparison
equal deleted inserted replaced
1253:89dad61cad22 1259:99f92bfc1157
1 function tests = primalDual1DTest()
2 tests = functiontests(localfunctions);
3 end
4
5
6 function testErrorInvalidLimits(testCase)
7 in = {
8 {10,{1}},
9 {10,[0,1]},
10 {10,{1,0}},
11 };
12
13 for i = 1:length(in)
14 testCase.verifyError(@()grid.primalDual1D(in{i}{:}),'grid:primalDual1D:InvalidLimits',sprintf('in(%d) = %s',i,toString(in{i})));
15 end
16 end
17
18 function testCompiles(testCase)
19 in = {
20 {5, {0,1}},
21 };
22
23 out = {
24 {[0; 0.25; 0.5; 0.75; 1], [0; 0.125; 0.375; 0.625; 0.875; 1]},
25 };
26
27 for i = 1:length(in)
28 [gp, gd] = grid.primalDual1D(in{i}{:});
29 testCase.verifyEqual(gp.points(),out{i}{1});
30 testCase.verifyEqual(gd.points(),out{i}{2});
31 end
32 end