Changeset 1045 for trunk/src/proj_field.m
- Timestamp:
- May 21, 2018, 7:06:45 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r1027 r1045 554 554 return 555 555 end 556 CellInfo=CellInfo(NbDim>=2); %keep only the 2D cells 557 %%%%%% TODO: treat 1D fields: project as identity so that P o P=P for projection operation 556 CellInfo=CellInfo(NbDim>=2); %keep only the 2D or 3D cells 558 557 cell_select=true(size(CellInfo)); 559 558 560 559 for icell=1:length(CellInfo) 561 560 if isfield(CellInfo{icell},'ProjModeRequest') 562 if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode)563 cell_select(icell)=0;564 end561 % if ~strcmp(CellInfo{icell}.ProjModeRequest, ProjMode) 562 % cell_select(icell)=0; 563 % end 565 564 if strcmp(ProjMode,'interp_tps')&& ~strcmp(CellInfo{icell}.CoordType,'tps') 566 565 cell_select(icell)=0; … … 851 850 end 852 851 853 854 855 856 857 852 else 858 853 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; … … 929 924 ProjData.ListVarName=[ProjData.ListVarName {AXName}]; 930 925 ProjData.VarDimName=[ProjData.VarDimName {AXName}]; 926 nbvar=numel(ProjData.VarDimName); 927 ProjData.VarAttribute{nbvar}.Role='coord_x'; 931 928 for ivar=VarIndex 932 929 %VarName{ivar}=FieldData.ListVarName{ivar}; … … 950 947 ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}]; 951 948 ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate 952 ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line 949 nbvar=nbvar+1; 950 ProjData.VarAttribute{nbvar}.Role='coord_y';% for plot with continuous line 953 951 end 954 952 if nbcolor==3 … … 1122 1120 1123 1121 check_grid=zeros(size(CellInfo));% =1 if a grid is needed , =0 otherwise, for each field cell 1124 ProjMode=cell(size(CellInfo)); 1125 for icell=1:numel(CellInfo) 1126 ProjMode{icell}=ObjectData.ProjMode;% projection mode of the plane object 1127 end 1122 ProjMode=num2cell(blanks(numel(CellInfo))); 1123 ProjMode=regexprep(ProjMode,' ',ObjectData.ProjMode); 1124 %ProjMode=cell(size(CellInfo)); 1125 % for icell=1:numel(CellInfo) 1126 % ProjMode{icell}=ObjectData.ProjMode;% projection mode of the plane object 1127 % end 1128 1128 icell_grid=[];% field cell index which defines the grid 1129 1129 if ~strcmp(ObjectData.ProjMode,'projection')&& ~strcmp(ObjectData.Type,'plane_z')% TODO:rationalize … … 1202 1202 ProjData.ListVarName={AYName,AXName}; 1203 1203 1204 ProjData.VarAttribute={[],[]}; 1204 ProjData.VarAttribute{1}.Role='coord_y'; 1205 ProjData.VarAttribute{2}.Role='coord_x'; 1205 1206 end 1206 1207 … … 1219 1220 continue % only cells represnting 2D or 3D fields are involved 1220 1221 end 1221 VarIndex= CellInfo{icell}.VarIndex;% indices of the selected variables in the list FieldData.ListVarName1222 VarIndex= CellInfo{icell}.VarIndex;% indices of the selected variables in the list FieldData.ListVarName 1222 1223 %dimensions 1223 1224 DimCell=FieldData.VarDimName{VarIndex(1)}; … … 1237 1238 continue %skip for next cell (needs tps field cell) 1238 1239 end 1239 coord_x=FieldData.( FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)});% initial x coordinates1240 coord_y=FieldData.( FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% initial y coordinates1240 coord_x=FieldData.(CellInfo{icell}.XName);% initial x coordinates 1241 coord_y=FieldData.(CellInfo{icell}.YName);% initial y coordinates 1241 1242 check3D=(numel(CellInfo{icell}.CoordIndex)==3); 1242 1243 if check3D 1243 coord_z=FieldData.( FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});1244 coord_z=FieldData.(CellInfo{icell}.ZName); 1244 1245 end 1245 1246 … … 1256 1257 fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane 1257 1258 indcut=find(abs(fieldZ) <= width); 1258 for ivar= VarIndex1259 for ivar=[CellInfo{icell}.CoordIndex CellInfo{icell}.VarIndex] 1259 1260 VarName=FieldData.ListVarName{ivar}; 1260 1261 FieldData.(VarName)=FieldData.(VarName)(indcut); … … 1305 1306 return 1306 1307 end 1307 for ivar= VarIndex1308 for ivar=[CellInfo{icell}.CoordIndex CellInfo{icell}.VarIndex] 1308 1309 VarName=FieldData.ListVarName{ivar}; 1309 1310 FieldData.(VarName)=FieldData.(VarName)(indcut); … … 1321 1322 nbvar=0; 1322 1323 %nbvar=numel(ProjData.ListVarName); 1323 for ivar= VarIndex%transfer variables to the projection plane1324 for ivar=[CellInfo{icell}.CoordIndex CellInfo{icell}.VarIndex] %transfer variables to the projection plane 1324 1325 VarName=FieldData.ListVarName{ivar}; 1325 1326 if ivar==CellInfo{icell}.CoordIndex(end) … … 1401 1402 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps}); 1402 1403 checkUV=0; 1403 if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')1404 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x _tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps}));1404 if strcmp(CellInfo{icell}.VarType,'vector') 1405 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y})); 1405 1406 checkUV=1; 1406 1407 end
Note: See TracChangeset
for help on using the changeset viewer.