Ignore:
Timestamp:
May 9, 2024, 6:51:30 PM (5 months ago)
Author:
sommeria
Message:

new display of false vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/filter_tps.m

    r1142 r1143  
    6464NbVecSub=NbVec/NbSubDomain;% refined estimation of the nbre of vectors per subdomain
    6565smoothing=sqrt(Siz(1)*Siz(2)/NbVecSub)*FieldSmooth;%optimum smoothing increase as the typical mesh size =sqrt(SizX*SizY/NbVecSub)^1/2
     66
    6667%% default output
    6768SubRange=zeros(NbCoord,2,NbSubDomain);%initialise the boundaries of subdomains
     
    7879check_empty=zeros(1,NbSubDomain);
    7980
    80 
    8181%% calculate tps coeff in each subdomain
    8282for isub=1:NbSubDomain
     
    8787    %increase iteratively the subdomain if it contains less than SubDomainNbVec/4 source vectors
    8888    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
    9291        % if no vector in the subdomain  #isub, skip the subdomain
    9392        if isempty(ind_sel)
    9493            check_empty(isub)=1;
    95             break %  go to next subdomain
     94            break
    9695        % if too few selected vectors, increase the subrange for next iteration
    9796        elseif numel(ind_sel)<SubDomainSize/4 && ~isequal( ind_sel,ind_sel_previous)
     
    107106            ind_ind_sel=1:numel(ind_sel);%default
    108107            if exist('Threshold','var')&&~isempty(Threshold)
    109                 FF(ind_sel)=20*(NormDiff>Threshold);%put FF value to 20 to identify the criterium of elimmination
    110                 ind_ind_sel=find(FF(ind_sel)==0); % select the indices of ind_sel corresponding to the remaining vectors
     108                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
    111110            end
    112111            % if no value exceeds threshold, the result is recorded
     
    146145                V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub;
    147146                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)])
    149148                break
    150149            end
     
    167166U_smooth=U_smooth./nb_select;% take the average at the intersection of several subdomains
    168167V_smooth=V_smooth./nb_select;
    169 U_smooth(FF==20)=U(FF==20);% set to the initial values the eliminated vectors (flagged as false)
    170 V_smooth(FF==20)=V(FF==20);
     168U_smooth(FF==2)=U(FF==2);% set to the initial values the eliminated vectors (flagged as false)
     169V_smooth(FF==2)=V(FF==2);
    171170fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    172171Coord_tps=cat(1,Coord_tps,fill);
Note: See TracChangeset for help on using the changeset viewer.