Changeset 1121


Ignore:
Timestamp:
Dec 20, 2022, 2:00:18 PM (16 months ago)
Author:
sommeria
Message:

merge_proj_volume added

Location:
trunk/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r1116 r1121  
    10721072end
    10731073
    1074 %% initiate Matlab  structure for physical fieldopen
     1074%% initiate Matlab  structure for physical field
    10751075[ProjData,errormsg]=proj_heading(FieldData,ObjectData);
    10761076if ~isempty(errormsg)
     
    13451345            % two cases of projection for scattered coordinates
    13461346            switch ProjMode{icell}
    1347                 case 'projection'
     1347                case 'projection'% ptoject scattered data without interpolation
    13481348                    nbvar=0;
    13491349                    %nbvar=numel(ProjData.ListVarName);
     
    13661366                        end
    13671367                    end
    1368                 case 'interp_lin'%interpolate data on a regular grid
     1368                case 'interp_lin'%interpolate scattered data on a regular grid
    13691369                    if isfield(CellInfo{icell},'VarIndex_errorflag')
    13701370                        VarName_FF=FieldData.ListVarName{CellInfo{icell}.VarIndex_errorflag};
     
    13821382                    end
    13831383                    % interpolate and calculate field on the grid
    1384                     
     1384           
    13851385                    [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,CellInfo{icell}.FieldName,XI,YI);
    13861386                   
     
    15001500            end
    15011501           
    1502             if strcmp(ProjMode{icell},'projection')% && (~testangle || test90y || test90x)
     1502            if strcmp(ProjMode{icell},'projection')% project gridded data without interpolation
    15031503                if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax% no range restriction
    15041504                    ListVarName=[ListVarName FieldData.ListVarName(VarIndex)];
     
    16061606                    end
    16071607                end
    1608             else       % case with interpolation on a grid
     1608            else       % project gridded data with interpolation on a grid
    16091609                if NbDim==2 %2D case
    16101610                    if isequal(ProjMode{icell},'interp_tps')
     
    17781778
    17791779%-----------------------------------------------------------------
    1780 ProjData=FieldData;%default output
     1780ProjData=[];%default output
    17811781
    17821782%% axis origin
     
    18091809DY=0; %default
    18101810DZ=0;
    1811 if isfield(ObjectData,'DX')&~isempty(ObjectData.DX)
     1811ProjMode=ObjectData.ProjMode;
     1812if isfield(ObjectData,'DX')&&~isempty(ObjectData.DX)
    18121813     DX=abs(ObjectData.DX);%mesh of interpolation points
    18131814end
    1814 if isfield(ObjectData,'DY')&~isempty(ObjectData.DY)
     1815if isfield(ObjectData,'DY')&&~isempty(ObjectData.DY)
    18151816     DY=abs(ObjectData.DY);%mesh of interpolation points
    18161817end
    1817 if isfield(ObjectData,'DZ')&~isempty(ObjectData.DZ)
     1818if isfield(ObjectData,'DZ')&&~isempty(ObjectData.DZ)
    18181819     DZ=abs(ObjectData.DZ);%mesh of interpolation points
    18191820end
     
    18721873%-----------------------------------------------------------------
    18731874idimvar=0;
     1875
     1876[CellInfo,NbDimArray,errormsg]=find_field_cells(FieldData);
    18741877% LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
    18751878% CellVarIndex=cells of variable index arrays
     
    18781881nbcoord=0;%number of added coordinate variables brought by projection
    18791882nbvar=0;
    1880 for icell=1:length(CellVarIndex)
    1881     NbDim=NbDimVec(icell);
     1883for icell=1:length(CellInfo)
     1884    NbDim=NbDimArray(icell);
    18821885    if NbDim<3
    18831886        continue
    18841887    end
    1885     VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
    1886     VarType=VarTypeCell{icell};
     1888    VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list FieldData.ListVarName
     1889    VarType=CellInfo{icell}.VarType;
    18871890    ivar_X=VarType.coord_x;
    1888     ivar_Y=VarType.coord_y;
     1891    ivar_Y=VarType.coorCeld_y;
    18891892    ivar_Z=VarType.coord_z;
    18901893    ivar_U=VarType.vector_x;
     
    18971900    ivar_F=VarType.warnflag;
    18981901    ivar_FF=VarType.errorflag;
    1899     check_unstructured_coord=~isempty(ivar_X) && ~isempty(ivar_Y);
     1902    %check_unstructured_coord=~isempty(ivar_X) && ~isempty(ivar_Y);
    19001903    DimCell=FieldData.VarDimName{VarIndex(1)};
    19011904    if ischar(DimCell)
     
    19041907
    19051908%% case of input fields with unstructured coordinates
    1906     if check_unstructured_coord
     1909    if strcmp(CellInfo{icell}.CoordType,'scattered')
    19071910        XName=FieldData.ListVarName{ivar_X};
    19081911        YName=FieldData.ListVarName{ivar_Y};
    1909         eval(['coord_x=FieldData.' XName ';'])
    1910         eval(['coord_y=FieldData.' YName ';'])
     1912        coord_x=FieldData.(XName);
     1913        coord_y=FieldData.(YName);
    19111914        if length(ivar_Z)==1
    19121915            ZName=FieldData.ListVarName{ivar_Z};
    1913             eval(['coord_z=FieldData.' ZName ';'])
    1914         end
    1915 
     1916            coord_z=FieldData.(ZName);
     1917        end
    19161918        % translate  initial coordinates
    19171919        coord_x=coord_x-ObjectData.Coord(1,1);
     
    19881990                VarName=FieldData.ListVarName{ivar};
    19891991                if ivar==ivar_X %x coordinate
    1990                     eval(['ProjData.' VarName '=coord_X;'])
     1992                    ProjData.(VarName)=coord_X;
    19911993                elseif ivar==ivar_Y % y coordinate
    1992                     eval(['ProjData.' VarName '=coord_Y;'])
     1994                    ProjData.(VarName)=coord_Y;
    19931995                elseif isempty(ivar_Z) || ivar~=ivar_Z % other variables (except Z coordinate wyhich is not reproduced)
    1994                     eval(['ProjData.' VarName '=FieldData.' VarName ';'])
     1996                    ProjData.(VarName)=FieldData.(VarName);
    19951997                end
    19961998                if isempty(ivar_Z) || ivar~=ivar_Z
     
    22852287                    test_interp_tps=0;
    22862288                end
    2287                 eval(['ProjData.' AYName '=[coord_y_proj(1) coord_y_proj(end)];']) %record the new (projected ) y coordinates
    2288                 eval(['ProjData.' AXName '=[coord_x_proj(1) coord_x_proj(end)];']) %record the new (projected ) x coordinates
     2289                ProjData.(AYName)=[coord_y_proj(1) coord_y_proj(end)]; %record the new (projected ) y coordinates
     2290                ProjData.(AXName)=[coord_x_proj(1) coord_x_proj(end)]; %record the new (projected ) x coordinates
    22892291                for ivar=VarIndex
    22902292                    VarName=FieldData.ListVarName{ivar};
     
    23542356    if testangle
    23552357        if isempty(ivar_V)
    2356             msgbox_uvmat('ERROR','v velocity component missing in proj_field.m')
     2358            errormsg='v velocity component missing in proj_field.m';
    23572359            return
    23582360        end
     
    23722374    end
    23732375end
     2376if isempty(ProjData.ListVarName)
     2377    errormsg='input field is not 3D, no volume projection';
     2378    ProjData=[];
     2379end
    23742380
    23752381%------------------------------------------------------------------------
  • trunk/src/set_object.m

    r1107 r1121  
    363363        set(handles.num_RangeY_1,'Visible','on')
    364364        set(handles.num_RangeY_2,'Visible','on')
    365         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
    366         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
     365%         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
     366%         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
    367367        set(handles.num_Angle_1,'Visible','on')
    368368        set(handles.num_Angle_2,'Visible','on')
  • trunk/src/uvmat.m

    r1120 r1121  
    13131313%  raw 6 of the GUI
    13141314uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_1','BackgroundColor',[1 1 1],...
    1315     'String',num2str(SliceAngle(1,1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_1'':first slice angle of inclination around the x axis');%edit box
     1315    'String',num2str(SliceAngle(1,1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_1'':first slice angle of inclination (in degrees) around the x axis');%edit box
    13161316uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_2','BackgroundColor',[1 1 1],...
    1317     'String',num2str(SliceAngle(end,1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_2'':last slice angle of inclination around the x axis');%edit box
     1317    'String',num2str(SliceAngle(end,1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_1_2'':last slice angle of inclination (in degrees) around the x axis');%edit box
    13181318uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_1','BackgroundColor',[1 1 1],...
    1319     'String',num2str(SliceAngle(1,2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_1'':first slice angle of inclination around the y axis');%edit box
     1319    'String',num2str(SliceAngle(1,2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_1'':first slice angle of inclination (in degrees) around the y axis');%edit box
    13201320uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceAngle_2_2','BackgroundColor',[1 1 1],...
    1321     'String',num2str(SliceAngle(end,2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_2'':last slice angle of inclination around the y axis');%edit box
     1321    'String',num2str(SliceAngle(end,2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceAngle_2_2'':last slice angle of inclination (in degrees) around the y axis');%edit box
    13221322
    13231323%  raw 7 of the GUI: pushbuttons
Note: See TracChangeset for help on using the changeset viewer.