matlab: Dump2VTK now can dump scalar field + dump speed enhancements
parent
150b290aec
commit
2c60bf042e
|
@ -77,18 +77,36 @@ end
|
||||||
fprintf(fid,'\n\n');
|
fprintf(fid,'\n\n');
|
||||||
|
|
||||||
fprintf(fid,'POINT_DATA %d\n',numel(x)*numel(y)*numel(z));
|
fprintf(fid,'POINT_DATA %d\n',numel(x)*numel(y)*numel(z));
|
||||||
|
% dump vector field data
|
||||||
|
if (ndims(fields)==4)
|
||||||
if (nargin>3)
|
if (nargin>3)
|
||||||
fprintf(fid,['VECTORS ' fieldname ' float\n']);
|
fprintf(fid,['VECTORS ' fieldname ' float\n']);
|
||||||
else
|
else
|
||||||
fprintf(fid,'VECTORS field float\n');
|
fprintf(fid,'VECTORS field float\n');
|
||||||
end
|
end
|
||||||
|
fclose(fid);
|
||||||
|
field_x = fields(:,:,:,1);
|
||||||
|
field_y = fields(:,:,:,2);
|
||||||
|
field_z = fields(:,:,:,3);
|
||||||
|
clear fields
|
||||||
|
dumpField(:,1) = field_x(:);
|
||||||
|
dumpField(:,2) = field_y(:);
|
||||||
|
dumpField(:,3) = field_z(:);
|
||||||
|
save('-ascii','-append',filename,'dumpField')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for nz=1:numel(z)
|
% dump scalar field data
|
||||||
for ny=1:numel(y)
|
if (ndims(fields)==3)
|
||||||
for nx=1:numel(x)
|
if (nargin>3)
|
||||||
fprintf(fid,'%e %e %e\n',fields(nx,ny,nz,1),fields(nx,ny,nz,2),fields(nx,ny,nz,3));
|
fprintf(fid,['SCALARS ' fieldname ' float 1\nLOOKUP_TABLE default\n']);
|
||||||
end
|
else
|
||||||
|
fprintf(fid,'SCALARS field float 1\nLOOKUP_TABLE default\n');
|
||||||
end
|
end
|
||||||
|
fclose(fid);
|
||||||
|
dumpField = fields(:);
|
||||||
|
save('-ascii','-append',filename,'dumpField')
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
fclose(fid);
|
fclose(fid);
|
||||||
|
|
Loading…
Reference in New Issue