-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathemtools.mw
102 lines (80 loc) · 3.29 KB
/
emtools.mw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
%
% EM intergral equation tools (from the FMPS Software, Version 3.0)
%
% Copyright (C) 2009-2012 Leslie Greengard and Zydrunas Gimbutas.
% All rights reserved.
%
@function [U]=em3dpartdirect(zk,nsource,source,ifcjvec,cjvec,ifcmvec,cmvec,ifevec,ifhvec,ntarget,target,ifevectarg,ifhvectarg)
%EM3DPARTDIRECT Maxwell dipole interactions in R^3, direct evaluation.
%
% Maxwell interactions in R^3: evaluate all pairwise dipole
% interactions (ignoring self-interaction) and interactions with targets.
%
if( nargin == 7 )
ifevec = 1;
ifhvec = 1;
ntarget = 0;
target = zeros(3,1);
ifevectarg = 0;
ifhvectarg = 0;
end
if( nargin == 9 )
ntarget = 0;
target = zeros(3,1);
ifevectarg = 0;
ifhvectarg = 0;
end
if( nargin == 11 )
ifevectarg = 1;
ifhvectarg = 1;
end
evec=zeros(3,1)+1i*zeros(3,1);
hvec=zeros(3,1)+1i*zeros(3,1);
evectarg=zeros(3,1)+1i*zeros(3,1);
hvectarg=zeros(3,1)+1i*zeros(3,1);
if( ifevec == 1 ), evec=zeros(3,nsource)+1i*zeros(3,nsource); end;
if( ifhvec == 1 ), hvec=zeros(3,nsource)+1i*zeros(3,nsource); end;
if( ifevectarg == 1 ), evectarg=zeros(3,ntarget)+1i*zeros(3,ntarget); end;
if( ifhvectarg == 1 ), hvectarg=zeros(3,ntarget)+1i*zeros(3,ntarget); end;
# FORTRAN em3dpartdirecttarg(dcomplex[1] zk, int[1] nsource, double[] source, int[1] ifcjvec, dcomplex[] cjvec, int[1] ifcmvec, dcomplex[] cmvec, int[1] ifevec, inout dcomplex[] evec, int[1] ifhvec, inout dcomplex[] hvec, int[1] ntarget, double[] target, int[1] ifevectarg, inout dcomplex[] evectarg, int[1] ifhvectarg, inout dcomplex[] hvectarg);
if( ifevec == 1 ), U.evec=evec; end;
if( ifhvec == 1 ), U.hvec=hvec; end;
if( ifevectarg == 1 ), U.evectarg=evectarg; end;
if( ifhvectarg == 1 ), U.hvectarg=hvectarg; end;
@function [U]=em3dccpartdirect(zk,nsource,source,ifcjvec,cjvec,rho_e,ifcmvec,cmvec,rho_m,ifevec,ifhvec,ntarget,target,ifevectarg,ifhvectarg)
%EM3DCCPARTDIRECT Maxwell particle interactions in R^3, direct evaluation.
%
% Maxwell interactions in R^3: evaluate all pairwise dipole and charge
% interactions (ignoring self-interaction) and interactions with targets.
%
if( nargin == 9 )
ifevec = 1;
ifhvec = 1;
ntarget = 0;
target = zeros(3,1);
ifevectarg = 0;
ifhvectarg = 0;
end
if( nargin == 11 )
ntarget = 0;
target = zeros(3,1);
ifevectarg = 0;
ifhvectarg = 0;
end
if( nargin == 13 )
ifevectarg = 1;
ifhvectarg = 1;
end
evec=zeros(3,1)+1i*zeros(3,1);
hvec=zeros(3,1)+1i*zeros(3,1);
evectarg=zeros(3,1)+1i*zeros(3,1);
hvectarg=zeros(3,1)+1i*zeros(3,1);
if( ifevec == 1 ), evec=zeros(3,nsource)+1i*zeros(3,nsource); end;
if( ifhvec == 1 ), hvec=zeros(3,nsource)+1i*zeros(3,nsource); end;
if( ifevectarg == 1 ), evectarg=zeros(3,ntarget)+1i*zeros(3,ntarget); end;
if( ifhvectarg == 1 ), hvectarg=zeros(3,ntarget)+1i*zeros(3,ntarget); end;
# FORTRAN em3dccpartdirecttarg(dcomplex[1] zk, int[1] nsource, double[] source, int[1] ifcjvec, dcomplex[] cjvec, dcomplex[] rho_e, int[1] ifcmvec, dcomplex[] cmvec, dcomplex[] rho_m, int[1] ifevec, inout dcomplex[] evec, int[1] ifhvec, inout dcomplex[] hvec, int[1] ntarget, double[] target, int[1] ifevectarg, inout dcomplex[] evectarg, int[1] ifhvectarg, inout dcomplex[] hvectarg);
if( ifevec == 1 ), U.evec=evec; end;
if( ifhvec == 1 ), U.hvec=hvec; end;
if( ifevectarg == 1 ), U.evectarg=evectarg; end;
if( ifhvectarg == 1 ), U.hvectarg=hvectarg; end;