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