Changeset 747 for trunk/src/proj_field.m
- Timestamp:
- Apr 22, 2014, 9:44:39 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r738 r747 1296 1296 Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)}); 1297 1297 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 1298 1301 if numel(Coord{NbDim-1})==2 1299 1302 DY=(Coord{NbDim-1}(2)-Coord{NbDim-1}(1))/(DimValue(1)-1); … … 1302 1305 DX=(Coord{NbDim}(2)-Coord{NbDim}(1))/(DimValue(2)-1); 1303 1306 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 1307 1314 else 1308 YIndexM in=(Coord{NbDim-1}(1)-YMax)/DY+1;1309 YIndexM ax=(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 end1313 if testXMin%test_direct(NbDim)==11314 XIndexMin=(XMin-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the min x value for the new field1315 XIndexMax=(XMax-Coord{NbDim}(1))/DX+1;% matrix index corresponding to the max x value for the new field1316 Xbound(1)=Coord{NbDim}(1)+DX*(XIndexMin-1);% x value corresponding to XIndexMin1317 Xbound(2)=Coord{NbDim}(1)+DX*(XIndexMax-1);% x value corresponding to XIndexMax1315 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 1318 1325 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 1324 1345 YIndexRange(1)=ceil(min(YIndexMin,YIndexMax));%first y index to select from the previous field 1325 1346 YIndexRange(1)=max(YIndexRange(1),1);% avoid bound lower than the first index … … 1346 1367 else 1347 1368 if NbDim==3 1369 DZ=(Coord{1}(end)-Coord{1}(1))/(numel(Coord{1})-1); 1348 1370 DimCell(1)=[]; %suppress z variable 1349 1371 DimValue(1)=[]; 1372 test_direct=1;%TOdo; GENERALIZE, SEE CASE OF points 1350 1373 if test_direct(1) 1351 1374 iz=ceil((ObjectData.Coord(1,3)-Coord{1}(1))/DZ)+1;
Note: See TracChangeset
for help on using the changeset viewer.