Mercurial > repos > public > sbplib
comparison +multiblock/StaggeredSurface.m @ 1331:60c875c18de3 feature/D2_boundary_opt
Merge with feature/poroelastic for Elastic schemes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 10 Mar 2022 16:54:26 +0100 |
parents | 8aa0909125a4 |
children |
comparison
equal
deleted
inserted
replaced
1330:855871e0b852 | 1331:60c875c18de3 |
---|---|
1 classdef StaggeredSurface < handle | |
2 properties | |
3 grid | |
4 surfs | |
5 gridGroup | |
6 subGrid | |
7 | |
8 ZData | |
9 CData | |
10 | |
11 end | |
12 | |
13 methods | |
14 function obj = StaggeredSurface(g, gf, gridGroup, subGrid) | |
15 | |
16 default_arg('gridGroup', 1); | |
17 default_arg('subGrid', 1); | |
18 | |
19 obj.grid = g; | |
20 obj.gridGroup = gridGroup; | |
21 obj.subGrid = subGrid; | |
22 | |
23 % coords = obj.grid.points(); | |
24 % X = obj.grid.funcToPlotMatrices(coords(:,1)); | |
25 % Y = obj.grid.funcToPlotMatrices(coords(:,2)); | |
26 % V = obj.grid.funcToPlotMatrices(gf); | |
27 X = {}; | |
28 Y = {}; | |
29 V = {}; | |
30 | |
31 holdState = ishold(); | |
32 hold on | |
33 | |
34 surfs = cell(1, obj.grid.nBlocks); | |
35 gfIndex = 1; | |
36 for i = 1:g.nBlocks() | |
37 | |
38 gi = g.grids{i}.gridGroups{gridGroup}{subGrid}; | |
39 | |
40 X{i} = grid.funcToPlotMatrix(gi, gi.coords(:,1)); | |
41 Y{i} = grid.funcToPlotMatrix(gi, gi.coords(:,2)); | |
42 | |
43 Ni = gi.N(); | |
44 gf_i = gf(gfIndex:gfIndex+Ni-1); | |
45 V{i} = grid.funcToPlotMatrix(gi, gf_i); | |
46 | |
47 surfs{i} = surf(X{i}, Y{i}, V{i}); | |
48 gfIndex = gfIndex + Ni; | |
49 end | |
50 | |
51 if holdState == false | |
52 hold off | |
53 end | |
54 | |
55 obj.surfs = [surfs{:}]; | |
56 | |
57 obj.ZData = gf; | |
58 obj.CData = gf; | |
59 end | |
60 | |
61 function set(obj, propertyName, propertyValue) | |
62 set(obj.surfs, propertyName, propertyValue); | |
63 end | |
64 | |
65 function obj = set.ZData(obj, gf) | |
66 obj.ZData = gf; | |
67 | |
68 % V = obj.grid.funcToPlotMatrices(gf); | |
69 gfIndex = 1; | |
70 for i = 1:obj.grid.nBlocks() | |
71 gi = obj.grid.grids{i}.gridGroups{obj.gridGroup}{obj.subGrid}; | |
72 Ni = gi.N(); | |
73 gf_i = gf(gfIndex:gfIndex+Ni-1); | |
74 Vi = grid.funcToPlotMatrix(gi, gf_i); | |
75 obj.surfs(i).ZData = Vi; | |
76 | |
77 gfIndex = gfIndex + Ni; | |
78 end | |
79 end | |
80 | |
81 function obj = set.CData(obj, gf) | |
82 obj.CData = gf; | |
83 | |
84 % V = obj.grid.funcToPlotMatrices(gf); | |
85 gfIndex = 1; | |
86 for i = 1:obj.grid.nBlocks() | |
87 gi = obj.grid.grids{i}.gridGroups{obj.gridGroup}{obj.subGrid}; | |
88 Ni = gi.N(); | |
89 gf_i = gf(gfIndex:gfIndex+Ni-1); | |
90 Vi = grid.funcToPlotMatrix(gi, gf_i); | |
91 obj.surfs(i).CData = Vi; | |
92 | |
93 gfIndex = gfIndex + Ni; | |
94 end | |
95 end | |
96 end | |
97 end |