Changeset 747 for trunk/src/proj_field.m


Ignore:
Timestamp:
Apr 22, 2014, 9:44:39 AM (10 years ago)
Author:
sommeria
Message:

adpatations to 3D fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r738 r747  
    12961296                    Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});
    12971297                    Coord{2}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)});
     1298                    if NbDim==3
     1299                        Coord{3}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(3)});
     1300                    end
    12981301                    if numel(Coord{NbDim-1})==2
    12991302                        DY=(Coord{NbDim-1}(2)-Coord{NbDim-1}(1))/(DimValue(1)-1);
     
    13021305                        DX=(Coord{NbDim}(2)-Coord{NbDim}(1))/(DimValue(2)-1);
    13031306                    end
    1304                     if testYMin%test_direct(indY)
    1305                         YIndexMin=(YMin-Coord{NbDim-1}(1))/DY+1;% matrix index corresponding to the min y value for the new field
    1306                         YIndexMax=(YMax-Coord{NbDim-1}(1))/DY+1;% matrix index corresponding to the max y value for the new field
     1307                    if testYMax
     1308                         YIndexMax=(YMax-Coord{NbDim-1}(1))/DY+1;% matrix index corresponding to the max y value for the new field
     1309                        if testYMin%test_direct(indY)
     1310                            YIndexMin=(YMin-Coord{NbDim-1}(1))/DY+1;% matrix index corresponding to the min x value for the new field
     1311                        else
     1312                            YIndexMin=1;
     1313                        end         
    13071314                    else
    1308                         YIndexMin=(Coord{NbDim-1}(1)-YMax)/DY+1;
    1309                         YIndexMax=(Coord{NbDim-1}(1)-YMin)/DY+1;
    1310                         Ybound(2)=Coord{NbDim-1}(1)-DY*(YIndexMax-1);
    1311                         Ybound(1)=Coord{NbDim-1}(1)-DY*(YIndexMin-1);
    1312                     end
    1313                     if testXMin%test_direct(NbDim)==1
    1314                         XIndexMin=(XMin-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the min x value for the new field
    1315                         XIndexMax=(XMax-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the max x value for the new field
    1316                         Xbound(1)=Coord{NbDim}(1)+DX*(XIndexMin-1);%  x value corresponding to XIndexMin
    1317                         Xbound(2)=Coord{NbDim}(1)+DX*(XIndexMax-1);%  x value corresponding to XIndexMax
     1315                        YIndexMax=Coord{NbDim-1}(end)/DY;
     1316                        YIndexMin=1;
     1317                    end
     1318                    if testXMax
     1319                         XIndexMax=(XMax-Coord{NbDim}(1))/DY+1;% matrix index corresponding to the max y value for the new field
     1320                        if testYMin%test_direct(indY)
     1321                            XIndexMin=(XMin-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the min x value for the new field
     1322                        else
     1323                            XIndexMin=1;
     1324                        end         
    13181325                    else
    1319                         XIndexMin=(Coord{NbDim}(1)-XMax)/DX+1;
    1320                         XIndexMax=(Coord{NbDim}(1)-XMin)/DX+1;
    1321                         Xbound(2)=Coord{NbDim}(1)+DX*(XIndexMax-1);
    1322                         Xbound(1)=Coord{NbDim}(1)+DX*(XIndexMin-1);
    1323                     end
     1326                        XIndexMax=Coord{NbDim}(end)/DX;
     1327                        XIndexMin=1;
     1328                    end
     1329%                         YIndexMin=(Coord{NbDim-1}(1)-YMax)/DY+1;
     1330% %                         YIndexMax=(Coord{NbDim-1}(1)-YMin)/DY+1;
     1331%                         Ybound(2)=Coord{NbDim-1}(1)-DY*(YIndexMax-1);
     1332%                         Ybound(1)=Coord{NbDim-1}(1)-DY*(YIndexMin-1);
     1333%                     end
     1334%                     if testXMin%test_direct(NbDim)==1
     1335%                         XIndexMin=(XMin-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the min x value for the new field
     1336%                         XIndexMax=(XMax-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the max x value for the new field
     1337%                         Xbound(1)=Coord{NbDim}(1)+DX*(XIndexMin-1);%  x value corresponding to XIndexMin
     1338%                         Xbound(2)=Coord{NbDim}(1)+DX*(XIndexMax-1);%  x value corresponding to XIndexMax
     1339%                     else
     1340%                         XIndexMin=(Coord{NbDim}(1)-XMax)/DX+1;
     1341%                         XIndexMax=(Coord{NbDim}(1)-XMin)/DX+1;
     1342%                         Xbound(2)=Coord{NbDim}(1)+DX*(XIndexMax-1);
     1343%                         Xbound(1)=Coord{NbDim}(1)+DX*(XIndexMin-1);
     1344%                     end
    13241345                    YIndexRange(1)=ceil(min(YIndexMin,YIndexMax));%first y index to select from the previous field
    13251346                    YIndexRange(1)=max(YIndexRange(1),1);% avoid bound lower than the first index
     
    13461367                    else
    13471368                        if NbDim==3
     1369                            DZ=(Coord{1}(end)-Coord{1}(1))/(numel(Coord{1})-1);
    13481370                            DimCell(1)=[]; %suppress z variable
    13491371                            DimValue(1)=[];
     1372                            test_direct=1;%TOdo; GENERALIZE, SEE CASE OF points
    13501373                            if test_direct(1)
    13511374                                iz=ceil((ObjectData.Coord(1,3)-Coord{1}(1))/DZ)+1;
Note: See TracChangeset for help on using the changeset viewer.