rbmatlab 0.10.01
|
00001 function demo(dummy) 00002 % function demo(dummy) 00003 % small script demonstrating the possibilities of the cubegrid 00004 % class. 00005 00006 % Bernard Haasdonk 9.5.2007 00007 00008 % various dimensional grids and plot routine: 00009 00010 disp(''); 00011 disp('plotting different dimensional grids and different plot modes') 00012 params.range = {[0,1]}; 00013 params.numintervals = [10]; 00014 g1 = cubegrid(params); 00015 params.shrink_factor = 0.9; 00016 params.plot_patch = 0; 00017 subplot(1,3,1), plot(g1,params); 00018 title('1D'); 00019 00020 params.range = {[0,1],[0,2]}; 00021 params.numintervals = [2,4]; 00022 g2 = cubegrid(params); 00023 params.plot_patch = 0; 00024 params.axis_equal = 1; 00025 subplot(1,3,2), plot(g2); 00026 title('2D, lines'); 00027 00028 params.range = {[0,1],[0,2],[1,2]}; 00029 params.numintervals = [2,2,2]; 00030 g3 = cubegrid(params); 00031 params.plot_patch = 1; 00032 params.color = [0.5 0.5 0]; 00033 params.shrink_factor = 0.9; 00034 subplot(1,3,3), plot(g3, params); 00035 title('3D, patches'); 00036 00037 disp('press key to continue'); 00038 pause(); 00039 00040 % refinement 00041 disp(' '); 00042 disp('demonstration of grid refinement') 00043 00044 % note: indices are leaf-indices, no global element indices!! 00045 g4 = refine(g2,[1,4]); 00046 g4 = refine(g4,[5,6,7]); 00047 g4 = refine(g4,[8,9,10]); 00048 00049 figure; 00050 subplot(1,2,1),plot_leafelement_data(g4,get(g4,'leafelements'),params) 00051 title('element ids of leaf elements'); 00052 params.shrink_factor = 1; 00053 subplot(1,2,2),plot_leafvertex_data(g4,1:get(g4,'nvertices'),params) 00054 title('vertex ids of leaf vertices'); 00055 00056 disp('press key to continue'); 00057 pause(); 00058 00059 disp(' '); 00060 disp('display method of grid:') 00061 display(g4); 00062 00063 disp('press key to continue'); 00064 pause(); 00065 00066 disp(' '); 00067 disp('get method of grid:') 00068 help cubegrid/get; 00069 00070 end 00071