1 | function plot_rifts(md,options,width,i);
|
---|
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(width,width,i);
|
---|
14 |
|
---|
15 | %offset to separate rift flanks.
|
---|
16 | offset=getfieldvalue(options,'offset',500);
|
---|
17 | if isstruct(md.rifts),
|
---|
18 |
|
---|
19 | for i=1:size(md.rifts,1),
|
---|
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 | end
|
---|
30 | end
|
---|
31 |
|
---|
32 | %plot mesh
|
---|
33 | if is2d
|
---|
34 | A=elements(:,1); B=elements(:,2); C=elements(:,3);
|
---|
35 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
36 | else
|
---|
37 | A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
|
---|
38 | patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
39 | patch( 'Faces', [D E F], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
40 | patch( 'Faces', [A B E D], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
41 | patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
42 | patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
|
---|
43 | end
|
---|
44 |
|
---|
45 | %apply options
|
---|
46 | options=addfielddefault(options,'title','Rifts');
|
---|
47 | options=addfielddefault(options,'colorbar',0);
|
---|
48 | applyoptions(md,[],options);
|
---|