3 % demo
function using refine mesh tools and mesh plot command.
6 % save :
set to
true to save figures in image directory.
7 % savename :
set save file base name.
8 % percent :
set color mesh lines
9 % meshfile :
set mesh file name
10 % randlabel :
if true, boundaries label
set to random values
13 % - Original mesh (Th)
14 % \image html images/RefineMesh1.png "figure : Mesh before refinement"
15 % \image latex images/RefineMesh1.eps "My application" width=10cm
16 % - Refine mesh (Thr1)
18 % Thr1=RefineMesh(Th);
@endverbatim
19 % \image html images/RefineMesh2.png
"figure : Mesh after refinement : sort=false"
20 % - Refine mesh with sort boundaries (Thr2)
22 % Thr2=
RefineMesh(Th,'sort',true);
@endverbatim
23 % \image html images/RefineMesh3.png
"figure : Mesh after refinement : sort=true"
29 p.addParamValue(
'save',
false, @islogical );
30 p.addParamValue(
'savename',
'RefineMesh', @isstr );
31 p.addParamValue(
'percent', 50 , @(t) ((t>0)&&(t<=100)) );
32 p.addParamValue(
'meshfile',[
'mesh',filesep,
'disque4-1-3.msh'], @isstr );
33 p.addParamValue(
'randlabel',
false,@islogical);
43 % give random boundaries label
44 if p.Results.randlabel
49 I=find(Th.bel == LB(i));
59 PlotBoundsEdgeNumber(Th,'RGBEdgeColors',RGBcolors,'Color',[0 0 0],'LineStyle','-','LineWidth',0.5);
60 SaveImage(p.Results.save,[p.Results.savename,'1'],p.Results.percent)
61 title('Mesh before refinement')
66 PlotBounds(Thref,'LineWidth',2,'RGBcolors',RGBcolors);
67 PlotBoundsEdgeNumber(Thref,'RGBEdgeColors',RGBcolors,'Color',[0 0 0],'LineStyle','-','LineWidth',0.5);
68 SaveImage(p.Results.save,[p.Results.savename,'2'],p.Results.percent)
69 title('Mesh after refinement : sort=false')
74 PlotBounds(Threfs,'LineWidth',2,'RGBcolors',RGBcolors);
75 PlotBoundsEdgeNumber(Threfs,'RGBEdgeColors',RGBcolors,'Color',[0 0 0],'LineStyle','-','LineWidth',0.5);
76 SaveImage(p.Results.save,[p.Results.savename,'3'],p.Results.percent)
77 title('Mesh after refinement : sort=true')