Changeset 1143 for trunk/src/filter_tps.m
- Timestamp:
- May 9, 2024, 6:51:30 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/filter_tps.m
r1142 r1143 64 64 NbVecSub=NbVec/NbSubDomain;% refined estimation of the nbre of vectors per subdomain 65 65 smoothing=sqrt(Siz(1)*Siz(2)/NbVecSub)*FieldSmooth;%optimum smoothing increase as the typical mesh size =sqrt(SizX*SizY/NbVecSub)^1/2 66 66 67 %% default output 67 68 SubRange=zeros(NbCoord,2,NbSubDomain);%initialise the boundaries of subdomains … … 78 79 check_empty=zeros(1,NbSubDomain); 79 80 80 81 81 %% calculate tps coeff in each subdomain 82 82 for isub=1:NbSubDomain … … 87 87 %increase iteratively the subdomain if it contains less than SubDomainNbVec/4 source vectors 88 88 while numel(ind_sel)>numel(ind_sel_previous) 89 ind_sel_previous=ind_sel;% record the set of selected vector indices for next iteration 90 ind_sel=find(Coord(:,1)>=SubRange(1,1,isub) & Coord(:,1)<=SubRange(1,2,isub) & Coord(:,2)>=SubRange(2,1,isub) & Coord(:,2)<=SubRange(2,2,isub)); 91 %disp([numel(ind_sel) ' vectors in subdomain #' num2str(isub)]) 89 ind_sel_previous=ind_sel;% record the set of selected vector indices for next iteration 90 ind_sel= find(FF==0 & Coord(:,1)>=SubRange(1,1,isub) & Coord(:,1)<=SubRange(1,2,isub) & Coord(:,2)>=SubRange(2,1,isub) & Coord(:,2)<=SubRange(2,2,isub));% indices of vectors in the subdomain #isub 92 91 % if no vector in the subdomain #isub, skip the subdomain 93 92 if isempty(ind_sel) 94 93 check_empty(isub)=1; 95 break % go to next subdomain94 break 96 95 % if too few selected vectors, increase the subrange for next iteration 97 96 elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous) … … 107 106 ind_ind_sel=1:numel(ind_sel);%default 108 107 if exist('Threshold','var')&&~isempty(Threshold) 109 FF(ind_sel)=2 0*(NormDiff>Threshold);%put FF value to 20to identify the criterium of elimmination110 ind_ind_sel=find(FF(ind_sel)==0); % select the indices of ind_sel corresponding to the remaining vectors108 FF(ind_sel)=2*(NormDiff>Threshold);%put FF value to 2 to identify the criterium of elimmination 109 ind_ind_sel=find(FF(ind_sel)==0); % select the indices of remaining vectors in the subset of ind_sel vectors 111 110 end 112 111 % if no value exceeds threshold, the result is recorded … … 146 145 V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub; 147 146 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+weight; 148 display(['tps redone with ' num2str(numel(ind_sel)) ' vectors after elimination of ' num2str(numel(ind_ ind_sel)) ' erratic vectors in subdomain # ' num2str(isub) ' among ' num2str(NbSubDomain)])147 display(['tps redone with ' num2str(numel(ind_sel)) ' vectors after elimination of ' num2str(numel(ind_sel)-numel(ind_ind_sel)) ' erratic vectors in subdomain # ' num2str(isub) ' among ' num2str(NbSubDomain)]) 149 148 break 150 149 end … … 167 166 U_smooth=U_smooth./nb_select;% take the average at the intersection of several subdomains 168 167 V_smooth=V_smooth./nb_select; 169 U_smooth(FF==2 0)=U(FF==20);% set to the initial values the eliminated vectors (flagged as false)170 V_smooth(FF==2 0)=V(FF==20);168 U_smooth(FF==2)=U(FF==2);% set to the initial values the eliminated vectors (flagged as false) 169 V_smooth(FF==2)=V(FF==2); 171 170 fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 172 171 Coord_tps=cat(1,Coord_tps,fill);
Note: See TracChangeset
for help on using the changeset viewer.