| MESH toolbox 0.1 Matlab/Octave mesh utils

- Main Page
- Related Pages
- Modules
- Files

- File List
- File Members

All Files Functions Groups Pages
MultiPlotBounds.m
Go to the documentation of this file.
1 function RGBcolors=MultiPlotBounds(varargin)
2 % function RGBcolors=MultiPlotBounds(varargin)
3 % Plot boundaries of list of meshes
4 %
5 % parameters:
6 % LoM : array of Meshes
7 % colormap : value can be \'Jet\', \'HSV\', \'Gray\', \'colorcube\',\'Cool\',\'Spring\',\'Summer\',...
8 % RGBcolors :
9 % BoundLineWidth : set boundaries lines width
10 % LabelLineWidth : set box label lines width
11 % FontSize : set font size value
12 % Label : set label visible, true or false
13 %
14 % Example:
15 % @verbatim
16 % MultiPlotBounds(LoM,'colormap','jet','Label',true) @endverbatim
17 % \image html images/MultiPlotBounds_Ring3x3_C.png "figure : MultiPlotBounds(LoM,\'colormap\',\'jet\',\'Label\',true)"
18 %
19 % See also :
20 % #LoM_demo1
21 p = inputParser;
22 p.addRequired('LoM', @isstruct);
23 %
24 p.addParamValue('colormap', 'Jet', @isstr );
25 p.addParamValue('RGBcolors', [], @isnumeric );
26 p.addParamValue('BoundLineWidth', 1.0 , @isnumeric );
27 p.addParamValue('LabelLineWidth', 2.0 , @isnumeric );
28 p.addParamValue('FontSize', 12 , @isnumeric );
29 p.addParamValue('Label', false , @islogical );
30 p.parse(varargin{:});
31
32 LoM=p.Results.LoM;
33 nM=length(LoM);
34 NumBound=unique(cat(2,LoM(:).bel));
35 nNB=length(NumBound);
36
37 hold on
38 cmap=colormap(p.Results.colormap);% colorcube ou Lines
39
40 t=0:1/(nNB-1):1;
41 if (isempty(p.Results.RGBcolors))
42 RGBcolors=RGB(t,cmap);
43 else
44 RGBcolors=p.Results.RGBcolors;
45 end
46
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %%%% Représentation des bords %%%%
49 boolNB=zeros(1,nNB);
50 for M=LoM % Boucle sur les maillages
51 NBoM=unique(M.bel);
52 for i=1:length(NBoM) % Boucle sur les numéros de bord
53 I=find(M.bel == NBoM(i));
54 icolor=find( NumBound == NBoM(i));
55 if ~isempty(I)
56 for j=I
57 h=plot([M.q(1,M.be(1,j)) M.q(1,M.be(2,j))], ...
58 [M.q(2,M.be(1,j)) M.q(2,M.be(2,j))]);
59 set(h,'Color',RGBcolors(icolor,:),'LineWidth',p.Results.BoundLineWidth);
60 end
61 end
62 end
63 end
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%% Numéro des bords %%%%
68 if p.Results.Label
69 boolNB=zeros(1,nNB);
70 for M=LoM % Boucle sur les maillages
71 NBoM=unique(M.bel);
72 for i=1:length(NBoM) % Boucle sur les numéros de bord
73 I=find(M.bel == NBoM(i));
74 icolor=find( NumBound == NBoM(i));
75 if ~isempty(I)
76 if (~boolNB(icolor))
77 boolNB(icolor)=1;
78 ip=I(round(length(I)/2));
79 Pmx=(M.q(:,M.be(1,ip))+M.q(:,M.be(2,ip)))/2;
80 h=text(Pmx(1),Pmx(2),['\Gamma_{',num2str(NBoM(i)),'}']);
81 set(h,'FontSize',p.Results.FontSize,'Color','k', ...
82 'BackgroundColor','w','LineWidth',p.Results.LabelLineWidth, ...
83 'EdgeColor',RGBcolors(icolor,:),'FontWeight','bold');
84 end
85 end
86 end
87 end
88 end
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 hold off
91 axis off
92 axis equal