Changeset 405 for trunk/src/calc_field.m
 Timestamp:
 May 1, 2012, 10:08:36 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/calc_field.m
r404 r405 77 77 end 78 78 FieldList=FieldList(check_calc==1); 79 if isempty(FieldList)80 DataOut=DataIn;81 return82 end79 % if isempty(FieldList) 80 % DataOut=DataIn; 81 % return 82 % end 83 83 if isfield(DataIn,'Z')&& isequal(size(DataIn.Z),size(DataIn.X)) 84 84 nbcoord=3; … … 93 93 %% interpolation with new civ data 94 94 if isfield(DataIn,'SubRange') && isfield(DataIn,'Coord_tps') && (exist('Coord_interp','var')  check_grid check_der) 95 %create a default grid if needed 96 if ~exist('Coord_interp','var') 97 coord_x=DataIn.XMin:DataIn.Mesh:DataIn.XMax; 98 coord_y=DataIn.XMin:DataIn.Mesh:DataIn.YMax; 99 [XI,YI]=meshgrid(coord_x,coord_y); 100 XI=reshape(XI,[],1); 101 YI=reshape(YI,[],1); 102 Coord_interp=[XI YI]; 103 end 95 104 96 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 105 97 for ilist=1:numel(DataOut.ListGlobalAttribute) … … 113 105 XMin=min(min(DataIn.SubRange(1,:,:))); 114 106 YMin=min(min(DataIn.SubRange(2,:,:))); 115 % check_der=0; 116 % check_val=0; 107 %create a default grid if needed 108 if ~exist('Coord_interp','var') 109 if ~isfield(DataIn,'Mesh') 110 DataIn.Mesh=sqrt(2*(XMaxXMin)*(YMaxYMin)/numel(DataIn.Coord_tps)); 111 % adjust the mesh to a value 1, 2 , 5 *10^n 112 ord=10^(floor(log10(DataIn.Mesh)));%order of magnitude 113 if DataIn.Mesh/ord>=5 114 DataIn.Mesh=5*ord; 115 elseif DataIn.Mesh/ord>=2 116 DataIn.Mesh=2*ord; 117 else 118 DataIn.Mesh=ord; 119 end 120 end 121 coord_x=XMin:DataIn.Mesh:XMax; 122 coord_y=YMin:DataIn.Mesh:YMax; 123 [XI,YI]=meshgrid(coord_x,coord_y); 124 XI=reshape(XI,[],1); 125 YI=reshape(YI,[],1); 126 Coord_interp=[XI YI]; 127 end 117 128 nb_sites=size(Coord_interp,1); 118 129 nb_coord=size(Coord_interp,2); … … 124 135 DataOut.V=zeros(nb_sites,1); 125 136 otherwise 126 % case{'vort','div','strain'}% case of spatial derivatives137 % case{'vort','div','strain'}% case of spatial derivatives 127 138 DataOut.(FieldList{ilist})=zeros(nb_sites,1); 128 % otherwise % case of a scalar129 % check_val=1;130 % DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));139 % otherwise % case of a scalar 140 % check_val=1; 141 % DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1)); 131 142 end 132 143 end … … 142 153 % ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 143 154 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 144 if check_ val155 if check_grid 145 156 EM = tps_eval(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources' 146 157 end … … 164 175 VarAttributes{1}.Role='scalar'; 165 176 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 166 case 'norm_vel' 177 case 'norm_vel' 167 178 ListFields={'norm_vel'}; 168 179 VarAttributes{1}.Role='scalar';
Note: See TracChangeset
for help on using the changeset viewer.