Ignore:
Timestamp:
Aug 23, 2013, 2:56:17 PM (11 years ago)
Author:
sommeria
Message:

various bugs repaired, in particula timing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tps_coeff_field.m

    r651 r674  
    4040        X=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end)});% value of x coordinate
    4141        Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of x coordinate
    42         check_interp_tps=false(numel(CellInfo{icell}.VarIndex),1);
     42        check_interp_tps=false(numel(DataIn.ListVarName),1);
    4343        %for ivar=1:numel(CellInfo{icell}.VarIndex)
    4444        Index_interp=[];
     
    5252            Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_y];
    5353        end
    54         for ivar=Index_interp
    55             Attr=DataIn.VarAttribute{CellInfo{icell}.VarIndex(ivar)};
     54        for iselect=1:numel(Index_interp)
     55            Attr=DataIn.VarAttribute{Index_interp(iselect)};
    5656            if ~isfield(Attr,'VarIndex_tps')&& (checkall || (isfield(Attr,'ProjModeRequest')&&strcmp(Attr.ProjModeRequest,'interp_tps')))
    57                 check_interp_tps(ivar)=1;
     57                check_interp_tps(Index_interp(iselect))=1;
    5858            end
    5959        end
    60         VarIndexInterp=CellInfo{icell}.VarIndex(check_interp_tps);% indices of variables to interpolate through tps
    61         if ~isempty(VarIndexInterp)
    62             ListVarInterp=DataIn.ListVarName(VarIndexInterp);
     60       
     61        %VarIndexInterp=CellInfo{icell}.VarIndex(check_interp_tps);% indices of variables to interpolate through tps
     62        %         if ~isempty(VarIndexInterp)
     63        ListVarInterp=DataIn.ListVarName(check_interp_tps);
     64        VarIndexInterp=find(check_interp_tps);
     65        if ~isempty(ListVarInterp)
    6366            % exclude data points marked 'false' for interpolation
    6467            if isfield(CellInfo{icell},'VarIndex_errorflag')
     
    6669                X=X(FF==0);
    6770                Y=Y(FF==0);
    68                 for ilist=1:numel(VarIndexInterp)
     71                for ilist=1:numel(ListVarInterp)
    6972                    DataIn.(ListVarInterp{ilist})=DataIn.(ListVarInterp{ilist})(FF==0);
    7073                end
     
    7477                term=['_' num2str(nbtps-1)];
    7578            end
    76             ListNewVar=cell(1,numel(VarIndexInterp)+3);
     79            ListNewVar=cell(1,numel(ListVarInterp)+3);
    7780            ListNewVar(1:3)={['SubRange' term],['NbCentre' term],['Coord_tps' term]};
    78             for ilist=1:numel(VarIndexInterp)
     81            for ilist=1:numel(ListVarInterp)
    7982                ListNewVar{ilist+3}=[ListVarInterp{ilist} '_tps' term];
    8083            end
    8184            nbvar=numel(DataIn.ListVarName);
    8285            DataOut.ListVarName=[DataIn.ListVarName ListNewVar];
    83             %ListNewDim={['nb_tps' term],['nb_subdomain' term]};
    8486            DataOut.VarDimName=[DataIn.VarDimName {{'nb_coord','nb_bounds',['nb_subdomain' term]}} {['nb_subdomain' term]} ...
    8587                {{['nb_tps' term],'nb_coord',['nb_subdomain' term]}}];
     
    9193                DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage)
    9294                %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    93 %                 fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    94 %                 Coord_tps=cat(1,Coord_tps,fill);
    95             end         
    96             for ivar=1:numel(VarIndexInterp)
     95                %                 fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
     96                %                 Coord_tps=cat(1,Coord_tps,fill);
     97            end
     98            for ivar=1:numel(ListVarInterp)
    9799                DataOut.VarDimName{nbvar+3+ivar}={['nb_tps' term],['nb_subdomain' term]};
    98100                DataOut.VarAttribute{nbvar+3+ivar}=DataIn.VarAttribute{CellInfo{icell}.VarIndex_vector_x};%reproduce attributes of velocity
     
    112114            DataOut.(['SubRange' term])=SubRange;
    113115            DataOut.(['NbCentre' term])=NbCentre;
    114 %             DataOut.(['Coord_tps' term])=Coord_tps;
     116            %             DataOut.(['Coord_tps' term])=Coord_tps;
    115117            for ilist=1:numel(VarIndexInterp)
    116 %                 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
     118                %                 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
    117119                for isub=1:size(SubRange,3)
    118120                    ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
Note: See TracChangeset for help on using the changeset viewer.