update to CreateNF2FFBox

pull/1/head
Thorsten Liebig 2012-02-02 11:52:55 +01:00
parent da87b25f49
commit f970e5a8d7
1 changed files with 48 additions and 33 deletions

View File

@ -1,5 +1,5 @@
function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, directions)
% function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, directions)
function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, varargin)
% function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, varargin)
%
% create the dump boxes needed for the near field to far field transformation
%
@ -7,49 +7,64 @@ function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, directions)
% name: name of this nf2ff box
% start/stop: start/stop coordinates for the nf2ff box (this box has to
% enclose all radiating structures!)
% optional inputs:
% 'Directions': enable/disable specific directions, e.g.
% 'Directions',[1 1 0 0 1 1]
% -> disable nf2ff in +/-y direction
%
% example:
% see examples/NF2FF/infDipol.m
% see Tutorials/Simple_Patch_Antenna.m
%
% See also AnalyzeNF2FF
%
% (C) 2010 Sebastian Held <sebastian.held@gmx.de>
% (C) 2010, 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
% (C) 2010-2012 Thorsten Liebig <thorsten.liebig@gmx.de>
if (nargin<5)
directions = ones(6,1);
end
nf2ff.filenames_E = {[name '_Et_xn'],[name '_Et_xp'],[name '_Et_yn'],[name '_Et_yp'],[name '_Et_zn'],[name '_Et_zp']};
nf2ff.filenames_H = {[name '_Ht_xn'],[name '_Ht_xp'],[name '_Ht_yn'],[name '_Ht_yp'],[name '_Ht_zn'],[name '_Ht_zp']};
directions = ones(6,1);
add_args = {};
dump_type = 0;
for n=1:numel(varargin)/2
if strcmp(varargin{2*n-1},'Frequency')
add_args = {'Frequency', varargin{2*n}};
dump_type = 10;
end
if strcmp(varargin{2*n-1},'Directions')
directions=varargin{2*n};
end
end
nf2ff.name = name;
nf2ff.filenames_E = {[name '_E_xn'],[name '_E_xp'],[name '_E_yn'],[name '_E_yp'],[name '_E_zn'],[name '_E_zp']};
nf2ff.filenames_H = {[name '_H_xn'],[name '_H_xp'],[name '_H_yn'],[name '_H_yp'],[name '_H_zn'],[name '_H_zp']};
nf2ff.directions = directions;
if (directions(1))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{1},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{1}, 0, start, [start(1) stop(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{1},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{1}, 0, start, [start(1) stop(2) stop(3)] );
for nd = 1:3
pos = 2*nd-1;
if (directions(pos))
l_start = start;
l_stop = stop;
l_stop(nd) = start(nd);
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{pos},'DumpType',dump_type,'DumpMode',2,'FileType',1,add_args{:}), nf2ff.filenames_E{pos}, 0, l_start, l_stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{pos},'DumpType',dump_type+1,'DumpMode',2,'FileType',1,add_args{:}), nf2ff.filenames_H{pos}, 0, l_start, l_stop );
else
nf2ff.filenames_E{pos}='';
nf2ff.filenames_H{pos}='';
end
pos = 2*nd;
if (directions(pos))
l_start = start;
l_stop = stop;
l_start(nd) = stop(nd);
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{pos},'DumpType',dump_type,'DumpMode',2,'FileType',1,add_args{:}), nf2ff.filenames_E{pos}, 0, l_start, l_stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{pos},'DumpType',dump_type+1,'DumpMode',2,'FileType',1,add_args{:}), nf2ff.filenames_H{pos}, 0, l_start, l_stop );
else
nf2ff.filenames_E{pos}='';
nf2ff.filenames_H{pos}='';
end
end
if (directions(2))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{2},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{2}, 0, [stop(1) start(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{2},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{2}, 0, [stop(1) start(2) start(3)], stop );
end
if (directions(3))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{3},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{3}, 0, start, [stop(1) start(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{3},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{3}, 0, start, [stop(1) start(2) stop(3)] );
end
if (directions(4))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{4},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{4}, 0, [start(1) stop(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{4},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{4}, 0, [start(1) stop(2) start(3)], stop );
end
if (directions(5))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{5},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{5}, 0, start, [stop(1) stop(2) start(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{5},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{5}, 0, start, [stop(1) stop(2) start(3)] );
end
if (directions(6))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{6},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{6}, 0, [start(1) start(2) stop(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{6},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{6}, 0, [start(1) start(2) stop(3)], stop );
end