Changeset 905
- Timestamp:
- May 30, 2015, 8:44:20 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field_tps.m
r867 r905 113 113 nbvec_sub=NbCentre(isub); 114 114 check_range=(Coord_interp >=ones(nb_sites,1)*SubRange(:,1,isub)' & Coord_interp<=ones(nb_sites,1)*SubRange(:,2,isub)'); 115 ind_sel=find(sum(check_range,2)==nb_coord); 115 ind_sel=find(sum(check_range,2)==nb_coord);% select points whose all coordinates are in the prescribed range 116 116 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 117 117 if check_grid -
trunk/src/mouse_up.m
r871 r905 141 141 if ~isempty(ObjectData) 142 142 % plot the field projected on the object 143 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData144 if ~isempty(ProjData)143 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 144 if isempty(errormsg) && ~isempty(ProjData) 145 145 if strcmp(FigTag,'uvmat')% uvmat plot selected, projection plot seen in view_field 146 146 hview_field=findobj(allchild(0),'tag','view_field'); … … 170 170 end 171 171 end 172 if ~isempty(errormsg) 173 msgbox_uvmat('ERROR',errormsg) 174 return 175 end 172 176 set(hhuvmat.CheckViewField,'Value',1);% 173 177 set(hhuvmat.CheckEditObject,'Value',1);% -
trunk/src/proj_field.m
r896 r905 522 522 function [ProjData,errormsg] = proj_line(FieldData, ObjectData) 523 523 %----------------------------------------------------------------- 524 525 %% prepare heading for the projected field 524 526 [ProjData,errormsg]=proj_heading(FieldData,ObjectData);%transfer global attributes 525 527 if ~isempty(errormsg) … … 544 546 ListIndex={}; 545 547 548 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions 549 [CellInfo,NbDim,errormsg]=find_field_cells(FieldData); 550 if ~isempty(errormsg) 551 errormsg=['error in proj_field/proj_line:' errormsg]; 552 return 553 end 554 CellInfo=CellInfo(NbDim==2); %keep only the 2D cells 555 %%%%%% TODO: treat 1D fields: project as identity so that P o P=P for projection operation 556 cell_select=true(size(CellInfo)); 557 558 for icell=1:length(CellInfo) 559 if isfield(CellInfo{icell},'ProjModeRequest') 560 if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode) 561 cell_select(icell)=0; 562 end 563 if strcmp(ProjMode,'interp_tps')&& ~strcmp(CellInfo{icell}.CoordType,'tps') 564 cell_select(icell)=0; 565 end 566 end 567 end 568 if isempty(find(cell_select)) 569 errormsg=[' invalid projection mode ''' ProjMode ''': use ''interp_tps'' to interpolate spatial derivatives']; 570 return 571 end 572 CellInfo=CellInfo(cell_select); 546 573 547 574 %% projection line: object types selected from proj_field='line','polyline','polygon','rectangle','ellipse': … … 633 660 end 634 661 end 635 636 637 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions638 [CellInfo,NbDim,errormsg]=find_field_cells(FieldData);639 if ~isempty(errormsg)640 errormsg=['error in proj_field/proj_line:' errormsg];641 return642 end643 CellInfo=CellInfo(NbDim==2); %keep only the 2D cells644 %%%%%% TODO: treat 1D fields: project as identity so that P o P=P for projection operation645 662 646 663 %% loop on variable cells with the same space dimension 2 … … 1287 1304 Dist=Distx.*Distx+Disty.*Disty; 1288 1305 for ivar=1:numel(VarVal) 1289 VarVal{ivar}(Dist> 4*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions too farfrom initial data1306 VarVal{ivar}(Dist>16*ProjData.CoordMesh)=NaN;% % put to NaN interpolated positions further than 4 meshes from initial data 1290 1307 end 1291 1308 … … 1325 1342 1326 1343 % set to NaN interpolation points which are too far from any initial data (more than 2 CoordMesh) 1327 if exist('scatteredInterpolant','file')%recent Matlab versions 1328 F=scatteredInterpolant(coord_X, coord_Y,coord_X,'nearest'); 1329 G=scatteredInterpolant(coord_X, coord_Y,coord_Y,'nearest'); 1330 else 1331 F=TriScatteredInterp([coord_X coord_Y],coord_X,'nearest'); 1332 G=TriScatteredInterp([coord_X coord_Y],coord_Y,'nearest'); 1333 end 1334 Distx=F(XI,YI)-XI;% diff of x coordinates with the nearest measurement point 1335 Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point 1336 Dist=Distx.*Distx+Disty.*Disty; 1337 for ivar=1:numel(VarVal) 1338 VarVal{ivar}(Dist>4*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions too far from initial data 1339 end 1340 1341 1344 Coord=permute(Coord,[1 3 2]); 1345 Coord=reshape(Coord,size(Coord,1)*size(Coord,2),2); 1346 if exist('scatteredInterpolant','file')%recent Matlab versions 1347 F=scatteredInterpolant(Coord,Coord(:,1),'nearest'); 1348 G=scatteredInterpolant(Coord,Coord(:,2),'nearest'); 1349 else 1350 F=TriScatteredInterp(Coord,Coord(:,1),'nearest'); 1351 G=TriScatteredInterp(Coord,Coord(:,2),'nearest'); 1352 end 1353 Distx=F(XI,YI)-XI;% diff of x coordinates with the nearest measurement point 1354 Disty=G(XI,YI)-YI;% diff of y coordinates with the nearest measurement point 1355 Dist=Distx.*Distx+Disty.*Disty; 1342 1356 ListVarName=(fieldnames(DataOut))'; 1343 1357 VarDimName=cell(size(ListVarName)); … … 1345 1359 VarName=ListVarName{ilist}; 1346 1360 ProjData.(VarName)=DataOut.(VarName); 1361 ProjData.(VarName)(Dist>16*ProjData.CoordMesh)=NaN;% put to NaN interpolated positions further than 4 meshes from initial data 1347 1362 VarDimName{ilist}={'coord_y','coord_x'}; 1348 1363 end -
trunk/src/series.m
r904 r905 1607 1607 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exist 1608 1608 check_create=1; %need to create the result directory by default 1609 CheckOverwrite=1; 1610 if isfield(Param,'CheckOverwrite') 1611 CheckOverwrite=Param.CheckOverwrite; 1612 end 1609 1613 while detect 1610 if Param.CheckOverwrite1614 if CheckOverwrite 1611 1615 comment=', possibly overwrite previous data'; 1612 1616 else … … 1719 1723 end 1720 1724 nbfield_j=numel(ref_j); % number of j indices 1725 BlockLength=numel(ref_i);%default 1721 1726 if isempty(Param.IndexRange.NbSlice) 1722 1727 NbProcess=NbCore;% choose one process per core by default if NbSlice is not imposed … … 1805 1810 %% processing on a different session of the same computer (background) or cluster, create executable files 1806 1811 batch_file_list=cell(NbProcess,1);% initiate the list of executable files 1807 Dir Bat=fullfile(OutputDir,'0_EXE');1812 DirExe=fullfile(OutputDir,'0_EXE');%directory name for executable files 1808 1813 switch computer 1809 1814 case {'PCWIN','PCWIN64'} %Windows system … … 1813 1818 end 1814 1819 %create subdirectory for executable files 1815 if ~exist(Dir Bat,'dir')1816 [tild,msg1]=mkdir(Dir Bat);1820 if ~exist(DirExe,'dir') 1821 [tild,msg1]=mkdir(DirExe); 1817 1822 if ~strcmp(msg1,'') 1818 errormsg=['cannot create ' Dir Bat': ' msg1];%error message for directory creation1823 errormsg=['cannot create ' DirExe ': ' msg1];%error message for directory creation 1819 1824 return 1820 1825 end … … 1852 1857 1853 1858 %create the executable file 1854 filebat=fullfile_uvmat(Dir Bat,'',Param.InputTable{1,3},ExeExt,OutputNomType,...1859 filebat=fullfile_uvmat(DirExe,'',Param.InputTable{1,3},ExeExt,OutputNomType,... 1855 1860 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j); 1856 1861 batch_file_list{iprocess}=filebat; … … 1919 1924 case 'cluster_oar' % option 'oar-parexec' used 1920 1925 %create subdirectory for oar command and log files 1921 DirOAR=fullfile(OutputDir,'0_LOG'); 1922 if exist(DirOAR,'dir')% delete the content of the dir 0_LOG to allow new input 1923 curdir=pwd; 1924 cd(DirOAR) 1925 delete('*') 1926 cd(curdir) 1927 else 1928 [tild,msg1]=mkdir(DirOAR); 1929 if ~strcmp(msg1,'') 1930 errormsg=['cannot create ' DirOAR ': ' msg1];%error message for directory creation 1931 return 1932 end 1933 end 1934 filename_joblist=fullfile(DirOAR,'0_job_list.txt');%create name of the global executable file 1926 %DirOARLog=fullfile(OutputDir,'0_LOG'); 1927 %DirOARExe=fullfile(OutputDir,'0_EXE'); 1928 % if exist(DirOAR,'dir')% delete the content of the dir 0_LOG to allow new input 1929 % curdir=pwd; 1930 % cd(DirOAR) 1931 % delete('*') 1932 % cd(curdir) 1933 % else 1934 % [tild,msg1]=mkdir(DirOAR); 1935 % if ~strcmp(msg1,'') 1936 % errormsg=['cannot create ' DirOAR ': ' msg1];%error message for directory creation 1937 % return 1938 % end 1939 % end 1940 filename_joblist=fullfile(DirExe,'0_job_list.txt');%create name of the global executable file 1941 filename_log=fullfile(DirLog,'0_job_list.stdout');%file for output messages of the master oar process 1942 filename_errors=fullfile(DirLog,'0_job_list.stderr');%file for error messages of the master oar process 1943 1935 1944 fid=fopen(filename_joblist,'w'); 1936 1945 for p=1:length(batch_file_list) … … 1958 1967 '-l /core=' num2str(NbCore) ','... 1959 1968 'walltime=' datestr(WallTimeOneJob/24,13) ' '... 1960 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr')' '...1961 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout')' '...1969 '-E ' filename_errors ' '... 1970 '-O ' filename_log ' '... 1962 1971 extra_oar ' '... 1963 1972 '"oar-parexec -s -f ' filename_joblist ' '... 1964 1973 '-l ' filename_joblist '.log"\n']; 1965 1974 1966 filename_oarcommand=fullfile(Dir OAR,'0_oar_command');1975 filename_oarcommand=fullfile(DirExe,'0_oar_command'); 1967 1976 fid=fopen(filename_oarcommand,'w'); 1968 1977 fprintf(fid,oar_command); … … 3597 3606 % --- Executes on button press in CheckOverwrite. 3598 3607 function CheckOverwrite_Callback(hObject, eventdata, handles) 3599 % hObject handle to CheckOverwrite (see GCBO) 3600 % eventdata reserved - to be defined in a future version of MATLAB 3601 % handles structure with handles and user data (see GUIDATA) 3602 3603 % Hint: get(hObject,'Value') returns toggle state of CheckOverwrite 3608 3604 3609 3605 3610 -
trunk/src/series/civ_series.m
r904 r905 333 333 if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series (checkrun=1) 334 334 update_waitbar(WaitbarHandle,ifield/NbField) 335 if ~strcmp(get(RUNHandle,'BusyAction'),'queue')335 if checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue') 336 336 disp('program stopped by user') 337 337 break -
trunk/src/series/merge_proj.m
r883 r905 73 73 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 74 74 %check the input files 75 ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) 75 76 first_j=[]; 76 77 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end … … 90 91 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 91 92 ParamOut=[]; %default output 93 RUNHandle=[]; 94 WaitbarHandle=[]; 92 95 %% read input parameters from an xml file if input is a file name (batch mode) 93 96 checkrun=1; … … 95 98 Param=xml2struct(Param);% read Param as input file (batch case) 96 99 checkrun=0; 97 end 98 hseries=findobj(allchild(0),'Tag','series'); 99 RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series 100 WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series 100 else 101 hseries=findobj(allchild(0),'Tag','series'); 102 RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series 103 WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series 104 end 101 105 102 106 %% define the directory for result file (with path=RootPath{1}) … … 407 411 end 408 412 end 409 disp(['total ellapsed time ' num2str(toc(tstart))]) 413 ellapsed_time=toc(tstart); 414 disp(['total ellapsed time ' num2str(ellapsed_time/60,2) ' minutes']) 415 disp([ num2str(ellapsed_time/(60*NbField),3) ' minutes per iteration']) 410 416 411 417 %'merge_field': concatene fields -
trunk/src/uvmat.m
r894 r905 3735 3735 [ObjectData,errormsg]=proj_field(UvData.Field,UvData.ProjObject{iobj});% project field on the object 3736 3736 if ~isempty(errormsg) 3737 errormsg=['projection on ' UvData.ProjObject{iobj}.Type ': ' errormsg ]; 3737 3738 return 3738 3739 end … … 5378 5379 5379 5380 %% update the projection plot on uvmat 5380 ProjData= proj_field(UvData.Field,ObjectData);%project the current input field on object ObjectData 5381 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current input field on object ObjectData 5382 if ~isempty(errormsg) 5383 msgbox_uvmat('ERROR',['projection on ' UvData.ProjObject{iobj}.Type ': ' errormsg ]) 5384 return 5385 end 5381 5386 plot_field(ProjData,handles.PlotAxes,read_GUI(handles.uvmat));% plot the projected field; 5382 5387 UvData.PlotAxes=ProjData;% store the plotted field for further update … … 5446 5451 Data=get(hview_field,'UserData'); 5447 5452 hhview_field=guidata(hview_field); 5448 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 5453 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 5454 if ~isempty(errormsg) 5455 msgbox_uvmat('ERROR',['projection on ' UvData.ProjObject{iobj}.Type ': ' errormsg ]) 5456 return 5457 end 5449 5458 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%read plotting parameters on the uvmat interface 5450 5459 haxes=findobj(hview_field,'tag','axes3'); … … 5614 5623 5615 5624 %% show the projection of the selected object on view_field 5616 ProjData= proj_field(UvData.Field,UvData.ProjObject{IndexObj});%project the current field on ObjectData 5625 [ProjData,errormsg]= proj_field(UvData.Field,UvData.ProjObject{IndexObj});%project the current field on ObjectData 5626 if ~isempty(errormsg) 5627 msgbox_uvmat('ERROR',['projection on ' UvData.ProjObject{IndexObj}.Type ': ' errormsg]) 5628 return 5629 end 5617 5630 hview_field=findobj(allchild(0),'tag','view_field'); 5618 5631 if isempty(hview_field)
Note: See TracChangeset
for help on using the changeset viewer.