comparison +multiblock/BoundaryGroup.m @ 427:a613960a157b feature/quantumTriangles

merged with feature/beams
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 26 Jan 2017 15:59:25 +0100
parents 3cedd5a596bb
children d8833f0a9f1a
comparison
equal deleted inserted replaced
426:29944ea7674b 427:a613960a157b
1 % BoundaryGroup defines a boundary grouping in a multiblock grid.
2 classdef BoundaryGroup
3 properties
4 blockIDs
5 names
6 end
7
8 methods
9 function obj = BoundaryGroup(varargin)
10 % Input arguemnts are arbitrary number or 1x2 cell arrays
11 % representing each boundary in the group.
12 % The 1st element of the cell array is an integer defining which grid it belongs to.
13 % The 2nd element of the cell array is the name of the boundary within the block.
14 %
15 % Ex:
16 % bg = multiblock.BoundaryGroup({1,'n'},{1,'s'},{2,'s'})
17
18
19 obj.blockIDs = [];
20 obj.names = {};
21 for i = 1:length(varargin)
22 if ~iscell(varargin{i}) || ~all(size(varargin{i}) == [1 2])
23 error('multiblock:BoundaryGroup:BoundaryGroup:InvalidInput', 'Inputs must be 1x2 cell arrays');
24 end
25 obj.blockIDs(i) = varargin{i}{1};
26 obj.names{i} = varargin{i}{2};
27 end
28 end
29
30 function display(obj, name)
31
32 disp(' ')
33 disp([name, ' ='])
34 disp(' ')
35
36 if length(obj.names) == 1
37 fprintf(' {}\n\n')
38 return
39 end
40
41 fprintf(' {')
42
43 fprintf('%d:%s', obj.blockIDs(1), obj.names{1})
44 for i = 2:length(obj.names)
45 fprintf(', %d:%s', obj.blockIDs(i), obj.names{i});
46 end
47
48 fprintf('}\n\n')
49 end
50 end
51 end