- Timestamp:
- Nov 29, 2012, 5:06:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r556 r564 2408 2408 CoordMax=zeros(numel(imax),NbDim); 2409 2409 CoordMin=zeros(numel(imax),NbDim); 2410 Mesh=zeros( numel(imax),NbDim);2410 Mesh=zeros(1,numel(imax)); 2411 2411 for ind=1:numel(imax) 2412 XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2413 YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2414 CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2415 CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2416 CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2417 CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2418 % test_x=1;%test for unstructured coordinates 2419 if NbDim==3 2420 ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2421 CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2422 CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2423 end 2424 2412 if strcmp(CellInfo{imax(ind)}.CoordType,'tps') 2413 CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable 2414 CoordMax(ind,NbDim)=max(UvData.Field.(CoordName)(1:end-3,1,:)); 2415 CoordMax(ind,NbDim-1)=max(UvData.Field.(CoordName)(1:end-3,2,:)); 2416 CoordMin(ind,NbDim)=min(UvData.Field.(CoordName)(1:end-3,1,:)); 2417 CoordMin(ind,NbDim-1)=min(UvData.Field.(CoordName)(1:end-3,2,:)); 2418 else 2419 XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2420 YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2421 CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2422 CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2423 CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2424 CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2425 % test_x=1;%test for unstructured coordinates 2426 if NbDim==3 2427 ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2428 CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2429 CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2430 end 2431 end 2425 2432 switch CellInfo{imax(ind)}.CoordType 2426 2433 2427 case 'scattered'%unstructured coordinates2428 NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points2429 Mesh(ind ,:)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim)2434 case {'scattered','tps'} %unstructured coordinates 2435 NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points 2436 Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim) 2430 2437 case 'grid'%structured coordinate 2431 2438 NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction 2432 Mesh(ind ,:)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1));2439 Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1)); 2433 2440 end 2434 2441 end
Note: See TracChangeset
for help on using the changeset viewer.