Changeset 8728


Ignore:
Timestamp:
06/28/11 00:40:35 (14 years ago)
Author:
Eric.Larour
Message:

New planet class, derived from model. New plots
for planet class.

Location:
issm/trunk/src/m
Files:
8 added
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/version/7.7/model.m

    r8650 r8728  
    2626                 bamg=struct();
    2727                 dim=0;
    28                  planet=0;
    2928                 numberofelements=0;
    3029                 numberofnodes=0;
  • issm/trunk/src/m/model/plot/applyoptions.m

    r8420 r8728  
    222222        if exist(options,'colorbartitle'),
    223223                set(get(c,'title'),'FontSize',getfieldvalue(options,'colorbarfontsize',fontsize),'String',getfieldvalue(options,'colorbartitle'),...
    224                         'Color',getfieldvalue(options,'FontColor','k'),'Interpreter',getfieldvalue(options,'Interpreter','none'));
     224                        'Color',getfieldvalue(options,'FontColor','k'),'Interpreter',getfieldvalue(options,'Interpreter','none'),'Interpreter','Tex');
    225225        end
    226226        if exist(options,'colorbarYLabel'),
  • issm/trunk/src/m/model/plot/plot_mesh.m

    r8472 r8728  
    2222        patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
    2323else
    24         if ~md.planet,
     24        if ~isplanet,
    2525                A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4); E=elements(:,5); F=elements(:,6);
    2626                patch( 'Faces', [A B C],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
     
    3030                patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
    3131        else
    32                 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
     32                A=elements(:,1); B=elements(:,2); C=elements(:,3);
     33                if (size(elements,2)==4), D=elements(:,4); else D=C; end
    3334                patch( 'Faces', [A B C D],  'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor',edgecolor,'linewidth',linewidth);
    34 
    3535        end
    3636end
  • issm/trunk/src/m/model/plot/plot_qmuhistnorm.m

    r7546 r8728  
    3838if exist(options,'cdfleg'), cdfleg=getfieldvalue(options,'cdfleg'); qmuoptions=[qmuoptions ',''cdfleg'',''' cdfleg '''']; end
    3939if exist(options,'nrmplt'), nrmplt=getfieldvalue(options,'nrmplt'); qmuoptions=[qmuoptions ',''nrmplt'',''' nrmplt '''']; end
     40if exist(options,'EdgeColor'), EdgeColor=getfieldvalue(options,'EdgeColor'); qmuoptions=[qmuoptions ',''EdgeColor'',''' EdgeColor '''']; end
     41if exist(options,'FaceColor'), FaceColor=getfieldvalue(options,'FaceColor'); qmuoptions=[qmuoptions ',''FaceColor'',''' FaceColor '''']; end
    4042
    4143%use qmu plot
  • issm/trunk/src/m/model/plot/plot_section.m

    r8472 r8728  
    2525%Get number of curves and generate random colors
    2626numcurves=size(data,2);
    27 colorm=getfieldvalue(options,'colormap','jet');
    28 color=eval([ colorm '(numcurves);']);
     27colorm=getfieldvalue(options,'colormap','lines');
     28color=eval([ colorm '(numcurves);'])
    2929options=removefield(options,'colormap',0); %back to default colormap
    3030
     
    3535end
    3636
    37 %Loop over number of curves
    38 for i=1:numcurves,
    39 
    40         [datai datatype]=processdata(md3d,data(:,i),options);
    41 
    42         %resolution
    43         if exist(options,'resolution'),
    44                 resolution=getfieldvalue(options,'resolution');
    45         else %Default resolution
    46                 resolution=[1000 10*md.numlayers];
    47                 disp(['plot_section warning: no resolution specified, use default resolution: [horizontal_resolution vertical_resolution]=[' num2str(resolution)  ']']);
    48         end
    49 
    50         %Compute section value
    51         [elements,x,y,z,s,data_s]=SectionValues(md,datai,getfieldvalue(options,'sectionvalue'),resolution);
    52 
    53         %units
    54         if exist(options,'unit'),
    55                 unit=getfieldvalue(options,'unit');
    56                 x=x*unit;
    57                 y=y*unit;
    58                 z=z*unit;
    59                 s=s*unit;
    60         end
    61 
    62         %2D
    63         if is2d
    64 
    65                 %Show Section if requested by user
    66                 if exist(options,'showsection')
    67 
    68                         %compute number of labels
    69                         numlabels=min(getfieldvalue(options,'showsection'),length(s));
    70                         shift=fix(length(s)/numlabels);
    71 
    72                         %plot labels on current graph
    73                         hold on
    74                         text(s(1),data_s(1),'1','backgroundcolor',[0.8 0.9 0.8])
    75                         for i=2:numlabels-1
    76                                 text(s(1+(i-1)*shift),data_s(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
    77                         end
    78                         text(s(end),data_s(end),'end','backgroundcolor',[0.8 0.9 0.8])
    79 
    80                         %plot section only with labels
    81                         subplot(nlines,ncols,index2)
    82                         plot_unit(x_m,y_m,z_m,elements_m,data(:,i),is2d,isplanet,datatype,options)
    83                         hold on
    84                         text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
    85                         for i=2:numlabels-1
    86                                 text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
    87                         end
    88                         text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8])
    89                         plot(x,y,'-r')
    90                         axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1])
    91                         view(2)
     37%read contours:
     38profiles=expread(getfieldvalue(options,'sectionvalue'),1);
     39numprofiles=length(profiles);
     40
     41%Loop over number of profiles:
     42for profile_i=1:numprofiles,
     43        profile=profiles(profile_i);
     44
     45        %Loop over number of curves
     46        for i=1:numcurves,
     47
     48                [datai datatype]=processdata(md3d,data(:,i),options);
     49
     50                %resolution
     51                if exist(options,'resolution'),
     52                        resolution=getfieldvalue(options,'resolution');
     53                else %Default resolution
     54                        resolution=[1000 10*md.numlayers];
     55                        disp(['plot_section warning: no resolution specified, use default resolution: [horizontal_resolution vertical_resolution]=[' num2str(resolution)  ']']);
    9256                end
    9357
    94                 %plot section value
    95                 hold on;
    96                 subplot(nlines,ncols,index1)
    97                 %subplot(1,3,[2 3])
    98                 if i==1,
    99                         plot(s,data_s,'-','color','k','LineWidth',getfieldvalue(options,'linewidth',1))
    100                 elseif i==2,
    101                         plot(s,data_s,':','color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
    102                 else
    103                         plot(s,data_s,'--','color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
     58                %Compute section value
     59                [elements,x,y,z,s,data_s]=SectionValues(md,datai,profile,resolution);
     60
     61                %units
     62                if exist(options,'unit'),
     63                        unit=getfieldvalue(options,'unit');
     64                        x=x*unit;
     65                        y=y*unit;
     66                        z=z*unit;
     67                        s=s*unit;
    10468                end
    10569
    106 
    107                 %3D
    108         else
    109                 %plot section value
    110                 %if user requested view2: 2d plot with curvilinear coordinate
    111                 if (getfieldvalue(options,'view',3)==2 )
     70                %2D
     71                if is2d
    11272
    11373                        %Show Section if requested by user
     
    12080                                %plot labels on current graph
    12181                                hold on
    122                                 text(s(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8])
     82                                text(s(1),data_s(1),'1','backgroundcolor',[0.8 0.9 0.8])
    12383                                for i=2:numlabels-1
    124                                         text(s(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
    125                                 end
    126                                 text(s(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8])
     84                                        text(s(1+(i-1)*shift),data_s(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
     85                                end
     86                                text(s(end),data_s(end),'end','backgroundcolor',[0.8 0.9 0.8])
    12787
    12888                                %plot section only with labels
    12989                                subplot(nlines,ncols,index2)
    130                                 plot_unit(x_m,y_m,z_m,elements_m,data(:,i),is2d,datatype,options)
     90                                plot_unit(x_m,y_m,z_m,elements_m,data(:,i),is2d,isplanet,datatype,options)
    13191                                hold on
    13292                                text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     
    140100                        end
    141101
     102                        %plot section value
     103                        hold on;
    142104                        subplot(nlines,ncols,index1)
    143                         A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4);
    144                         patch( 'Faces', [A B C D], 'Vertices', [s z zeros(length(s),1)],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none');
    145 
     105                        %subplot(1,3,[2 3])
     106                        plot(s,data_s,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
     107
     108
     109                        %3D
    146110                else
    147 
    148                         %Show Section if requested by user
    149                         if exist(options,'showsection')
    150 
    151                                 %compute number of labels
    152                                 numlabels=min(getfieldvalue(options,'showsection'),length(s));
    153                                 shift=fix(length(x)/numlabels);
    154 
    155                                 %plot labels on current graph
    156                                 hold on
    157                                 text(x(1),y(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8])
    158                                 for i=2:numlabels-1
    159                                         text(x(1+(i-1)*shift),y(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
    160                                 end
    161                                 text(x(end),y(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8])
    162 
    163                                 %plot section only with labels
    164                                 subplot(nlines,ncols,index2)
    165                                 plot_unit(x_m,y_m,z_m,elements_m,data,is2d,datatype,options)
    166                                 hold on
    167                                 text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
    168                                 for i=2:numlabels-1
    169                                         text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
    170                                 end
    171                                 text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8])
    172                                 plot(x,y,'-r')
    173                                 axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1])
    174                                 view(2)
     111                        %plot section value
     112                        %if user requested view2: 2d plot with curvilinear coordinate
     113                        if (getfieldvalue(options,'view',3)==2 )
     114
     115                                %Show Section if requested by user
     116                                if exist(options,'showsection')
     117
     118                                        %compute number of labels
     119                                        numlabels=min(getfieldvalue(options,'showsection'),length(s));
     120                                        shift=fix(length(s)/numlabels);
     121
     122                                        %plot labels on current graph
     123                                        hold on
     124                                        text(s(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8])
     125                                        for i=2:numlabels-1
     126                                                text(s(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
     127                                        end
     128                                        text(s(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8])
     129
     130                                        %plot section only with labels
     131                                        subplot(nlines,ncols,index2)
     132                                        plot_unit(x_m,y_m,z_m,elements_m,data(:,i),is2d,datatype,options)
     133                                        hold on
     134                                        text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     135                                        for i=2:numlabels-1
     136                                                text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
     137                                        end
     138                                        text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8])
     139                                        plot(x,y,'-r')
     140                                        axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1])
     141                                        view(2)
     142                                end
     143
     144                                subplot(nlines,ncols,index1)
     145                                A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4);
     146                                patch( 'Faces', [A B C D], 'Vertices', [s z zeros(length(s),1)],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none');
     147
     148                        else
     149
     150                                %Show Section if requested by user
     151                                if exist(options,'showsection')
     152
     153                                        %compute number of labels
     154                                        numlabels=min(getfieldvalue(options,'showsection'),length(s));
     155                                        shift=fix(length(x)/numlabels);
     156
     157                                        %plot labels on current graph
     158                                        hold on
     159                                        text(x(1),y(1),z(1),'1','backgroundcolor',[0.8 0.9 0.8])
     160                                        for i=2:numlabels-1
     161                                                text(x(1+(i-1)*shift),y(1+(i-1)*shift),z(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
     162                                        end
     163                                        text(x(end),y(end),z(end),'end','backgroundcolor',[0.8 0.9 0.8])
     164
     165                                        %plot section only with labels
     166                                        subplot(nlines,ncols,index2)
     167                                        plot_unit(x_m,y_m,z_m,elements_m,data,is2d,datatype,options)
     168                                        hold on
     169                                        text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
     170                                        for i=2:numlabels-1
     171                                                text(x(1+(i-1)*shift),y(1+(i-1)*shift),num2str(i),'backgroundcolor',[0.8 0.9 0.8])
     172                                        end
     173                                        text(x(end),y(end),'end','backgroundcolor',[0.8 0.9 0.8])
     174                                        plot(x,y,'-r')
     175                                        axis([min(md.x)-1 max(md.x)+1 min(md.y)-1 max(md.y)+1])
     176                                        view(2)
     177                                end
     178
     179                                subplot(nlines,ncols,index1)
     180                                A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4);
     181                                patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none');
     182                                view(3)
     183
    175184                        end
    176 
    177                         subplot(nlines,ncols,index1)
    178                         A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4);
    179                         patch( 'Faces', [A B C D], 'Vertices', [x y z],'FaceVertexCData',data_s,'FaceColor','interp','EdgeColor','none');
    180                         view(3)
    181 
    182185                end
    183186        end
  • issm/trunk/src/m/model/plot/plot_unit.m

    r8472 r8728  
    4242                                patch( 'Faces', [C A D F],'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
    4343                        else
    44                                 A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
     44                                A=elements(:,1); B=elements(:,2); C=elements(:,3);
     45                                if size(elements,2)==4, D=elements(:,4); else D=C; end
    4546                                patch( 'Faces', [A B C D],  'Vertices', [x y z],'FaceVertexCData', data(:),'FaceColor','interp','EdgeColor',edgecolor);
    4647                        end
  • issm/trunk/src/m/model/plot/processmesh.m

    r8472 r8728  
    9292end
    9393
    94 if md.planet,
     94if isa(md,'planet'),
    9595        isplanet=1;
    9696else
Note: See TracChangeset for help on using the changeset viewer.