Changeset 575


Ignore:
Timestamp:
Feb 27, 2013, 6:39:32 PM (12 years ago)
Author:
sommeria
Message:

various bugs corrected

Location:
trunk/src
Files:
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r546 r575  
    1 %'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
     1%'calc_field': defines fields (velocity, vort, div...) from civx data (old conventions) and calculate them.
    22%---------------------------------------------------------------------
    33% [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
     
    121121        XMin=min(XMin);
    122122        YMin=min(YMin);
    123         if ~isfield(DataIn,'Mesh')
    124             DataIn.Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps));
     123        if ~isfield(DataIn,'CoordMesh')
     124            DataIn.Coord
     125            Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps));
    125126            % adjust the mesh to a value 1, 2 , 5 *10^n
    126             ord=10^(floor(log10(DataIn.Mesh)));%order of magnitude
    127             if DataIn.Mesh/ord>=5
    128                 DataIn.Mesh=5*ord;
    129             elseif DataIn.Mesh/ord>=2
    130                 DataIn.Mesh=2*ord;
     127            ord=10^(floor(log10(DataIn.CoordMesh)));%order of magnitude
     128            if DataIn.CoordMesh/ord>=5
     129                DataIn.CoordMesh=5*ord;
     130            elseif DataIn.CoordMesh/ord>=2
     131                DataIn.CoordMesh=2*ord;
    131132            else
    132                 DataIn.Mesh=ord;
     133                DataIn.CoordMesh=ord;
    133134            end
    134135        end
    135         coord_x=XMin:DataIn.Mesh:XMax;% increase the recommanded mesh to  visualisation
    136         coord_y=YMin:DataIn.Mesh:YMax;
     136        coord_x=XMin:DataIn.CoordMesh:XMax;% increase the recommanded mesh to  visualisation
     137        coord_y=YMin:DataIn.CoordMesh:YMax;
    137138        DataOut.coord_x=[XMin XMax];
    138139        DataOut.coord_y=[YMin YMax];
  • trunk/src/calc_field_interp.m

    r533 r575  
    1 
    2 %'calc_field': defines fields (velocity, vort, div...) from civ data and calculate them
     1%'calc_field_interp': defines fields (velocity, vort, div...) from civ data and calculate them
     2% for projection with linear interpolation
    33%---------------------------------------------------------------------
    44% [DataOut,VarAttribute,errormsg]=calc_field_interp(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp)
    55%
    66% OUTPUT:
    7 % DataOut: structure representing the output fields
     7% VarVal: array giving the values of the calculated field
    88%
    99% INPUT:
  • trunk/src/calc_field_tps.m

    r521 r575  
    11
    2 %'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
     2%'calc_field_tps': defines fields (velocity, vort, div...) from civ data and calculate them with tps interpolation
    33%---------------------------------------------------------------------
    44% [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp)
  • trunk/src/civ.m

    r549 r575  
    14181418                switch oar_modes{S}
    14191419                    case 'oar-parexec' %oar-dispatch.pl
     1420                        if strcmp(Param.Program,'civ_matlab')
     1421                            ncores=1;
     1422                            msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing');
     1423                        else
    14201424                        answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
    14211425                        ncores=str2double(answer{1});
    1422                         if strcmp(Param.Program,'civ_matlab')
    1423                             ncores=1;
    14241426                        end
     1427
    14251428                        extra_oar=answer{2};
    14261429                        walltime_onejob=600;%seconds
  • trunk/src/civ_matlab.m

    r548 r575  
    1 %'civ_matlab': Matlab version of the PIV programs CivX
     1%'civ_matlab': main PIV function, calleed by the GUI civ
    22% --- call the sub-functions:
    33%   civ: PIV function itself
  • trunk/src/fileparts_uvmat.m

    r437 r575  
    1 %'fileparts_uvmat': Splits a file name and recognize file naming convention
     1%'fileparts_uvmat': splits a file name in root and indices and recognize file naming convention
    22%--------------------------------------------------------------------
    33%[RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(FileInput)
  • trunk/src/find_field_cells.m

    r569 r575  
    1 %'find_file_indices': test field structure for input in proj_field and plot_field
     1%'find_field_cells': test field structure for input in proj_field and plot_field
    22%    group the variables  into 'fields' with common dimensions
    33%------------------------------------------------------------------------
     
    2727% INPUT:
    2828% Data: structure representing fields, output of check_field_structure
     29%            .ListGlobalAttributes
    2930%            .ListVarName: cell array listing the names (cahr strings) of the variables
    3031%            .VarDimName: cell array of cells containing the set of dimension names for each variable of .ListVarName
     
    3233%                     .VarAttribute{ilist}.key=value, where ilist is the variable
    3334%                     index, key is the name of the attribute, value its value (char string or number)
    34 %
     35%            .Attr1, .Attr2....
     36%        case of actual data:
     37%            .Var1, .Var2...
     38%        case of data structure, without the  data themselves
     39%            .LisDimName: list of dimension names
     40%            .DimValue: list of corresponding dimension values
    3541% HELP:
    3642% to get the dimensions of arrays common to the field #icell
     
    104110ivar_coord_x=find(strcmp('coord_x',Role));
    105111% VarDimCell=cell(numel(ivar_coord_x));
    106 check_select=zeros(1,nbvar);
     112check_select=false(1,nbvar);
     113check_coord=false(1,nbvar);
    107114CellInfo=cell(1,numel(ivar_coord_x));
    108115NbDim=zeros(1,numel(ivar_coord_x));
     
    197204ListVarName=Data.ListVarName(~check_select);%list of remaining variables
    198205VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables
    199 check_coord= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension
     206check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension
     207check_coord(~check_select)=check_coord_select;
    200208ListCoordIndex=ivar_remain(check_coord);% indices of remaining variables with a single dimension
    201209ListCoordName=Data.ListVarName(ListCoordIndex);% corresponding names of remaining variables with a single dimension
  • trunk/src/mouse_down.m

    r543 r575  
    114114                            for icell=1:numel(CellVarIndex)%look for all physical fields
    115115                                if NbDim(icell)==2 % select 2D field
    116                                     if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
     116                                    if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
    117117                                        eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';'])
    118118                                        eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';'])
    119                                         flag_vec=(X<(xy(1,1)+Field.Mesh/4) & X>(xy(1,1)-Field.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
    120                                             (Y<(xy(1,2)+Field.Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f
     119                                        flag_vec=(X<(xy(1,1)+Field.CoordMesh/4) & X>(xy(1,1)-Field.CoordMesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
     120                                            (Y<(xy(1,2)+Field.CoordMesh/4) & Y>(xy(1,2)-Field.CoordMesh/4));%f
    121121                                        ivec=find(flag_vec,1);% search the (first) selected vector index ivec
    122122                                    end
  • trunk/src/mouse_motion.m

    r542 r575  
    110110                    for icell=1:numel(CellInfo)%look for all physical fields
    111111                        if NbDimArray(icell)>=2 % select 2D field
    112                             if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data
     112                            if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data
    113113                                X=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end)});
    114114                                Y=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
    115                                 flag_vec=(X<(xy(1,1)+Field.Mesh/3) & X>(xy(1,1)-Field.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
    116                                     (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f
     115                                flag_vec=(X<(xy(1,1)+Field.CoordMesh/3) & X>(xy(1,1)-Field.CoordMesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
     116                                    (Y<(xy(1,2)+Field.CoordMesh/3) & Y>(xy(1,2)-Field.CoordMesh/3));%f
    117117                                ivec=find(flag_vec,1);% search the (first) selected vector index ivec
    118118                                hhh=findobj(CurrentAxes,'Tag','vector_marker');
     
    125125                                            set(CurrentFig,'CurrentAxes',CurrentAxes)
    126126                                            rectangle('Curvature',[1 1],...
    127                                                 'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',...
     127                                                'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',...
    128128                                                'LineStyle','-','Tag','vector_marker');
    129129                                        else
    130130                                            set(hhh,'Visible','on')
    131                                             set(hhh,'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh])
     131                                            set(hhh,'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh])
    132132                                        end
    133133                                    end
  • trunk/src/proj_field.m

    r569 r575  
    2828%    .Txt: error message, transmitted to the projection
    2929%    .FieldList: cell array of strings representing the fields to calculate
    30 %    .Mesh: typical distance between data points (used for mouse action or display), transmitted
     30%    .CoordMesh: typical distance between data points (used for mouse action or display), transmitted
    3131%    .CoordUnit, .TimeUnit, .dt: transmitted
    3232% standardised description of fields, nc-formated Matlab structure with fields:
     
    321321ProjData.VarAttribute={};
    322322
    323 Mesh=zeros(1,numel(FieldData.ListVarName));
     323CoordMesh=zeros(1,numel(FieldData.ListVarName));
    324324if isfield (FieldData,'VarAttribute')
    325325    %ProjData.VarAttribute=FieldData.VarAttribute;%list of variable attribute names
     
    329329            unit{iattr}=FieldData.VarAttribute{iattr}.Unit;
    330330        end
    331         if isfield(FieldData.VarAttribute{iattr},'Mesh')
    332             Mesh(iattr)=FieldData.VarAttribute{iattr}.Mesh;
     331        if isfield(FieldData.VarAttribute{iattr},'CoordMesh')
     332            CoordMesh(iattr)=FieldData.VarAttribute{iattr}.CoordMesh;
    333333        end
    334334    end
     
    462462        ProjData.([VarName 'Min'])=min(double(FieldData.(VarName)(indsel,:))); % take the min in the selected region , for each color component
    463463        ProjData.([VarName 'Max'])=max(double(FieldData.(VarName)(indsel,:))); % take the max in the selected region , for each color component
    464         if isequal(Mesh(ivar),0)
    465             eval(['[ProjData.' VarName 'Histo,ProjData.' VarName ']=hist(double(FieldData.' VarName '(indsel,:,:)),100);']); % default histogram with 100 bins
     464        if isequal(CoordMesh(ivar),0)
     465            [ProjData.([VarName 'Histo']),ProjData.(VarName)]=hist(double(FieldData.(VarName)(indsel,:,:)),100); % default histogram with 100 bins
    466466        else
    467             eval(['ProjData.' VarName '=(ProjData.' VarName 'Min+Mesh(ivar)/2:Mesh(ivar):ProjData.' VarName 'Max);']); % list of bin values
    468             eval(['ProjData.' VarName 'Histo=hist(double(FieldData.' VarName '(indsel,:)),ProjData.' VarName ');']); % histogram at predefined bin positions
     467            ProjData.(VarName)=ProjData.([VarName 'Min'])+CoordMesh(ivar)/2:CoordMesh(ivar):ProjData.([VarName 'Max']); % list of bin values
     468            ProjData.([VarName 'Histo'])=hist(double(FieldData.(VarName)(indsel,:)),ProjData.(VarName)); % histogram at predefined bin positions
    469469        end
    470470        ProjData.ListVarName=[ProjData.ListVarName {VarName} {[VarName 'Histo']} {[VarName 'Mean']} {[VarName 'Min']} {[VarName 'Max']}];
     
    891891if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
    892892     DX=abs(ObjectData.DX);%mesh of interpolation points
    893 % else
    894 %     DX=FieldData.Mesh;
     893else
     894     DX=FieldData.CoordMesh;
    895895end
    896896if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
    897897     DY=abs(ObjectData.DY);%mesh of interpolation points
    898 % else
    899 %     DY=FieldData.Mesh;
     898else
     899     DY=FieldData.CoordMesh;
    900900end
    901901if  ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY))
     
    962962ProjData.VarAttribute={};
    963963if ~isempty(DX) && ~isempty(DY)
    964     ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
    965 elseif isfield(FieldData,'Mesh')
    966     ProjData.Mesh=FieldData.Mesh;
     964    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
     965elseif isfield(FieldData,'CoordMesh')
     966    ProjData.CoordMesh=FieldData.CoordMesh;
    967967end
    968968error=0;%default
     
    16561656ProjData.VarDimName={};
    16571657if ~isequal(DX,0)&& ~isequal(DY,0)
    1658     ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
    1659 elseif isfield(FieldData,'Mesh')
    1660     ProjData.Mesh=FieldData.Mesh;
     1658    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
     1659elseif isfield(FieldData,'CoordMesh')
     1660    ProjData.CoordMesh=FieldData.CoordMesh;
    16611661end
    16621662
  • trunk/src/read_field.m

    r538 r575  
    3636errormsg='';
    3737A=[];
     38InputField={};
     39check_colorvar=0;
    3840if isstruct(ParamIn)
    39     if isfield(ParamIn,'FieldName')&& ischar(ParamIn.FieldName)
    40         ParamIn.FieldName={ParamIn.FieldName};
     41    if isfield(ParamIn,'FieldName')
     42        if ischar(ParamIn.FieldName)
     43            ParamIn.FieldName={ParamIn.FieldName};
     44        else
     45            InputField= ParamIn.FieldName;
     46        end
    4147    end
    4248    if isfield(ParamIn,'ColorVar')
    4349        InputField=[ParamIn.FieldName {ParamIn.ColorVar}];
    4450        check_colorvar=1;
    45     else
    46         InputField= ParamIn.FieldName;
    47         check_colorvar=0;
    4851    end
    4952end
     53
    5054%% distingush different input file types
    5155switch FileType
  • trunk/src/uvmat.m

    r569 r575  
    24982498        end
    24992499    end
    2500     UvData.Field.Mesh=min(Mesh);
     2500    UvData.Field.CoordMesh=min(Mesh);
    25012501    UvData.Field.XMax=max(CoordMax(ind,end));
    25022502    UvData.Field.XMin=min(CoordMin(ind,end));
     
    25082508    end
    25092509    % adjust the mesh to a value 1, 2 , 5 *10^n
    2510     ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude
    2511     if UvData.Field.Mesh/ord>=5
    2512         UvData.Field.Mesh=5*ord;
    2513     elseif UvData.Field.Mesh/ord>=2
    2514         UvData.Field.Mesh=2*ord;
     2510    ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude
     2511    if UvData.Field.CoordMesh/ord>=5
     2512        UvData.Field.CoordMesh=5*ord;
     2513    elseif UvData.Field.CoordMesh/ord>=2
     2514        UvData.Field.CoordMesh=2*ord;
    25152515    else
    2516         UvData.Field.Mesh=ord;
     2516        UvData.Field.CoordMesh=ord;
    25172517    end
    25182518    % default projection plane
     
    25352535            delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2
    25362536            UvData.Object{1}.NbDim=NbDim;%test for 3D objects
    2537             UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane
     2537            UvData.Object{1}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
    25382538            UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
    25392539            UvData.Object{1}.Angle=[0 0 0];
     
    26892689                [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},PosColorbar{imap});
    26902690                write_plot_param(plot_handles{imap},PlotParamOut) %update the auto plot parameters
    2691                 if isfield(Field,'Mesh')&&~isempty(Field.Mesh)
    2692                     ObjectData.Mesh=Field.Mesh; % gives an estimated mesh size (useful for mouse action on the plot)
     2691                if isfield(Field,'CoordMesh')&&~isempty(Field.CoordMesh)
     2692                    ObjectData.CoordMesh=Field.CoordMesh; % gives an estimated mesh size (useful for mouse action on the plot)
    26932693                end
    26942694            end
     
    33633363        data.CoordType=UvData.CoordType;
    33643364    end
    3365     if isfield(UvData.Field,'Mesh')&~isempty(UvData.Field.Mesh)
     3365    if isfield(UvData.Field,'CoordMesh')&~isempty(UvData.Field.CoordMesh)
    33663366        data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
    33673367        data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
    3368         data.DX=UvData.Field.Mesh;
    3369         data.DY=UvData.Field.Mesh;
     3368        data.DX=UvData.Field.CoordMesh;
     3369        data.DY=UvData.Field.CoordMesh;
    33703370    elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
    33713371        np=size(UvData.Field.A);
     
    45274527if isfield(UvData,'Field')
    45284528    Field=UvData.Field;
    4529     if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
     4529    if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
    45304530        data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
    45314531        if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')||strcmp(data.Type,'points')
    4532             data.RangeY=UvData.Field.Mesh;
     4532            data.RangeY=UvData.Field.CoordMesh;
    45334533        else
    45344534            data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
    45354535        end
    4536         data.DX=UvData.Field.Mesh;
    4537         data.DY=UvData.Field.Mesh;
     4536        data.DX=UvData.Field.CoordMesh;
     4537        data.DY=UvData.Field.CoordMesh;
    45384538    end
    45394539    if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
Note: See TracChangeset for help on using the changeset viewer.