Changeset 427 for trunk/src/uvmat.m


Ignore:
Timestamp:
May 17, 2012, 11:33:21 PM (9 years ago)
Author:
sommeria
Message:

merge_proj corrected to project simulataneously velocity, vort, div...
Time reintroduced correctly
bug corrections for objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r426 r427  
    16251625end
    16261626CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&&isempty(j2));
     1627
     1628% the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected)
    16271629if CheckFixPair
    16281630    if get(handles.scan_i,'Value')==1% case of scanning along index i
     
    16411643        end
    16421644    end
     1645   
     1646% the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected):
     1647% the list of existing indices recorded in UvData is used
    16431648else
    16441649    UvData=get(handles.uvmat,'UserData');
    16451650    ref_i=i1;
    16461651    if ~isempty(i2)
    1647         ref_i=floor((i1+i2)/2);
     1652        ref_i=floor((i1+i2)/2);% current reference index i
    16481653    end
    16491654    ref_j=1;
     
    16511656        ref_j=j1;
    16521657        if ~isempty(j2)
    1653             ref_j=floor((j1+j2)/2);
     1658            ref_j=floor((j1+j2)/2);% current reference index j
    16541659        end
    16551660    end
    16561661    if ~isempty(increment)
    16571662        if get(handles.scan_i,'Value')==1% case of scanning along index i
    1658             ref_i=ref_i+increment;
     1663            ref_i=ref_i+increment;% increment the current reference index i
    16591664        else % case of scanning along index j (burst numbers)
    1660             ref_j=ref_j+increment;
     1665            ref_j=ref_j+increment;% increment the current reference index j if scan_j option is used
    16611666        end
    16621667    else % free increment
     
    16901695        return
    16911696    end
    1692     if get(handles.scan_i,'Value')==1% case of scanning along index i
    1693         i1_subseries=UvData.i1_series{1}(ref_i+1,ref_j+1,:);
    1694     else
    1695         i1_subseries=UvData.i1_series{1}(ref_i+1,ref_j+1,:);
    1696     end
     1697    i1_subseries=UvData.i1_series{1}(ref_i+1,ref_j+1,:);
    16971698    i1_subseries=i1_subseries(i1_subseries>0);
    16981699    if isempty(i1_subseries)
    16991700        errormsg='no next file';
    17001701        return
    1701     end
    1702     i1=i1_subseries(end);
     1702    else
     1703        i1=i1_subseries(end);
     1704    end
    17031705    if ~isempty(UvData.i2_series{1})
    1704         if get(handles.scan_i,'Value')==1% case of scanning along index i
    1705             i2_subseries=UvData.i2_series{1}(ref_i+1,ref_j+1,:);
    1706         else
    1707             i2_subseries=UvData.i2_series{1}(ref_i+1,ref_j+1,:);
    1708         end
     1706        i2_subseries=UvData.i2_series{1}(ref_i+1,ref_j+1,:);
    17091707        i2_subseries=i2_subseries(i2_subseries>0);
    17101708        i2=i2_subseries(end);
    17111709    end
    17121710    if ~isempty(UvData.j1_series{1})
    1713         if get(handles.scan_i,'Value')==1% case of scanning along index i
    1714             j1_subseries=UvData.j1_series{1}(ref_i+1,ref_j+1,:);
    1715         else
    1716             j1_subseries=UvData.j1_series{1}(ref_i+1,ref_j+1,:);
    1717         end
     1711        j1_subseries=UvData.j1_series{1}(ref_i+1,ref_j+1,:);
    17181712        j1_subseries=j1_subseries(j1_subseries>0);
    17191713        j1=j1_subseries(end);
    17201714    end
    17211715    if ~isempty(UvData.j2_series{1})
    1722         if get(handles.scan_i,'Value')==1% case of scanning along index i
    1723             j2_subseries=UvData.j2_series{1}(ref_i+1,ref_j+1,:);
    1724         else
    1725             j2_subseries=UvData.j2_series{1}(ref_i+1,ref_j+1,:);
    1726         end
     1716        j2_subseries=UvData.j2_series{1}(ref_i+1,ref_j+1,:);
    17271717        j2_subseries=j2_subseries(j2_subseries>0);
    17281718        j2=j2_subseries(end);
    1729     end
    1730    
     1719    end 
     1720    % case of a second file series
     1721    if numel(UvData.i1_series)>=2
     1722        i1_subseries=UvData.i1_series{2}(ref_i+1,ref_j+1,:);
     1723        i1_subseries=i1_subseries(i1_subseries>0);
     1724        i1_1=i1_subseries(end);
     1725        if ~isempty(UvData.i2_series{2})
     1726            i2_subseries=UvData.i2_series{2}(ref_i+1,ref_j+1,:);
     1727            i2_subseries=i2_subseries(i2_subseries>0);
     1728            i2_1=i2_subseries(end);
     1729        end
     1730        if ~isempty(UvData.j1_series{2})
     1731            j1_subseries=UvData.j1_series{2}(ref_i+1,ref_j+1,:);
     1732            j1_subseries=j1_subseries(j1_subseries>0);
     1733            j1_1=j1_subseries(end);
     1734        end
     1735        if ~isempty(UvData.j2_series{2})
     1736            j2_subseries=UvData.j2_series{2}(ref_i+1,ref_j+1,:);
     1737            j2_subseries=j2_subseries(j2_subseries>0);
     1738            j2_1=j2_subseries(end);
     1739        end
     1740    end
    17311741end
    17321742filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2);
     
    21042114    if test_keepdata_1
    21052115        Field{2}=UvData.Field_1;% keep the stored field
     2116        ParamOut_1=UvData.ParamOut_1;
    21062117    else
    21072118        ParamIn_1.FieldName=FieldName_1;
     
    23652376   [UvData.Field,errormsg]=sub_field(Field{1},Field{2}); 
    23662377   UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
     2378   UvData.ParamOut_1=ParamOut_1;
    23672379else
    23682380   UvData.Field=Field{1};
     
    39573969ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)}
    39583970plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles);
    3959 Object_out=update_obj(UvData,get(handles.ListObject_1,'Value'),[])
     3971Object_out=update_obj(UvData,get(handles.ListObject_1,'Value'),[]);
    39603972
    39613973%% display the object parameters if the GUI set_object is already opened
    3962 % hset_object=findobj(allchild(0),'tag','set_object');
    3963 %if ~isempty(hset_object)
    39643974if ~get(handles.ViewObject,'Value')
    3965 %     delete(hset_object)% delete to refesh the content
    39663975    ZBounds=0; % default
    39673976    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     
    39793988%------------------------------------------------------------------------
    39803989% --- Executes on selection change in ListObject.
    3981 
    39823990function ListObject_Callback(hObject, eventdata, handles)
    39833991%------------------------------------------------------------------------
     
    39903998hset_object=findobj(allchild(0),'tag','set_object');
    39913999if ~isempty(hset_object)
    3992 %     delete(hset_object)% delete to refesh the content
    39934000    ZBounds=0; % default
    39944001    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     
    40734080end
    40744081
    4075 %------------------------------------------------------------------------
    4076 % --- Executes on button press in ViewObject.
    4077 function ViewObject_Callback(hObject, eventdata, handles)
    4078 %------------------------------------------------------------------------
    4079 check_view=get(handles.ViewObject,'Value');
    4080 
    4081 if check_view %activate set_object   
    4082     IndexObj=get(handles.ListObject,'Value');
    4083     list_object=get(handles.ListObject,'String');
    4084     UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4085     UvData.Object{IndexObj}.Name=list_object{IndexObj};
    4086     if numel(UvData.Object)<IndexObj;% error in UvData
    4087         msgbox_uvmat('ERROR','invalid object list')
    4088         return
    4089     end
    4090     ZBounds=0; % default
    4091     if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
    4092         ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
    4093         ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
    4094     end
    4095 %     set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion
    4096     data=UvData.Object{IndexObj};
    4097     if ~isfield(data,'Type')% default plane
    4098         data.Type='plane';
    4099     end
    4100     if isfield(UvData,'Field')
    4101         Field=UvData.Field;
    4102         if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
    4103             data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
    4104             if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')
    4105                 data.RangeY=UvData.Field.Mesh;
    4106             else
    4107                 data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
    4108             end
    4109             data.DX=UvData.Field.Mesh;
    4110             data.DY=UvData.Field.Mesh;
    4111         end
    4112         if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
    4113             data.Coord=[0 0 0]; %default
    4114         end
    4115         if isfield(Field,'CoordUnit')
    4116             data.CoordUnit=Field.CoordUnit;
    4117         end
    4118     end
    4119     hset_object=set_object(data,[],ZBounds);
    4120     hhset_object=guidata(hset_object);
    4121     if get(handles.edit_object,'Value')% edit mode
    4122         set(hhset_object.PLOT,'Enable','on')
    4123         set(get(hset_object,'children'),'enable','on')
    4124     else
    4125         set(hhset_object.PLOT,'Enable','off')
    4126         set(get(hset_object,'children'),'enable','off')
    4127     end
    4128 else
    4129     hset_object=findobj(allchild(0),'tag','set_object');
    4130     if ~isempty(hset_object)
    4131         delete(hset_object)% delete existing version of set_object
    4132     end
    4133 end
    4134  
    41354082%-------------------------------------------------------------------
    41364083% --- Executes on selection change in edit_object.
     
    41694116end
    41704117
     4118
     4119%------------------------------------------------------------------------
     4120% --- Executes on button press in ViewObject.
     4121function ViewObject_Callback(hObject, eventdata, handles)
     4122%------------------------------------------------------------------------
     4123check_view=get(handles.ViewObject,'Value');
     4124
     4125if check_view %activate set_object   
     4126    IndexObj=get(handles.ListObject,'Value');
     4127    list_object=get(handles.ListObject,'String');
     4128    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     4129    UvData.Object{IndexObj}.Name=list_object{IndexObj};
     4130    if numel(UvData.Object)<IndexObj;% error in UvData
     4131        msgbox_uvmat('ERROR','invalid object list')
     4132        return
     4133    end
     4134    ZBounds=0; % default
     4135    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     4136        ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
     4137        ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     4138    end
     4139%     set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion
     4140    data=UvData.Object{IndexObj};
     4141    if ~isfield(data,'Type')% default plane
     4142        data.Type='plane';
     4143    end
     4144    if isfield(UvData,'Field')
     4145        Field=UvData.Field;
     4146        if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
     4147            data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
     4148            if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')
     4149                data.RangeY=UvData.Field.Mesh;
     4150            else
     4151                data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
     4152            end
     4153            data.DX=UvData.Field.Mesh;
     4154            data.DY=UvData.Field.Mesh;
     4155        end
     4156        if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
     4157            data.Coord=[0 0 0]; %default
     4158        end
     4159        if isfield(Field,'CoordUnit')
     4160            data.CoordUnit=Field.CoordUnit;
     4161        end
     4162    end
     4163    hset_object=set_object(data,[],ZBounds);
     4164    hhset_object=guidata(hset_object);
     4165    if get(handles.edit_object,'Value')% edit mode
     4166        set(hhset_object.PLOT,'Enable','on')
     4167        set(get(hset_object,'children'),'enable','on')
     4168    else
     4169        set(hhset_object.PLOT,'Enable','off')
     4170        set(get(hset_object,'children'),'enable','inactive')% deactivate the GUI except SAVE
     4171        set(hhset_object.SAVE,'Enable','on')
     4172    end
     4173else
     4174    hset_object=findobj(allchild(0),'tag','set_object');
     4175    if ~isempty(hset_object)
     4176        delete(hset_object)% delete existing version of set_object
     4177    end
     4178end
     4179 
     4180
    41714181%------------------------------------------------------------------------
    41724182% --- Executes on button press in ViewField.
     
    41764186
    41774187if check_view
    4178 %     set(handles.ViewObject,'Value',0)% unselect ViewObject_1
    41794188    IndexObj=get(handles.ListObject,'Value');
    41804189    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    41944203    list_object=get(handles.ListObject,'String');
    41954204    UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
    4196 %     hset_object=set_object(UvData.Object{IndexObj(end)},[],ZBounds);
    4197 %     hhset_object=guidata(hset_object);
    4198 %     if get(handles.edit_object,'Value')% edit mode
    4199 %         set(hhset_object.PLOT,'Enable','on')
    4200 %         set(get(hset_object,'children'),'enable','on')
    4201 %     else
    4202 %         set(hhset_object.PLOT,'Enable','off')
    4203 %         set(get(hset_object,'children'),'enable','inactive')
    4204 %     end
    42054205   
    42064206    %% show the second plot (on view_field)
     
    42264226IndexObj=get(handles.ListObject,'Value');
    42274227IndexObj_1=get(handles.ListObject_1,'Value');
    4228 
    42294228if IndexObj>1 && ~isequal(IndexObj,IndexObj_1)
    42304229    delete_object(IndexObj)
     
    45134512%read the file
    45144513data=xml2struct(fileinput);
    4515 data.enable_plot=1;
    4516 [tild,data.Name]=fileparts(FileName);
    4517 hset_object=findobj(allchild(0),'tag','set_object');
    4518 if ~isempty(hset_object)
    4519     delete(hset_object)% delete existing version of set_object
    4520 end
    4521 set_object(data);% call the set_object interface
     4514% data.enable_plot=1;
     4515[tild,data.Name]=fileparts(FileName);% object name set as file name
     4516% hset_object=findobj(allchild(0),'tag','set_object');
     4517% if ~isempty(hset_object)
     4518%     delete(hset_object)% delete existing version of set_object
     4519% end
     4520hset_object=set_object(data);% call the set_object interface
     4521set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
    45224522set(handles.edit_object,'Value',0); %suppress the object edit mode
    45234523set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
    4524 %set(handles.MenuObject,'checked','on')
    45254524set(handles.delete_object,'Visible','on')
    45264525
Note: See TracChangeset for help on using the changeset viewer.