Changeset 530 for trunk/src/calc_tps.m


Ignore:
Timestamp:
Aug 27, 2012, 4:38:41 PM (12 years ago)
Author:
sommeria
Message:

new conventions for find_field_cells .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_tps.m

    r516 r530  
    55    SubDomain=DataIn.SubDomain;%
    66end
    7 [CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(DataIn);
     7%[CellVarIndex,NbDimVec,VarTypeCell,errormsg]=find_field_cells(DataIn);
     8[CellInfo,NbDimArray,errormsg]=find_field_cells(DataIn);
    89nbtps=0;
    9 for icell=1:numel(CellVarIndex);
    10     VarType=VarTypeCell{icell};
    11     if NbDimVec(icell)>=2 && ~isempty(VarType.coord_x)
     10for icell=1:numel(CellInfo);
     11    %VarType=VarTypeCell{icell};
     12    if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered')%'&& ~isempty(VarType.coord_x)
    1213        nbtps=nbtps+1;
    13         X=DataIn.(DataIn.ListVarName{VarType.coord_x});
    14         Y=DataIn.(DataIn.ListVarName{VarType.coord_y});
    15         if ~isempty(VarType.vector_x)&&~isempty(VarType.vector_y)
    16             Attr=DataIn.VarAttribute{VarType.vector_x};
     14        X=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end)});
     15        Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
     16        if isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
     17            Attr=DataIn.VarAttribute{CellInfo{icell}.VarIndex_vector_x};
    1718            if ~isfield(Attr,'VarIndex_tps')&& (checkall || (isfield(Attr,'FieldRequest')&&strcmp(Attr.FieldRequest,'interp_tps')))               
    18                 U=DataIn.(DataIn.ListVarName{VarType.vector_x});
    19                 V=DataIn.(DataIn.ListVarName{VarType.vector_y});
     19                U=DataIn.(DataIn.ListVarName{CellInfo{icell}.VarIndex_vector_x});
     20                V=DataIn.(DataIn.ListVarName{CellInfo{icell}.VarIndex_vector_y});
    2021            else
    2122                continue
    2223            end
    2324        end
    24         if ~isempty(VarType.errorflag)
    25             FF=DataIn.(DataIn.ListVarName{VarType.errorflag});
     25        if isfield(CellInfo{icell},'VarIndex_errorflag')
     26            FF=DataIn.(DataIn.ListVarName{CellInfo{icell}.VarIndex_errorflag});
    2627            X=X(FF==0);
    2728            Y=Y(FF==0);
     
    4748       
    4849        DataOut.VarAttribute{nbvar+3}.Role='coord_tps';
    49         DataOut.VarAttribute{nbvar+4}=DataIn.VarAttribute{VarType.vector_x};%reproduce attributes of velocity
     50        DataOut.VarAttribute{nbvar+4}=DataIn.VarAttribute{CellInfo{icell}.VarIndex_vector_x};%reproduce attributes of velocity
    5051         DataOut.VarAttribute{nbvar+4}.Role='vector_x_tps';
    51          DataIn.VarAttribute{VarType.vector_x}.VarIndex_tps=nbvar+4;% indicte the correspondance with initial data
    52         DataOut.VarAttribute{nbvar+5}=DataIn.VarAttribute{VarType.vector_y};%reproduce attributes of velocity
     52         DataIn.VarAttribute{CellInfo{icell}.VarIndex_vector_x}.VarIndex_tps=nbvar+4;% indicte the correspondance with initial data
     53        DataOut.VarAttribute{nbvar+5}=DataIn.VarAttribute{CellInfo{icell}.VarIndex_vector_y};%reproduce attributes of velocity
    5354         DataOut.VarAttribute{nbvar+5}.Role='vector_y_tps';
    5455        if isfield(DataOut,'ListDimName')%cleaning'
Note: See TracChangeset for help on using the changeset viewer.