update to new interface
This commit is contained in:
parent
78c0243b8c
commit
0e1b24d0e9
|
|
@ -17,24 +17,25 @@ function [s] = read_scal_complete_ucf(file,varargin)
|
|||
addOptional(par,'debug',0,@isnumeric);
|
||||
parse(par,varargin{:});
|
||||
istep = par.Results.timestep;
|
||||
|
||||
|
||||
% Parse filename
|
||||
[fdir,fbase,fext] = fileparts(file);
|
||||
fname = sprintf('%s/%s.%05d',fdir,fbase,0);
|
||||
|
||||
|
||||
% Open first file
|
||||
obj = ucf(fname,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(fname);
|
||||
if ~obj.validateType('field')
|
||||
error('read error: no field data.');
|
||||
error('read error: no field data.');
|
||||
end
|
||||
nscal = obj.getNumDatasets(istep);
|
||||
|
||||
|
||||
% Read raw data
|
||||
q = cell(1,nscal);
|
||||
for iset=1:nscal
|
||||
[data,params] = obj.readSet(istep,iset);
|
||||
params = cast(params,'double');
|
||||
ighost = params(1);
|
||||
ighost = params(1);
|
||||
ib = params(2);
|
||||
jb = params(3);
|
||||
kb = params(4);
|
||||
|
|
@ -49,7 +50,7 @@ function [s] = read_scal_complete_ucf(file,varargin)
|
|||
q{iset} = q{iset}(2:end-1,2:end-1,2:end-1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Reassign content from loop and create global arrays
|
||||
s = zeros(nx,ny,nz,nscal,class(q{1}));
|
||||
for iscal=1:nscal
|
||||
|
|
@ -64,11 +65,12 @@ function [s] = read_scal_complete_ucf(file,varargin)
|
|||
fname = sprintf('%s/%s.%05d',fdir,fbase,ifile);
|
||||
while exist(fname,'file')
|
||||
% Open file
|
||||
obj = ucf(fname,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(fname)
|
||||
if ~obj.validateType('field')
|
||||
error('read error: no field data.');
|
||||
error('read error: no field data.');
|
||||
end
|
||||
|
||||
|
||||
% Read raw data
|
||||
q = cell(1,nscal);
|
||||
for iset=1:nscal
|
||||
|
|
@ -86,15 +88,15 @@ function [s] = read_scal_complete_ucf(file,varargin)
|
|||
q{iset} = q{iset}(2:end-1,2:end-1,2:end-1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Reassign content from loop and create global arrays
|
||||
for iscal=1:nscal
|
||||
s(ib:ib+nxl-1,jb:jb+nyl-1,kb:kb+nzl-1,iscal) = q{iset};
|
||||
end
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
|
||||
|
||||
% Move on to next file
|
||||
ifile = ifile+1;
|
||||
fname = sprintf('%s/%s.%05d',fdir,fbase,ifile);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
function [tbeg,tend,nstat,sm,ss,su,sv] = read_statistics_channel_scal_ucf(file,varargin)
|
||||
|
||||
|
||||
% Parse optional input arguments
|
||||
par = inputParser;
|
||||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
|
|
@ -9,14 +9,15 @@ function [tbeg,tend,nstat,sm,ss,su,sv] = read_statistics_channel_scal_ucf(file,v
|
|||
% Define sets to be read
|
||||
sets = {'um','uu','vv','ww','uv','uub','uvb'};
|
||||
nset = numel(sets);
|
||||
|
||||
|
||||
% Open UCF file and read
|
||||
obj = ucf(file,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(file);
|
||||
tend = obj.getSimulationTime(1);
|
||||
|
||||
|
||||
% Read parameters of first set
|
||||
params = obj.readParameters(1,1);
|
||||
|
||||
|
||||
% Parse parameters
|
||||
tbeg = typecast(params(1),'double');
|
||||
nstat = cast(params(2),'double');
|
||||
|
|
@ -34,7 +35,7 @@ function [tbeg,tend,nstat,sm,ss,su,sv] = read_statistics_channel_scal_ucf(file,v
|
|||
su(:,iscal) = obj.readSet(1,(iscal-1)*4+3)/nstat;
|
||||
sv(:,iscal) = obj.readSet(1,(iscal-1)*4+4)/nstat;
|
||||
end
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
function [tbeg,tend,nstat,um,uu,vv,ww,uv,uub,uvb,varargout] = read_statistics_channel_ucf(file,varargin)
|
||||
|
||||
|
||||
% Parse optional input arguments
|
||||
par = inputParser;
|
||||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
|
|
@ -9,20 +9,21 @@ function [tbeg,tend,nstat,um,uu,vv,ww,uv,uub,uvb,varargout] = read_statistics_ch
|
|||
% Define sets to be read
|
||||
sets = {'um','uu','vv','ww','uv','uub','uvb'};
|
||||
nset = numel(sets);
|
||||
|
||||
|
||||
% Open UCF file and read
|
||||
obj = ucf(file,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(file);
|
||||
tend = obj.getSimulationTime(1);
|
||||
|
||||
|
||||
% Read first dataset
|
||||
[um,params] = obj.readSet(1,1);
|
||||
|
||||
|
||||
% Parse parameters
|
||||
tbeg = typecast(params(1),'double');
|
||||
nstat = cast(params(2),'double');
|
||||
nset1 = cast(params(4),'double'); % channel stats
|
||||
nset2 = cast(params(5),'double'); % force eulerian
|
||||
|
||||
|
||||
if nset1~=7
|
||||
error('Invalid file.');
|
||||
end
|
||||
|
|
@ -33,7 +34,7 @@ function [tbeg,tend,nstat,um,uu,vv,ww,uv,uub,uvb,varargout] = read_statistics_ch
|
|||
uv = obj.readSet(1,5)/nstat;
|
||||
uub = obj.readSet(1,6)/nstat;
|
||||
uvb = obj.readSet(1,7)/nstat;
|
||||
|
||||
|
||||
% If eulerian force data, read that too
|
||||
if nset2==3
|
||||
if par.Results.verbosity
|
||||
|
|
@ -46,7 +47,7 @@ function [tbeg,tend,nstat,um,uu,vv,ww,uv,uub,uvb,varargout] = read_statistics_ch
|
|||
varargout{2} = fyp;
|
||||
varargout{3} = fzp;
|
||||
end
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,17 +29,18 @@ function [u,ibu,jbu,kbu,nxul,nyul,nzul,...
|
|||
parse(par,varargin{:});
|
||||
istep = par.Results.timestep;
|
||||
keepghost = par.Results.ghost;
|
||||
|
||||
|
||||
% Define sets to be read
|
||||
sets = {'u','v','w','p'};
|
||||
nset = numel(sets);
|
||||
|
||||
|
||||
% Open file
|
||||
obj = ucf(file,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(file);
|
||||
if ~obj.validateType('field')
|
||||
error('read error: no field data.');
|
||||
error('read error: no field data.');
|
||||
end
|
||||
|
||||
|
||||
% Read raw data
|
||||
ib = cell(1,nset);
|
||||
jb = cell(1,nset);
|
||||
|
|
@ -64,7 +65,7 @@ function [u,ibu,jbu,kbu,nxul,nyul,nzul,...
|
|||
ighost = 0;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Close UCF file
|
||||
obj.close();
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ function [u,ibu,jbu,kbu,nxul,nyul,nzul,...
|
|||
nxul = nxl{iset};
|
||||
nyul = nyl{iset};
|
||||
nzul = nzl{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'v'));
|
||||
v = q{iset};
|
||||
ibv = ib{iset};
|
||||
|
|
@ -86,7 +87,7 @@ function [u,ibu,jbu,kbu,nxul,nyul,nzul,...
|
|||
nxvl = nxl{iset};
|
||||
nyvl = nyl{iset};
|
||||
nzvl = nzl{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'w'));
|
||||
w = q{iset};
|
||||
ibw = ib{iset};
|
||||
|
|
@ -95,7 +96,7 @@ function [u,ibu,jbu,kbu,nxul,nyul,nzul,...
|
|||
nxwl = nxl{iset};
|
||||
nywl = nyl{iset};
|
||||
nzwl = nzl{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'p'));
|
||||
p = q{iset};
|
||||
ibp = ib{iset};
|
||||
|
|
|
|||
|
|
@ -21,17 +21,18 @@ function [u,v,w,p] = read_uvwp_complete_ucf(file,varargin)
|
|||
% Define sets to be read
|
||||
sets = {'u','v','w','p'};
|
||||
nset = numel(sets);
|
||||
|
||||
|
||||
% Parse filename
|
||||
[fdir,fbase,fext] = fileparts(file);
|
||||
fname = sprintf('%s/%s.%05d',fdir,fbase,0);
|
||||
|
||||
|
||||
% Open first file
|
||||
obj = ucf(fname,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(fname);
|
||||
if ~obj.validateType('field')
|
||||
error('read error: no field data.');
|
||||
error('read error: no field data.');
|
||||
end
|
||||
|
||||
|
||||
% Read raw data
|
||||
q = cell(1,nset);
|
||||
ib = cell(1,nset);
|
||||
|
|
@ -61,26 +62,26 @@ function [u,v,w,p] = read_uvwp_complete_ucf(file,varargin)
|
|||
q{iset} = q{iset}(2:end-1,2:end-1,2:end-1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Reassign content from loop and create global arrays
|
||||
iset = find(strcmp(sets,'u'));
|
||||
u = zeros(nx{iset},ny{iset},nz{iset},class(q{iset}));
|
||||
u(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'v'));
|
||||
v = zeros(nx{iset},ny{iset},nz{iset},class(q{iset}));
|
||||
v(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'w'));
|
||||
w = zeros(nx{iset},ny{iset},nz{iset},class(q{iset}));
|
||||
w(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'p'));
|
||||
p = zeros(nx{iset},ny{iset},nz{iset},class(q{iset}));
|
||||
p(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
|
|
@ -95,11 +96,12 @@ function [u,v,w,p] = read_uvwp_complete_ucf(file,varargin)
|
|||
fname = sprintf('%s/%s.%05d',fdir,fbase,ifile);
|
||||
while exist(fname,'file')
|
||||
% Open file
|
||||
obj = ucf(fname,'read','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.open(fname);
|
||||
if ~obj.validateType('field')
|
||||
error('read error: no field data.');
|
||||
error('read error: no field data.');
|
||||
end
|
||||
|
||||
|
||||
% Read raw data
|
||||
q = cell(1,nset);
|
||||
ib = cell(1,nset);
|
||||
|
|
@ -123,31 +125,31 @@ function [u,v,w,p] = read_uvwp_complete_ucf(file,varargin)
|
|||
q{iset} = q{iset}(2:end-1,2:end-1,2:end-1);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Reassign content from loop and create global arrays
|
||||
iset = find(strcmp(sets,'u'));
|
||||
u(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'v'));
|
||||
v(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'w'));
|
||||
w(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
iset = find(strcmp(sets,'p'));
|
||||
p(ib{iset}:ib{iset}+nxl{iset}-1,...
|
||||
jb{iset}:jb{iset}+nyl{iset}-1,...
|
||||
kb{iset}:kb{iset}+nzl{iset}-1) = q{iset};
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
|
||||
|
||||
% Move on to next file
|
||||
ifile = ifile+1;
|
||||
fname = sprintf('%s/%s.%05d',fdir,fbase,ifile);
|
||||
|
|
|
|||
|
|
@ -10,19 +10,19 @@ function [] = write_particles_ucf(file,pp,col,time,varargin)
|
|||
% endian endianess of the file as used by fopen (default: 'n')
|
||||
% verbosity verbose output? (default: no)
|
||||
% debug debug output? (default: no)
|
||||
|
||||
|
||||
% Parse variable input
|
||||
par = inputParser;
|
||||
addOptional(par,'endian','n',@ischar);
|
||||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
addOptional(par,'debug',0,@isnumeric);
|
||||
parse(par,varargin{:});
|
||||
|
||||
|
||||
ncol = size(pp,1);
|
||||
np = size(pp,2);
|
||||
[ncolref,ncol_rank,ncol_hybrid,ncol_dem,ncol_scal] = ncol_from_colmap(col);
|
||||
nt = size(pp,3);
|
||||
|
||||
|
||||
% Check for consistency
|
||||
if ncol~=col.Count || ncol~=ncolref
|
||||
error('Particle data does not match column map.');
|
||||
|
|
@ -30,11 +30,10 @@ function [] = write_particles_ucf(file,pp,col,time,varargin)
|
|||
if nt~=numel(time)
|
||||
error('Number of time steps must match the number of time values given. %d,%d',nt,numel(time));
|
||||
end
|
||||
|
||||
|
||||
% Create file
|
||||
obj = ucf(file,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('particle','endian',par.Results.endian);
|
||||
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(file,'type','particle','endian',par.Results.endian);
|
||||
% Add particle data step by step
|
||||
for it=1:nt
|
||||
obj.appendStep(time(it));
|
||||
|
|
@ -42,7 +41,7 @@ function [] = write_particles_ucf(file,pp,col,time,varargin)
|
|||
data = pp(:,:,it);
|
||||
obj.appendSet(data,params);
|
||||
end
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function [] = write_scal_chunk_ucf(file,s,ib,jb,kb,nx,ny,nz,time,ighost,varargin
|
|||
% endian endianess of the file as used by fopen (default: 'n')
|
||||
% verbosity verbose output? (default: no)
|
||||
% debug debug output? (default: no)
|
||||
|
||||
|
||||
% Parse variable input
|
||||
par = inputParser;
|
||||
addOptional(par,'rank',[0,0,0,0],@(x)isnumeric(x)&&numel(x)==4);
|
||||
|
|
@ -21,15 +21,15 @@ function [] = write_scal_chunk_ucf(file,s,ib,jb,kb,nx,ny,nz,time,ighost,varargin
|
|||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
addOptional(par,'debug',0,@isnumeric);
|
||||
parse(par,varargin{:});
|
||||
|
||||
|
||||
% Determine number of scalar fields
|
||||
nscal = size(s,4);
|
||||
|
||||
|
||||
% Create file and write to it
|
||||
obj = ucf(file,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('field','rank',par.Results.rank,'endian',par.Results.endian);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(file,'type','field','rank',par.Results.rank,'endian',par.Results.endian);
|
||||
obj.appendStep(time);
|
||||
|
||||
|
||||
% Write scalar field by field
|
||||
for iscal=1:nscal
|
||||
nxl = size(s,1)-2*ighost;
|
||||
|
|
@ -38,7 +38,7 @@ function [] = write_scal_chunk_ucf(file,s,ib,jb,kb,nx,ny,nz,time,ighost,varargin
|
|||
params = int64([ighost,ib,jb,kb,nxl,nyl,nzl,nx,ny,nz]);
|
||||
obj.appendSet(s(:,:,:,iscal),params);
|
||||
end
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@ function [] = write_scal_complete_ucf(file,s,ibegp,iendp,jbegp,jendp,kbegp,kendp
|
|||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
addOptional(par,'debug',0,@isnumeric);
|
||||
parse(par,varargin{:});
|
||||
|
||||
|
||||
% Parse filename
|
||||
[fdir,fbase,fext] = fileparts(file);
|
||||
fbasepath = fullfile(fdir,fbase);
|
||||
|
||||
|
||||
nxprocs = numel(ibegp);
|
||||
nyprocs = numel(jbegp);
|
||||
nzprocs = numel(kbegp);
|
||||
|
|
@ -31,13 +31,13 @@ function [] = write_scal_complete_ucf(file,s,ibegp,iendp,jbegp,jendp,kbegp,kendp
|
|||
ny = size(s,2);
|
||||
nz = size(s,3);
|
||||
nscal = size(s,4);
|
||||
|
||||
|
||||
for ixproc=0:nxprocs-1
|
||||
for iyproc=0:nyprocs-1
|
||||
for izproc=0:nzprocs-1
|
||||
[iproc] = locfun_proc_id(ixproc,iyproc,izproc,nxprocs,nyprocs,nzprocs);
|
||||
fname = sprintf('%s.%05d',fbasepath,iproc);
|
||||
|
||||
|
||||
% Extract local indices
|
||||
ib = ibegp(ixproc+1);
|
||||
ie = iendp(ixproc+1);
|
||||
|
|
@ -45,12 +45,12 @@ function [] = write_scal_complete_ucf(file,s,ibegp,iendp,jbegp,jendp,kbegp,kendp
|
|||
je = jendp(iyproc+1);
|
||||
kb = kbegp(izproc+1);
|
||||
ke = kendp(izproc+1);
|
||||
|
||||
|
||||
% Create a new chunk file
|
||||
obj = ucf(fname,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(fname,'type','field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj.appendStep(time);
|
||||
|
||||
|
||||
% Write data field by field
|
||||
for iscal=1:nscal
|
||||
ighost = 0;
|
||||
|
|
@ -61,7 +61,7 @@ function [] = write_scal_complete_ucf(file,s,ibegp,iendp,jbegp,jendp,kbegp,kendp
|
|||
data = s(ib:ie,jb:je,kb:ke,iscal);
|
||||
obj.appendSet(data,params);
|
||||
end
|
||||
|
||||
|
||||
% Close chunk file
|
||||
obj.close();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function [] = write_uvwp_chunk_ucf(file,...
|
|||
% endian endianess of the file as used by fopen (default: 'n')
|
||||
% verbosity verbose output? (default: no)
|
||||
% debug debug output? (default: no)
|
||||
|
||||
|
||||
% Parse variable input
|
||||
par = inputParser;
|
||||
addOptional(par,'rank',[0,0,0,0],@(x)isnumeric(x)&&numel(x)==4);
|
||||
|
|
@ -31,40 +31,40 @@ function [] = write_uvwp_chunk_ucf(file,...
|
|||
addOptional(par,'verbosity',0,@isnumeric);
|
||||
addOptional(par,'debug',0,@isnumeric);
|
||||
parse(par,varargin{:});
|
||||
|
||||
|
||||
% Create file and write to it
|
||||
obj = ucf(file,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('field','rank',par.Results.rank,'endian',par.Results.endian);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(file,'type','field','rank',par.Results.rank,'endian',par.Results.endian);
|
||||
obj.appendStep(time);
|
||||
|
||||
|
||||
% Write u
|
||||
nxul = size(u,1)-2*ighost;
|
||||
nyul = size(u,2)-2*ighost;
|
||||
nzul = size(u,3)-2*ighost;
|
||||
params = int64([ighost,ibu,jbu,kbu,nxul,nyul,nzul,nxu,nyu,nzu]);
|
||||
obj.appendSet(u,params);
|
||||
|
||||
|
||||
% Write v
|
||||
nxvl = size(v,1)-2*ighost;
|
||||
nyvl = size(v,2)-2*ighost;
|
||||
nzvl = size(v,3)-2*ighost;
|
||||
params = int64([ighost,ibv,jbv,kbv,nxvl,nyvl,nzvl,nxv,nyv,nzv]);
|
||||
obj.appendSet(v,params);
|
||||
|
||||
|
||||
% Write w
|
||||
nxwl = size(w,1)-2*ighost;
|
||||
nywl = size(w,2)-2*ighost;
|
||||
nzwl = size(w,3)-2*ighost;
|
||||
params = int64([ighost,ibw,jbw,kbw,nxwl,nywl,nzwl,nxw,nyw,nzw]);
|
||||
obj.appendSet(w,params);
|
||||
|
||||
|
||||
% Write p
|
||||
nxpl = size(p,1)-2*ighost;
|
||||
nypl = size(p,2)-2*ighost;
|
||||
nzpl = size(p,3)-2*ighost;
|
||||
params = int64([ighost,ibp,jbp,kbp,nxpl,nypl,nzpl,nxp,nyp,nzp]);
|
||||
obj.appendSet(p,params);
|
||||
|
||||
|
||||
% Close file
|
||||
obj.close();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function [] = write_uvwp_complete_ucf(file,...
|
|||
for izproc=0:nzprocs-1
|
||||
[iproc] = locfun_proc_id(ixproc,iyproc,izproc,nxprocs,nyprocs,nzprocs);
|
||||
fname = sprintf('%s.%05d',fbasepath,iproc);
|
||||
|
||||
|
||||
% Extract local indices
|
||||
ibu = ibegu(ixproc+1); ibv = ibegv(ixproc+1); ibw = ibegw(ixproc+1); ibp = ibegp(ixproc+1);
|
||||
ieu = iendu(ixproc+1); iev = iendv(ixproc+1); iew = iendw(ixproc+1); iep = iendp(ixproc+1);
|
||||
|
|
@ -54,13 +54,13 @@ function [] = write_uvwp_complete_ucf(file,...
|
|||
jeu = jendu(iyproc+1); jev = jendv(iyproc+1); jew = jendw(iyproc+1); jep = jendp(iyproc+1);
|
||||
kbu = kbegu(izproc+1); kbv = kbegv(izproc+1); kbw = kbegw(izproc+1); kbp = kbegp(izproc+1);
|
||||
keu = kendu(izproc+1); kev = kendv(izproc+1); kew = kendw(izproc+1); kep = kendp(izproc+1);
|
||||
|
||||
|
||||
% Create a new chunk file
|
||||
obj = ucf(fname,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(fname,'type','field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj.appendStep(time);
|
||||
ighost = 0;
|
||||
|
||||
|
||||
% Write u
|
||||
nxul = size(u,1)-2*ighost;
|
||||
nyul = size(u,2)-2*ighost;
|
||||
|
|
@ -68,7 +68,7 @@ function [] = write_uvwp_complete_ucf(file,...
|
|||
params = int64([ighost,ibu,jbu,kbu,nxul,nyul,nzul,nxu,nyu,nzu]);
|
||||
data = u(ibu:ieu,jbu:jeu,kbu:keu);
|
||||
obj.appendSet(data,params);
|
||||
|
||||
|
||||
% Write v
|
||||
nxvl = size(v,1)-2*ighost;
|
||||
nyvl = size(v,2)-2*ighost;
|
||||
|
|
@ -76,7 +76,7 @@ function [] = write_uvwp_complete_ucf(file,...
|
|||
params = int64([ighost,ibv,jbv,kbv,nxvl,nyvl,nzvl,nxv,nyv,nzv]);
|
||||
data = v(ibv:iev,jbv:jev,kbv:kev);
|
||||
obj.appendSet(data,params);
|
||||
|
||||
|
||||
% Write w
|
||||
nxwl = size(w,1)-2*ighost;
|
||||
nywl = size(w,2)-2*ighost;
|
||||
|
|
@ -84,7 +84,7 @@ function [] = write_uvwp_complete_ucf(file,...
|
|||
params = int64([ighost,ibw,jbw,kbw,nxwl,nywl,nzwl,nxw,nyw,nzw]);
|
||||
data = w(ibw:iew,jbw:jew,kbw:kew);
|
||||
obj.appendSet(data,params);
|
||||
|
||||
|
||||
% Write p
|
||||
nxpl = size(p,1)-2*ighost;
|
||||
nypl = size(p,2)-2*ighost;
|
||||
|
|
@ -103,4 +103,4 @@ end
|
|||
function [ind] = locfun_proc_id(ii,jj,kk,nx,ny,nz)
|
||||
% local version of 'sub2ind_zero_row'
|
||||
ind=ii*ny*nz+jj*nz+kk;
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ function [] = write_uvwp_newmesh_ucf(file,...
|
|||
keu = kendu(izproc+1); kev = kendv(izproc+1); kew = kendw(izproc+1); kep = kendp(izproc+1);
|
||||
|
||||
% Create output file
|
||||
obj = ucf(fname,'create','verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.setFileHeader('field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj = ucf('verbosity',par.Results.verbosity,'debug',par.Results.debug);
|
||||
obj.create(fname,'type','field','rank',[iproc,ixproc,iyproc,izproc],'endian',par.Results.endian);
|
||||
obj.appendStep(time);
|
||||
|
||||
% Interpolate to refined chunk and write
|
||||
|
|
@ -99,8 +99,6 @@ function [] = write_uvwp_newmesh_ucf(file,...
|
|||
obj.appendField(tmp,0,ibp,jbp,kbp,nxp,nyp,nzp);
|
||||
|
||||
obj.close();
|
||||
clear obj
|
||||
fclose all;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue