1 | function plot_rifts(md,options,nlines,ncols,index);
|
---|
2 | %PLOT_RIFTS - plot rifts in a mesh
|
---|
3 | %
|
---|
4 | % Usage:
|
---|
5 | % plot_rifts(md,options,width,i);
|
---|
6 | %
|
---|
7 | % See also: PLOTMODEL
|
---|
8 |
|
---|
9 | %process data and model
|
---|
10 | [x y z elements is2d]=processmesh(md,[],options);
|
---|
11 |
|
---|
12 | %plot mesh
|
---|
13 | subplot(nlines,ncols,index);
|
---|
14 |
|
---|
15 | %offset to separate rift flanks.
|
---|
16 | offset=getfieldvalue(options,'offset',500);
|
---|
17 | if isstruct(md.rifts),
|
---|
18 |
|
---|
19 | for i=1:md.numrifts,
|
---|
20 | penaltypairs=md.rifts(i).penaltypairs;
|
---|
21 |
|
---|
22 | normal=zeros(2,1);
|
---|
23 | for j=1:size(penaltypairs,1),
|
---|
24 | normal(1)=penaltypairs(j,5);
|
---|
25 | normal(2)=penaltypairs(j,6);
|
---|
26 | x(penaltypairs(j,1))=x(penaltypairs(j,1))-normal(1)*offset;
|
---|
27 | y(penaltypairs(j,1))=y(penaltypairs(j,1))-normal(2)*offset;
|
---|
28 | end
|
---|
29 | if length(md.rifts(i).tips)==3,
|
---|
30 | tip=md.rifts(i).tips(3);
|
---|
31 | %who is tip connected to?
|
---|
32 | if isconnected(md.elements,penaltypairs(1,1),tip),
|
---|
33 | normal(1)=penaltypairs(1,5);
|
---|
34 | normal(2)=penaltypairs(1,6);
|
---|
35 | x(tip)=x(tip)-normal(1)*offset;
|
---|
36 | y(tip)=y(tip)-normal(2)*offset;
|
---|
37 | end
|
---|
38 |
|
---|
39 | if isconnected(md.elements,penaltypairs(1,2),tip),
|
---|
40 | normal(1)=penaltypairs(1,5);
|
---|
41 | normal(2)=penaltypairs(1,6);
|
---|
42 | x(tip)=x(tip)+normal(1)*offset;
|
---|
43 | y(tip)=y(tip)+normal(2)*offset;
|
---|
44 | end
|
---|
45 | if isconnected(md.elements,penaltypairs(end,1),tip),
|
---|
46 | normal(1)=penaltypairs(end,5);
|
---|
47 | normal(2)=penaltypairs(end,6);
|
---|
48 | x(tip)=x(tip)-normal(1)*offset;
|
---|
49 | y(tip)=y(tip)-normal(2)*offset;
|
---|
50 | end
|
---|
51 | if isconnected(md.elements,penaltypairs(end,2),tip),
|
---|
52 | normal(1)=penaltypairs(end,5);
|
---|
53 | normal(2)=penaltypairs(end,6);
|
---|
54 | x(tip)=x(tip)+normal(1)*offset;
|
---|
55 | y(tip)=y(tip)+normal(2)*offset;
|
---|
56 | end
|
---|
57 | end
|
---|
58 | end
|
---|
59 | end
|
---|
60 |
|
---|
61 | %plot mesh
|
---|
62 | if is2d
|
---|
63 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
---|
64 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
65 | else
|
---|
66 | A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
|
---|
67 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
68 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
69 | patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
70 | patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
71 | patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
72 | end
|
---|
73 |
|
---|
74 | %apply options
|
---|
75 | options=addfielddefault(options,'title','Rifts');
|
---|
76 | options=addfielddefault(options,'colorbar',0);
|
---|
77 | applyoptions(md,[],options);
|
---|