rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
demo.m
1 function demo(dummy)
2 % function demo(dummy)
3 % small script demonstrating the possibilities of the cubegrid
4 % class.
5 
6 % Bernard Haasdonk 9.5.2007
7 
8 % various dimensional grids and plot routine:
9 
10 disp('');
11 disp('plotting different dimensional grids and different plot modes')
12 params.range = {[0,1]};
13 params.numintervals = [10];
14 g1 = cubegrid(params);
15 params.shrink_factor = 0.9;
16 params.plot_patch = 0;
17 subplot(1,3,1), plot(g1,params);
18 title('1D');
19 
20 params.range = {[0,1],[0,2]};
21 params.numintervals = [2,4];
22 g2 = cubegrid(params);
23 params.plot_patch = 0;
24 params.axis_equal = 1;
25 subplot(1,3,2), plot(g2);
26 title('2D, lines');
27 
28 params.range = {[0,1],[0,2],[1,2]};
29 params.numintervals = [2,2,2];
30 g3 = cubegrid(params);
31 params.plot_patch = 1;
32 params.color = [0.5 0.5 0];
33 params.shrink_factor = 0.9;
34 subplot(1,3,3), plot(g3, params);
35 title('3D, patches');
36 
37 disp('press key to continue');
38 pause();
39 
40 % refinement
41 disp(' ');
42 disp('demonstration of grid refinement')
43 
44 % note: indices are leaf-indices, no global element indices!!
45 g4 = refine(g2,[1,4]);
46 g4 = refine(g4,[5,6,7]);
47 g4 = refine(g4,[8,9,10]);
48 
49 figure;
50 subplot(1,2,1),plot_leafelement_data(g4,get(g4,'leafelements'),params)
51 title('element ids of leaf elements');
52 params.shrink_factor = 1;
53 subplot(1,2,2),plot_leafvertex_data(g4,1:get(g4,'nvertices'),params)
54 title('vertex ids of leaf vertices');
55 
56 disp('press key to continue');
57 pause();
58 
59 disp(' ');
60 disp('display method of grid:')
61 display(g4);
62 
63 disp('press key to continue');
64 pause();
65 
66 disp(' ');
67 disp('get method of grid:')
68 help cubegrid/get;
69 
70 end
71 
A hierarchical cubegrid of arbitrary dimension.
Definition: cubegrid.m:17
Definition: leaf.m:17