1 | function plot_riftnumbering(md,options,nlines,ncols,index);
|
---|
2 | %PLOT_RIFTNUMBERING - plot rift penetration + numbering of all rift vertices, as well as rift numbers.
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % plot_riftnumbering(md,options,width,i);
|
---|
6 | %
|
---|
7 | % See also: PLOTMODEL
|
---|
8 |
|
---|
9 | %process data and model
|
---|
10 | [x y z elements is2d isplanet]=processmesh(md,[],options);
|
---|
11 | fontsize=getfieldvalue(options,'FontSize',8);
|
---|
12 |
|
---|
13 | subplot(nlines,ncols,index);
|
---|
14 | hold on
|
---|
15 |
|
---|
16 | %plot mesh boundaries
|
---|
17 | for i=1:size(md.segments,1),
|
---|
18 | plot(x(md.segments(i,1:2)),y(md.segments(i,1:2)),'k.-');
|
---|
19 | end
|
---|
20 |
|
---|
21 | isp1=0;
|
---|
22 | isp2=0;
|
---|
23 |
|
---|
24 | if isstruct(md.rifts.riftstruct),
|
---|
25 | %plot mesh boundaries
|
---|
26 | for i=1:size(md.segments,1),
|
---|
27 | h1=plot(x(md.segments(i,1:2)),y(md.segments(i,1:2)),'b-');
|
---|
28 | end
|
---|
29 | for i=1:size(md.rifts.riftstruct,1),
|
---|
30 | penaltypairs=md.rifts.riftstruct(i).penaltypairs;
|
---|
31 |
|
---|
32 | segments=md.rifts.riftstruct(i).segments;
|
---|
33 | for j=1:size(segments,1),
|
---|
34 | plot(x(segments(j,1:2)),y(segments(j,1:2)),'b-');
|
---|
35 | end
|
---|
36 |
|
---|
37 | normal=zeros(2,1);
|
---|
38 | for j=1:size(penaltypairs,1),
|
---|
39 | normal(1)=penaltypairs(j,5);
|
---|
40 | normal(2)=penaltypairs(j,6);
|
---|
41 |
|
---|
42 | vx1=md.initialization.vx(penaltypairs(j,1));
|
---|
43 | vx2=md.initialization.vx(penaltypairs(j,2));
|
---|
44 | vy1=md.initialization.vy(penaltypairs(j,1));
|
---|
45 | vy2=md.initialization.vy(penaltypairs(j,2));
|
---|
46 | penetration=(vx2-vx1)*normal(1)+(vy2-vy1)*normal(2);
|
---|
47 | %if penetration is negative, plot in black, positive, plot in red;: ie: if rift is closing, black, if rift is opening, red.
|
---|
48 | if(penetration>0),
|
---|
49 | p2=plot(x(penaltypairs(j,1)) ,y(penaltypairs(j,1)),'ro-','LineWidth',1);
|
---|
50 | set(p2,'MarkerSize',3);
|
---|
51 | isp2=1;
|
---|
52 | else
|
---|
53 | p1=plot(x(penaltypairs(j,1)) ,y(penaltypairs(j,1)),'ko-','LineWidth',1);
|
---|
54 | set(p1,'MarkerSize',3);
|
---|
55 | isp1=1;
|
---|
56 | end
|
---|
57 | end
|
---|
58 |
|
---|
59 | %point out the tips
|
---|
60 | h2=plot(x(md.rifts.riftstruct(i).tips(1)),y(md.rifts.riftstruct(i).tips(1)),'g*');
|
---|
61 | plot(x(md.rifts.riftstruct(i).tips(2)),y(md.rifts.riftstruct(i).tips(2)),'g*');
|
---|
62 | end
|
---|
63 | if strcmpi(getfieldvalue(options,'legend','on'),'on'),
|
---|
64 | if isp1 & isp2
|
---|
65 | l=legend([h1,h2,p1,p2],'mesh boundaries','crack tips','faults','rifts');
|
---|
66 | elseif isp1
|
---|
67 | l=legend([h1,h2,p1],'mesh boundaries','crack tips','faults');
|
---|
68 | elseif isp2
|
---|
69 | l=legend([h1,h2,p2],'mesh boundaries','crack tips','rifts');
|
---|
70 | else
|
---|
71 | l=legend([h1,h2],'mesh boundaries','crack tips');
|
---|
72 | end
|
---|
73 | set(l,'Location',getfieldvalue(options,'legend_location','NorthEast'));
|
---|
74 | end
|
---|
75 | else
|
---|
76 | error('plot error message: no rifts available!');
|
---|
77 | end
|
---|
78 |
|
---|
79 | %Now, plot rift vertices numbers.
|
---|
80 | for i=1:size(md.rifts.riftstruct,1),
|
---|
81 | penaltypairs=md.rifts.riftstruct(i).penaltypairs;
|
---|
82 |
|
---|
83 | for j=1:size(penaltypairs,1),
|
---|
84 | node=penaltypairs(j,1);
|
---|
85 | t=text(x(node),y(node),[num2str(i) '.' num2str(j)]);
|
---|
86 | set(t,'FontSize',fontsize);
|
---|
87 | end
|
---|
88 | end
|
---|
89 |
|
---|
90 |
|
---|
91 | %apply options
|
---|
92 | options=addfielddefault(options,'title','Rift/Fault location');
|
---|
93 | options=addfielddefault(options,'colorbar',0);
|
---|
94 | applyoptions(md,[],options);
|
---|