Changeset 19197 for issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m
- Timestamp:
- 03/16/15 10:23:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/contrib/paraview/exportVTK.m
r19157 r19197 59 59 if(size(sol_struct{i},2)>num_of_timesteps); 60 60 num_of_timesteps=size(sol_struct{i},2); 61 end 61 end 62 outstep=model.timestepping.time_step*model.settings.output_frequency; 62 63 end 63 64 else … … 145 146 s='%e\n'; 146 147 fprintf(fid,s,res_struct.(fieldnames{k})); 147 end 148 %check for forcings 149 elseif (size(res_struct.(fieldnames{k}),1)==num_of_points+1); 150 %paraview does not like NaN, replacing 151 nanval=find(isnan(res_struct.(fieldnames{k}))); 152 res_struct.(fieldnames{k})(nanval)=-9999; 153 %also checking for verry small value that mess up 154 smallval=(abs(res_struct.(fieldnames{k}))<1.0e-20); 155 res_struct.(fieldnames{k})(smallval)=0.0; 156 if (size(res_struct.(fieldnames{k}),2)==num_of_timesteps), 157 fprintf(fid,'SCALARS %s float 1 \n',fieldnames{k}); 158 fprintf(fid,'LOOKUP_TABLE default\n'); 159 s='%e\n'; 160 fprintf(fid,s,res_struct.(fieldnames{k})(1:end-1,timestep)); 161 else, 162 %forcing and results not on the same timestep,need some treatment 163 fprintf(fid,'SCALARS %s float 1 \n',fieldnames{k}); 164 fprintf(fid,'LOOKUP_TABLE default\n'); 165 index=1; 166 currenttime=((timestep-1)*outstep)+model.timestepping.start_time; 167 while (res_struct.(fieldnames{k})(end,index)<=currenttime); 168 if index==size(res_struct.(fieldnames{k}),2) 169 break 170 end 171 index=index+1; 172 end 173 uptime=res_struct.(fieldnames{k})(end,index); 174 uplim=res_struct.(fieldnames{k})(1:end-1,index); 175 while (res_struct.(fieldnames{k})(end,index)>=currenttime); 176 if index==1 177 break 178 end 179 index=index-1; 180 end 181 lowtime=res_struct.(fieldnames{k})(end,index); 182 lowlim=res_struct.(fieldnames{k})(1:end-1,index); 183 if uptime==currenttime, 184 interp=uplim; 185 elseif lowtime==currenttime, 186 interp=lowlim; 187 else 188 interp=lowlim+(uplim-lowlim)*((currenttime-lowtime)/(uptime-lowtime)); 189 end 190 s='%e\n'; 191 fprintf(fid,s,interp); 192 end 193 end 148 194 end 149 195 end
Note:
See TracChangeset
for help on using the changeset viewer.