comparison +multiblock/Surface.m @ 542:febd750965c4 feature/grids

Add classes for easy plotting of functions on a multi block grid
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Aug 2017 16:46:58 +0200
parents
children 24b2487b01c2
comparison
equal deleted inserted replaced
541:3377bedf371f 542:febd750965c4
1 classdef Surface < handle
2 properties
3 grid
4 surfs
5
6 ZData
7 CData
8
9 end
10
11 methods
12 function obj = Surface(g, gf)
13 obj.grid = g;
14
15 coords = obj.grid.points();
16 X = obj.grid.funcToPlotMatrices(coords(:,1));
17 Y = obj.grid.funcToPlotMatrices(coords(:,2));
18
19 V = obj.grid.funcToPlotMatrices(gf);
20
21
22 holdState = ishold();
23 hold on
24
25 surfs = {1, obj.grid.nBlocks};
26 for i = 1:obj.grid.nBlocks
27 surfs{i} = surf(X{i}, Y{i}, V{i});
28 end
29
30 if holdState == false
31 hold off
32 end
33
34 obj.surfs = [surfs{:}];
35
36 obj.ZData = gf;
37 obj.CData = gf;
38 end
39
40 function set(obj, propertyName, propertyValue)
41 set(obj.surfs, propertyName, propertyValue);
42 end
43
44 function obj = set.ZData(obj, gf)
45 obj.ZData = gf;
46
47 V = obj.grid.funcToPlotMatrices(gf);
48 for i = 1:obj.grid.nBlocks
49 obj.surfs(i).ZData = V{i};
50 end
51 end
52
53 function obj = set.CData(obj, gf)
54 obj.CData = gf;
55
56 V = obj.grid.funcToPlotMatrices(gf);
57 for i = 1:obj.grid.nBlocks
58 obj.surfs(i).CData = V{i};
59 end
60 end
61 end
62 end