Ignore:
Timestamp:
Oct 10, 2014, 10:11:30 AM (10 years ago)
Author:
sommeria
Message:

various

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tps_coeff_field.m

    r809 r822  
    66% DataOut: output field structure, reproducing the input field structure DataIn and adding the fields:
    77%         .Coord_tps
    8 %         .[VarName '_tps'] for each eligible input variable VarName (scalar ofr vector components)
     8%         .[VarName '_tps'] for each eligible input variable VarName (scalar or vector components)
    99% errormsg: error message, = '' by default
    1010%
    1111% INPUT:
    1212% DataIn: intput field structure
    13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps is needed), =0 otherwise
     13% checkall:=1 if tps is needed for all fields (a projection mode interp_tps has been chosen),
     14%          =0 otherwise (tps only needed to get spatial derivatives of scattered data)
    1415%
    1516% called functions:
     
    5354
    5455for icell=1:numel(CellInfo);
    55     if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered')% %if the coordinates are scattered
     56    if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %if the coordinates are scattered
    5657        NbCoord=NbDimArray(icell);% dimension of space
    5758        nbtps=nbtps+1;% indicate the number of tps coordinate sets in the field structure (in general =1)
    5859        X=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end)});% value of x coordinate
    59         Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of x coordinate
     60        Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of y coordinate
    6061        check_interp_tps=false(numel(DataIn.ListVarName),1);
    61         %for ivar=1:numel(CellInfo{icell}.VarIndex)
    62         Index_interp=[];
    63         if isfield(CellInfo{icell},'VarIndex_scalar')
     62        Index_interp=[];% indices of variables to interpolate
     63        if isfield(CellInfo{icell},'VarIndex_scalar')%interpolate scalar
    6464            Index_interp=[Index_interp CellInfo{icell}.VarIndex_scalar];
    6565        end
    66         if isfield(CellInfo{icell},'VarIndex_vector_x')
     66        if isfield(CellInfo{icell},'VarIndex_vector_x')%interpolate vector x component
    6767            Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_x];
    6868        end
    69         if isfield(CellInfo{icell},'VarIndex_vector_y')
     69        if isfield(CellInfo{icell},'VarIndex_vector_y')%interpolate vector y component
    7070            Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_y];
    7171        end
     
    7676            end
    7777        end
    78        
    79         %VarIndexInterp=CellInfo{icell}.VarIndex(check_interp_tps);% indices of variables to interpolate through tps
    80         %         if ~isempty(VarIndexInterp)
    8178        ListVarInterp=DataIn.ListVarName(check_interp_tps);
    8279        VarIndexInterp=find(check_interp_tps);
     
    110107                DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)];
    111108                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)
    112                 %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    113                 %                 fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    114                 %                 Coord_tps=cat(1,Coord_tps,fill);
    115109            end
    116110            for ivar=1:numel(ListVarInterp)
     
    132126            DataOut.(['SubRange' term])=SubRange;
    133127            DataOut.(['NbCentre' term])=NbCentre;
    134             %             DataOut.(['Coord_tps' term])=Coord_tps;
    135128            for ilist=1:numel(VarIndexInterp)
    136                 %                 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
    137129                for isub=1:size(SubRange,3)
    138130                    ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
Note: See TracChangeset for help on using the changeset viewer.