matlab: CalcNF2FF can find all MPI faces

Note: nf2ff calc may not be able to handle this correctly!

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
Thorsten Liebig 2013-07-11 17:42:43 +02:00
parent 326d433701
commit 2d82e92acd

View File

@ -28,6 +28,7 @@ function nf2ff = CalcNF2FF(nf2ff, Sim_Path, freq, theta, phi, varargin)
% 'Radius': specify the radius for the nf2ff
% 'Eps_r': specify the relative electric permittivity for the nf2ff
% 'Mue_r': specify the relative magnetic permeability for the nf2ff
% 'MPI' : set true if MPI was used
%
% See also: CreateNF2FFBox, ReadNF2FF
%
@ -36,29 +37,46 @@ function nf2ff = CalcNF2FF(nf2ff, Sim_Path, freq, theta, phi, varargin)
% author: Thorsten Liebig, 2012
mode = 0;
MPI = 0;
filename = nf2ff.name;
nf2ff_xml.Planes = {};
for (n=1:numel(nf2ff.filenames_E))
if (nf2ff.directions(n)~=0)
nf2ff_xml.Planes{end+1}.ATTRIBUTE.E_Field = [nf2ff.filenames_E{n} '.h5'];
nf2ff_xml.Planes{end}.ATTRIBUTE.H_Field = [nf2ff.filenames_H{n} '.h5'];
end
end
nf2ff_xml.ATTRIBUTE.freq = freq;
nf2ff_xml.theta = theta;
nf2ff_xml.phi = phi;
nf2ff_xml.ATTRIBUTE.Outfile = [filename '.h5'];
for n=1:2:numel(varargin)-1
if (strcmp(varargin{n},'Mode'))
mode = varargin{n+1};
elseif (strcmp(varargin{n},'MPI'))
MPI = varargin{n+1};
else
nf2ff_xml.ATTRIBUTE.(varargin{n})=varargin{n+1};
end
end
for (n=1:numel(nf2ff.filenames_E))
if (nf2ff.directions(n)~=0)
if (MPI==0)
nf2ff_xml.Planes{end+1}.ATTRIBUTE.E_Field = [nf2ff.filenames_E{n} '.h5'];
nf2ff_xml.Planes{end}.ATTRIBUTE.H_Field = [nf2ff.filenames_H{n} '.h5'];
else
files_E = dir([Sim_Path '/ID*' nf2ff.filenames_E{n} '.h5']);
files_H = dir([Sim_Path '/ID*' nf2ff.filenames_H{n} '.h5']);
if (numel(files_E)~=numel(files_H))
error 'number of E/H planes mismatch!'
end
for fn = 1:numel(files_E)
nf2ff_xml.Planes{end+1}.ATTRIBUTE.E_Field = files_E(fn).name;
nf2ff_xml.Planes{end}.ATTRIBUTE.H_Field = files_H(fn).name;
end
end
end
end
nf2ff_xml.ATTRIBUTE.freq = freq;
nf2ff_xml.theta = theta;
nf2ff_xml.phi = phi;
nf2ff.xml = [Sim_Path '/' filename '.xml'];
nf2ff.hdf5 = [Sim_Path '/' nf2ff_xml.ATTRIBUTE.Outfile];
@ -66,8 +84,8 @@ nf2ff.hdf5 = [Sim_Path '/' nf2ff_xml.ATTRIBUTE.Outfile];
struct_2_xml(nf2ff.xml,nf2ff_xml,'nf2ff');
m_filename = mfilename('fullpath');
dir = fileparts( m_filename );
openEMS_Path = [dir filesep '..' filesep];
dir_name = fileparts( m_filename );
openEMS_Path = [dir_name filesep '..' filesep];
if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2))
disp('CalcNF2FF: Reading nf2ff data only...')