Mercurial > repos > public > sbplib
changeset 189:6054dcd3c8a9 feature/grids
Added a class for boundary groups. Added methods stubs and failing tests.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 04 Mar 2016 17:20:30 +0100 |
parents | c5ca9bbfed41 |
children | 2c2ba1f3bbe3 |
files | +multiblock/BoundaryGroup.m +multiblock/DiffOpTest.m +multiblock/Grid.m +multiblock/GridTest.m |
diffstat | 4 files changed, 73 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+multiblock/BoundaryGroup.m Fri Mar 04 17:20:30 2016 +0100 @@ -0,0 +1,48 @@ +% BoundaryGroup defines a boundary grouping in a multiblock grid. +classdef BoundaryGroup + properties + blockIDs + names + end + + methods + function obj = BoundaryGroup(varargin) + % Input arguemnts are arbitrary number or 1x2 cell arrays + % representing each boundary in the group. + % The 1st element of the cell array is an integer defining which grid it belongs to. + % The 2nd element of the cell array is the name of the boundary within the block. + % + % Ex: + % bg = multiblock.BoundaryGroup({1,'n'},{1,'s'},{2,'s'}) + + + obj.blockIDs = []; + obj.names = {}; + for i = 1:length(varargin) + obj.blockIDs(i) = varargin{i}{1}; + obj.names{i} = varargin{i}{2}; + end + end + + function display(obj, name) + + disp(' ') + disp([name, ' =']) + disp(' ') + + if length(obj.names) == 1 + fprintf(' {}\n\n') + return + end + + fprintf(' {') + + fprintf('%d:%s', obj.blockIDs(1), obj.names{1}) + for i = 2:length(obj.names) + fprintf(', %d:%s', obj.blockIDs(i), obj.names{i}); + end + + fprintf('}\n\n') + end + end +end \ No newline at end of file
--- a/+multiblock/DiffOpTest.m Fri Mar 04 17:19:18 2016 +0100 +++ b/+multiblock/DiffOpTest.m Fri Mar 04 17:20:30 2016 +0100 @@ -9,7 +9,9 @@ do = multiblock.DiffOp(doHand, g, order); end - +function testMissing(testCase) + testCase.verifyFail(); +end % function do = mockDiffOp()
--- a/+multiblock/Grid.m Fri Mar 04 17:19:18 2016 +0100 +++ b/+multiblock/Grid.m Fri Mar 04 17:20:30 2016 +0100 @@ -15,7 +15,7 @@ % it's empty there is no connection otherwise it's a 2 % -cell-vector with strings naming the boundaries to be % connected. (inverted coupling?) - function obj = Grid(grids, connections) + function obj = Grid(grids, connections, boundaryGroup) obj.grids = grids; obj.connections = connections; @@ -93,5 +93,14 @@ end end + + function bs = getBoundaryNames(obj) + bs = []; + end + + % Return coordinates for the given boundary + function b = getBoundary(obj, name) + b = []; + end end end
--- a/+multiblock/GridTest.m Fri Mar 04 17:19:18 2016 +0100 +++ b/+multiblock/GridTest.m Fri Mar 04 17:20:30 2016 +0100 @@ -4,4 +4,16 @@ function testCreation(testCase) g = multiblock.Grid({},{}); +end + +function testMissing(testCase) + testCase.verifyFail(); +end + +function testGetBoundaryNames(testCase) + testCase.verifyFail(); +end + +function testGetBoundary(testCase) + testCase.verifyFail(); end \ No newline at end of file