Changeset 316 for trunk/src/civ_matlab.m


Ignore:
Timestamp:
Dec 4, 2011, 5:54:17 PM (13 years ago)
Author:
sommeria
Message:

a few more bugs corrected, now the new civ_matlab works for civ1,fix1, patch1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r315 r316  
    105105        eval(['Data.' ListName '=Param.Fix1.' ParamName ';'])
    106106    end
    107 %     Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Fix1_WarnFlags','Fix1_TreshCorr','Fix1_TreshVel','Fix1_UpperBoundTest'}];
    108 %     Data.Fix1_WarnFlags=Param.Fix1.WarnFlags;
    109 %     Data.Fix1_ThreshCorr=Param.Fix1.ThreshCorr;
    110 %     Data.Fix1_ThreshVel=Param.Fix1.ThreshVel;
    111 %     Data.Fix1_UpperBoundTest=Param.Fix1.UpperBoundTest;
    112 
    113107    if check_civx
    114108        if ~isfield(Data,'fix')
     
    131125if isfield (Param,'Patch1')
    132126    check_patch1=1;
     127    Param.Patch1
    133128    Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch1_Rho','Patch1_Threshold','Patch1_SubDomain'}];
    134     Data.Patch1_Rho=str2double(Param.Patch1.Rho);
    135     Data.Patch1_Threshold=str2double(Param.Patch1.Threshold);
    136     Data.Patch1_SubDomain=str2double(Param.Patch1.SubDomain);
     129    Data.Patch1_Rho=Param.Patch1.SmoothingParam;
     130    Data.Patch1_Threshold=Param.Patch1.MaxDiff;
     131    Data.Patch1_SubDomain=Param.Patch1.SubdomainSize;
    137132    Data.ListVarName=[Data.ListVarName {'Civ1_U_Diff','Civ1_V_Diff','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites','Civ1_X_tps','Civ1_Y_tps','Civ1_U_tps','Civ1_V_tps'}];
    138133    Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbSubDomain1','Two'},{'NbSubDomain1','Two'},'NbSubDomain1',...
     
    146141        ind_good=find(Data.Civ1_FF==0);
    147142    else
     143       
    148144        ind_good=1:numel(Data.Civ1_X);
    149145    end
     
    171167    isx2=ibx2+2;
    172168    isy2=iby2+2;
     169
    173170    %get the previous guess for displacement
     171   
    174172    if ~check_patch1
    175         [Guess,VelType]=read_civdata(ObjectName,InputField,ParamIn.VelType);%TO DEVELOP
    176     else
    177         Data.Civ1_U_Diff=zeros(size(Data.Civ1_X));
    178         Data.Civ1_V_Diff=zeros(size(Data.Civ1_X));
    179         if isfield(Data,'Civ1_FF')
    180             ind_good=find(Data.Civ1_FF==0);
    181         else
    182             ind_good=1:numel(Data.Civ1_X);
    183         end
    184             [Data.Civ1_X_SubRange,Data.Civ1_Y_SubRange,Data.Civ1_NbSites,FFres,Ures, Vres,Data.Civ1_X_tps,Data.Civ1_Y_tps,Data.Civ1_U_tps,Data.Civ1_V_tps]=...
    185                                 patch(Data.Civ1_X(ind_good)',Data.Civ1_Y(ind_good)',Data.Civ1_U(ind_good)',Data.Civ1_V(ind_good)',Data.Patch1_Rho,Data.Patch1_Threshold,Data.Patch1_SubDomain);
    186         end
     173        [Data,VelType]=read_civdata(ObjectName,InputField,ParamIn.VelType);%TO DEVELOP
     174    end
     175   
     176    Guess =interp_tps(Data,X,Y)
     177%         Data.Civ1_U_Diff=zeros(size(Data.Civ1_X));
     178%         Data.Civ1_V_Diff=zeros(size(Data.Civ1_X));
     179%         if isfield(Data,'Civ1_FF')
     180%             ind_good=find(Data.Civ1_FF==0);
     181%         else
     182%             ind_good=1:numel(Data.Civ1_X);
     183%         end
     184%             [Data.Civ1_X_SubRange,Data.Civ1_Y_SubRange,Data.Civ1_NbSites,FFres,Ures, Vres,Data.Civ1_X_tps,Data.Civ1_Y_tps,Data.Civ1_U_tps,Data.Civ1_V_tps]=...
     185%                                 patch(Data.Civ1_X(ind_good)',Data.Civ1_Y(ind_good)',Data.Civ1_U(ind_good)',Data.Civ1_V(ind_good)',Data.Patch1_Rho,Data.Patch1_Threshold,Data.Patch1_SubDomain);
     186%         end
    187187%     shiftx=str2num(par_civ1.shiftx);
    188188%     shifty=str2num(par_civ1.shifty);
     
    597597    FF=FF==1 | C<Param.MinCorr;
    598598end
    599 if isfield (Param,'MinVel')||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel))
     599if (isfield(Param,'MinVel')&&~isempty(Param.MinVel))||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel))
    600600    Umod= U.*U+V.*V;
    601     if isfield (Param,'MinVel')
     601    if isfield (Param,'MinVel')&&~isempty(Param.MinVel)
    602602        FF=FF==1 | Umod<(Param.MinVel*Param.MinVel);
    603603    end
     
    722722CentreY=linspace(MinY+SizY/2,MaxY-SizY/2,NbSubDomainY);
    723723[CentreX,CentreY]=meshgrid(CentreX,CentreY);
    724 CentreY=reshape(CentreY,1,[]);
    725 CentreX=reshape(CentreX,1,[]);
     724CentreY=reshape(CentreY,1,[]);% Y positions of subdomain centres
     725CentreX=reshape(CentreX,1,[]);% X positions of subdomain centres
    726726rho=SizX*SizY*Rho/1000000;%optimum rho increase as the area of the subdomain (division by 10^6 to reach good values with the default GUI input)
    727727U_tps_sub=zeros(length(X),NbSubDomain);%default spline
Note: See TracChangeset for help on using the changeset viewer.