Changeset 575
- Timestamp:
- Feb 27, 2013, 6:39:32 PM (12 years ago)
- 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 them1 %'calc_field': defines fields (velocity, vort, div...) from civx data (old conventions) and calculate them. 2 2 %--------------------------------------------------------------------- 3 3 % [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp) … … 121 121 XMin=min(XMin); 122 122 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)); 125 126 % adjust the mesh to a value 1, 2 , 5 *10^n 126 ord=10^(floor(log10(DataIn. Mesh)));%order of magnitude127 if DataIn. Mesh/ord>=5128 DataIn. Mesh=5*ord;129 elseif DataIn. Mesh/ord>=2130 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; 131 132 else 132 DataIn. Mesh=ord;133 DataIn.CoordMesh=ord; 133 134 end 134 135 end 135 coord_x=XMin:DataIn. Mesh:XMax;% increase the recommanded mesh to visualisation136 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; 137 138 DataOut.coord_x=[XMin XMax]; 138 139 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 them1 %'calc_field_interp': defines fields (velocity, vort, div...) from civ data and calculate them 2 % for projection with linear interpolation 3 3 %--------------------------------------------------------------------- 4 4 % [DataOut,VarAttribute,errormsg]=calc_field_interp(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp) 5 5 % 6 6 % OUTPUT: 7 % DataOut: structure representing the output fields7 % VarVal: array giving the values of the calculated field 8 8 % 9 9 % INPUT: -
trunk/src/calc_field_tps.m
r521 r575 1 1 2 %'calc_field ': defines fields (velocity, vort, div...) from civx data and calculate them2 %'calc_field_tps': defines fields (velocity, vort, div...) from civ data and calculate them with tps interpolation 3 3 %--------------------------------------------------------------------- 4 4 % [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp) -
trunk/src/civ.m
r549 r575 1418 1418 switch oar_modes{S} 1419 1419 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 1420 1424 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1421 1425 ncores=str2double(answer{1}); 1422 if strcmp(Param.Program,'civ_matlab')1423 ncores=1;1424 1426 end 1427 1425 1428 extra_oar=answer{2}; 1426 1429 walltime_onejob=600;%seconds -
trunk/src/civ_matlab.m
r548 r575 1 %'civ_matlab': Matlab version of the PIV programs CivX1 %'civ_matlab': main PIV function, calleed by the GUI civ 2 2 % --- call the sub-functions: 3 3 % civ: PIV function itself -
trunk/src/fileparts_uvmat.m
r437 r575 1 %'fileparts_uvmat': Splits a file nameand recognize file naming convention1 %'fileparts_uvmat': splits a file name in root and indices and recognize file naming convention 2 2 %-------------------------------------------------------------------- 3 3 %[RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(FileInput) -
trunk/src/find_field_cells.m
r569 r575 1 %'find_fi le_indices': test field structure for input in proj_field and plot_field1 %'find_field_cells': test field structure for input in proj_field and plot_field 2 2 % group the variables into 'fields' with common dimensions 3 3 %------------------------------------------------------------------------ … … 27 27 % INPUT: 28 28 % Data: structure representing fields, output of check_field_structure 29 % .ListGlobalAttributes 29 30 % .ListVarName: cell array listing the names (cahr strings) of the variables 30 31 % .VarDimName: cell array of cells containing the set of dimension names for each variable of .ListVarName … … 32 33 % .VarAttribute{ilist}.key=value, where ilist is the variable 33 34 % 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 35 41 % HELP: 36 42 % to get the dimensions of arrays common to the field #icell … … 104 110 ivar_coord_x=find(strcmp('coord_x',Role)); 105 111 % VarDimCell=cell(numel(ivar_coord_x)); 106 check_select=zeros(1,nbvar); 112 check_select=false(1,nbvar); 113 check_coord=false(1,nbvar); 107 114 CellInfo=cell(1,numel(ivar_coord_x)); 108 115 NbDim=zeros(1,numel(ivar_coord_x)); … … 197 204 ListVarName=Data.ListVarName(~check_select);%list of remaining variables 198 205 VarDimName=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 206 check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension 207 check_coord(~check_select)=check_coord_select; 200 208 ListCoordIndex=ivar_remain(check_coord);% indices of remaining variables with a single dimension 201 209 ListCoordName=Data.ListVarName(ListCoordIndex);% corresponding names of remaining variables with a single dimension -
trunk/src/mouse_down.m
r543 r575 114 114 for icell=1:numel(CellVarIndex)%look for all physical fields 115 115 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 data116 if isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data 117 117 eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';']) 118 118 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 mouse120 (Y<(xy(1,2)+Field. Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f119 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 121 121 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 122 122 end -
trunk/src/mouse_motion.m
r542 r575 110 110 for icell=1:numel(CellInfo)%look for all physical fields 111 111 if NbDimArray(icell)>=2 % select 2D field 112 if isfield(Field,' Mesh') && ~isempty(Field.Mesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data112 if isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data 113 113 X=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end)}); 114 114 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 mouse116 (Y<(xy(1,2)+Field. Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f115 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 117 117 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 118 118 hhh=findobj(CurrentAxes,'Tag','vector_marker'); … … 125 125 set(CurrentFig,'CurrentAxes',CurrentAxes) 126 126 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',... 128 128 'LineStyle','-','Tag','vector_marker'); 129 129 else 130 130 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]) 132 132 end 133 133 end -
trunk/src/proj_field.m
r569 r575 28 28 % .Txt: error message, transmitted to the projection 29 29 % .FieldList: cell array of strings representing the fields to calculate 30 % . Mesh: typical distance between data points (used for mouse action or display), transmitted30 % .CoordMesh: typical distance between data points (used for mouse action or display), transmitted 31 31 % .CoordUnit, .TimeUnit, .dt: transmitted 32 32 % standardised description of fields, nc-formated Matlab structure with fields: … … 321 321 ProjData.VarAttribute={}; 322 322 323 Mesh=zeros(1,numel(FieldData.ListVarName));323 CoordMesh=zeros(1,numel(FieldData.ListVarName)); 324 324 if isfield (FieldData,'VarAttribute') 325 325 %ProjData.VarAttribute=FieldData.VarAttribute;%list of variable attribute names … … 329 329 unit{iattr}=FieldData.VarAttribute{iattr}.Unit; 330 330 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; 333 333 end 334 334 end … … 462 462 ProjData.([VarName 'Min'])=min(double(FieldData.(VarName)(indsel,:))); % take the min in the selected region , for each color component 463 463 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 bins464 if isequal(CoordMesh(ivar),0) 465 [ProjData.([VarName 'Histo']),ProjData.(VarName)]=hist(double(FieldData.(VarName)(indsel,:,:)),100); % default histogram with 100 bins 466 466 else 467 eval(['ProjData.' VarName '=(ProjData.' VarName 'Min+Mesh(ivar)/2:Mesh(ivar):ProjData.' VarName 'Max);']); % list of bin values468 eval(['ProjData.' VarName 'Histo=hist(double(FieldData.' VarName '(indsel,:)),ProjData.' VarName ');']); % histogram at predefined bin positions467 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 469 469 end 470 470 ProjData.ListVarName=[ProjData.ListVarName {VarName} {[VarName 'Histo']} {[VarName 'Mean']} {[VarName 'Min']} {[VarName 'Max']}]; … … 891 891 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX) 892 892 DX=abs(ObjectData.DX);%mesh of interpolation points 893 %else894 % DX=FieldData.Mesh;893 else 894 DX=FieldData.CoordMesh; 895 895 end 896 896 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY) 897 897 DY=abs(ObjectData.DY);%mesh of interpolation points 898 %else899 % DY=FieldData.Mesh;898 else 899 DY=FieldData.CoordMesh; 900 900 end 901 901 if ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY)) … … 962 962 ProjData.VarAttribute={}; 963 963 if ~isempty(DX) && ~isempty(DY) 964 ProjData. Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots965 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 965 elseif isfield(FieldData,'CoordMesh') 966 ProjData.CoordMesh=FieldData.CoordMesh; 967 967 end 968 968 error=0;%default … … 1656 1656 ProjData.VarDimName={}; 1657 1657 if ~isequal(DX,0)&& ~isequal(DY,0) 1658 ProjData. Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots1659 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 1659 elseif isfield(FieldData,'CoordMesh') 1660 ProjData.CoordMesh=FieldData.CoordMesh; 1661 1661 end 1662 1662 -
trunk/src/read_field.m
r538 r575 36 36 errormsg=''; 37 37 A=[]; 38 InputField={}; 39 check_colorvar=0; 38 40 if 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 41 47 end 42 48 if isfield(ParamIn,'ColorVar') 43 49 InputField=[ParamIn.FieldName {ParamIn.ColorVar}]; 44 50 check_colorvar=1; 45 else46 InputField= ParamIn.FieldName;47 check_colorvar=0;48 51 end 49 52 end 53 50 54 %% distingush different input file types 51 55 switch FileType -
trunk/src/uvmat.m
r569 r575 2498 2498 end 2499 2499 end 2500 UvData.Field. Mesh=min(Mesh);2500 UvData.Field.CoordMesh=min(Mesh); 2501 2501 UvData.Field.XMax=max(CoordMax(ind,end)); 2502 2502 UvData.Field.XMin=min(CoordMin(ind,end)); … … 2508 2508 end 2509 2509 % adjust the mesh to a value 1, 2 , 5 *10^n 2510 ord=10^(floor(log10(UvData.Field. Mesh)));%order of magnitude2511 if UvData.Field. Mesh/ord>=52512 UvData.Field. Mesh=5*ord;2513 elseif UvData.Field. Mesh/ord>=22514 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; 2515 2515 else 2516 UvData.Field. Mesh=ord;2516 UvData.Field.CoordMesh=ord; 2517 2517 end 2518 2518 % default projection plane … … 2535 2535 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 2536 2536 UvData.Object{1}.NbDim=NbDim;%test for 3D objects 2537 UvData.Object{1}.RangeZ=UvData.Field. Mesh;%main plotting plane2537 UvData.Object{1}.RangeZ=UvData.Field.CoordMesh;%main plotting plane 2538 2538 UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen 2539 2539 UvData.Object{1}.Angle=[0 0 0]; … … 2689 2689 [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},PosColorbar{imap}); 2690 2690 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) 2693 2693 end 2694 2694 end … … 3363 3363 data.CoordType=UvData.CoordType; 3364 3364 end 3365 if isfield(UvData.Field,' Mesh')&~isempty(UvData.Field.Mesh)3365 if isfield(UvData.Field,'CoordMesh')&~isempty(UvData.Field.CoordMesh) 3366 3366 data.RangeX=[UvData.Field.XMin UvData.Field.XMax]; 3367 3367 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; 3370 3370 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image 3371 3371 np=size(UvData.Field.A); … … 4527 4527 if isfield(UvData,'Field') 4528 4528 Field=UvData.Field; 4529 if isfield(UvData.Field,' Mesh')&&~isempty(UvData.Field.Mesh)4529 if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh) 4530 4530 data.RangeX=[UvData.Field.XMin UvData.Field.XMax]; 4531 4531 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; 4533 4533 else 4534 4534 data.RangeY=[UvData.Field.YMin UvData.Field.YMax]; 4535 4535 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; 4538 4538 end 4539 4539 if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
Note: See TracChangeset
for help on using the changeset viewer.