source: issm/trunk/src/m/plot/plot_tensor_components.m

Last change on this file was 23189, checked in by Mathieu Morlighem, 7 years ago

merged trunk-jpl and trunk for revision 23187

File size: 2.9 KB
RevLine 
[13975]1function plot_tensor_components(md,options,width,i,tensor,type,plot_options)
[1]2%PLOT_TENSOR_COMPONENT - plot component of a tensor
3%
4% Usage:
[2439]5% plot_tensor_components(md,options,width,i,tensor,type,plot_option);
[1]6%
[338]7% See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
[1]8
[27]9%Compute the indexes of the components plots
10upperplots=fix((i-1)/width);
11if upperplots==0, leftplots=i-1; else leftplots=i-width*upperplots-1; end
[17806]12if dimension(md.mesh)==2 %3 components -> 3 indexes
[27]13 index1=4*width*upperplots+2*leftplots+1;
14 index2=index1+1;
15 index3=index1+width*2;
[17806]16elseif dimension(md.mesh)==3%6 components -> 6 indexes
[27]17 index1=3*3*width*upperplots+3*leftplots+1;
18 index2=index1+1;
19 index3=index1+2;
20 index4=index1+width*3;
21 index5=index4+1;
22 index6=index4+2;
23end
[1]24
[27]25%process data and model
[8472]26[x y z elements is2d isplanet]=processmesh(md,[],options);
[4330]27[tensor.xx datatype]=processdata(md,tensor.xx,options);
28[tensor.yy datatype]=processdata(md,tensor.yy,options);
29[tensor.xy datatype]=processdata(md,tensor.xy,options);
[17806]30if dimension(md.mesh)==3
[4330]31 [tensor.xz datatype]=processdata(md,tensor.xz,options);
32 [tensor.yz datatype]=processdata(md,tensor.yz,options);
33 [tensor.zz datatype]=processdata(md,tensor.zz,options);
[27]34end
[1]35
[17806]36if dimension(md.mesh)==2,
[27]37 subplot(2*width,2*width,index1),
[8472]38 plot_unit(x,y,z,elements,tensor.xx,is2d,isplanet,datatype,options)
[2439]39 Apply_options_tensor(md,options,type,'xx')
[27]40 subplot(2*width,2*width,index2),
[8472]41 plot_unit(x,y,z,elements,tensor.yy,is2d,isplanet,datatype,options)
[2439]42 Apply_options_tensor(md,options,type,'yy')
[27]43 subplot(2*width,2*width,index3),
[8472]44 plot_unit(x,y,z,elements,tensor.xy,is2d,isplanet,datatype,options)
[2439]45 Apply_options_tensor(md,options,type,'xy')
[27]46else
47 subplot(3*width,3*width,index1),
[8472]48 plot_unit(x,y,z,elements,tensor.xx,is2d,isplanet,datatype,options)
[2439]49 Apply_options_tensor(md,options,type,'xx')
[27]50 subplot(3*width,3*width,index2),
[8472]51 plot_unit(x,y,z,elements,tensor.yy,is2d,isplanet,datatype,options)
[2439]52 Apply_options_tensor(md,options,type,'yy')
[27]53 subplot(3*width,3*width,index3),
[8472]54 plot_unit(x,y,z,elements,tensor.zz,is2d,isplanet,datatype,options)
[2439]55 Apply_options_tensor(md,options,type,'zz')
[27]56 subplot(3*width,3*width,index4),
[8472]57 plot_unit(x,y,z,elements,tensor.xy,is2d,isplanet,datatype,options)
[2439]58 Apply_options_tensor(md,options,type,'xy')
[27]59 subplot(3*width,3*width,index5),
[8472]60 plot_unit(x,y,z,elements,tensor.xz,is2d,isplanet,datatype,options)
[2439]61 Apply_options_tensor(md,options,type,'xz')
[27]62 subplot(3*width,3*width,index6),
[8472]63 plot_unit(x,y,z,elements,tensor.yz,is2d,isplanet,datatype,options)
[2439]64 Apply_options_tensor(md,options,type,'yz')
[1]65end
[27]66end
[1]67
[2439]68function Apply_options_tensor(md,options,type,component)
[27]69 %apply options
[2439]70 if ismember('_',type) %user plotet stress_tensor
[20500]71 strings=strsplit_strict(type,'_');
[2439]72 string=strings{1};
73 else %default plot: user requested stress
74 string=type;
75 end
[23189]76 options=changefieldvalue(options,'title',[upper(string(1)) string(2:end) ' ' component]);
[2439]77 applyoptions(md,[],options);
[1]78end
Note: See TracBrowser for help on using the repository browser.