Loading...
Searching...
No Matches
Go to the documentation of this file.
17#include "../plask/math.hpp"
19#include "../gauss_legendre.hpp"
20#include "../gauss_laguerre.hpp"
24#define SOLVER static_cast<BesselSolverCyl*>(solver)
26namespace plask {
namespace optical {
namespace modal {
40 throw BadInput(
solver->
getId(),
"outer geometry edge must be 'extend' or a simple material");
58 for (
size_t i = 0; i !=
N; ++i)
kpts[i] = (0.5 +
double(i) *
kdlt);
70 if (
SOLVER->klist.size() !=
N+1)
71 throw BadInput(
SOLVER->getId(),
"if no weights are given, number of manually specified wavevectors must be {}",
73 for (
size_t i = 0; i !=
N; ++i) {
79 throw BadInput(
SOLVER->getId(),
"if weights are given, number of manually specified wavevectors must be {}",
81 if (
SOLVER->kweights->size() !=
N)
82 throw BadInput(
SOLVER->getId(),
"number of manually specified wavevector weights must be {}",
N+1);
84 for (
double& k:
kpts) k *= R;
102 for(
int m = 1;
m <=
M1; ++
m, ++i) {
110 for(
int m = 1;
m <=
M2; ++
m, ++i) {
120 throw BadInput(
SOLVER->getId(),
"for non-uniform wavevectors kmax must be at least {}",
122 for(
int m = 1;
m <=
M3; ++
m, ++i) {
142 dcomplex
ik0 = 1. /
k0;
147 for (
size_t j = 0; j !=
N; ++j) {
150 for (
size_t i = 0; i !=
N; ++i) {
153 dcomplex
gVk = 0.5 *
ik0 * g * eps.V_k(i,j);
163 for (
size_t j = 0; j !=
N; ++j) {
165 for (
size_t i = 0; i !=
N; ++i) {
168 RE(
ip,js) = 0.5 *
k0 * eps.Tps(i,j);
169 RE(
ip,
jp) = 0.5 *
k0 * eps.Tpp(i,j);
170 RE(
is,js) = -0.5 *
k0 * eps.Tss(i,j);
171 RE(
is,
jp) = -0.5 *
k0 * eps.Tsp(i,j);
206 JpJm.reset(
N,
N,
reinterpret_cast<dcomplex*
>(
_tmp.get() + 3*
N));
211 for (
size_t i = 0; i <
N; ++i) {
227 for (
size_t ri = 0;
ri != nr; ++
ri) {
232 for (
size_t i = 0; i <
N; ++i) {
234 Jm[i] = cyl_bessel_j(
m-1,
kr);
235 J[i] = cyl_bessel_j(
m,
kr);
236 Jp[i] = cyl_bessel_j(
m+1,
kr);
238 for (
size_t j = 0; j <
N; ++j) {
241 for (
size_t i = 0; i <
N; ++i) {
251 for (
size_t i = 0; i <
N; ++i) {
269 for (
size_t ri = 0;
ri != nr; ++
ri) {
272 for (
size_t i = 0; i <
N; ++i) {
274 Jm[i] = cyl_bessel_j(
m-1,
kr);
275 Jp[i] = cyl_bessel_j(
m+1,
kr);
277 for (
size_t i = 0; i <
N; ++i) {
279 for (
size_t j = 0; j <
N; ++j) {
287 for (
size_t i = 0; i <
N; ++i) {
307 for (
size_t ri = 0;
ri != nr; ++
ri) {
310 for (
size_t i = 0; i <
N; ++i) {
312 Jm[i] = cyl_bessel_j(
m-1,
kr);
313 Jp[i] = cyl_bessel_j(
m+1,
kr);
315 for (
size_t i = 0; i <
N; ++i) {
317 for (
size_t j = 0; j <
N; ++j) {
323 for (
size_t i = 0; i <
N; ++i) {
338 std::copy_n(
factors,
N,
reinterpret_cast<double*
>(
temp.data()));
352 for (
size_t ri = 0;
ri != nr; ++
ri) {
355 for (
size_t i = 0; i <
N; ++i) {
357 Jm[i] = cyl_bessel_j(
m-1,
kr);
358 Jp[i] = cyl_bessel_j(
m+1,
kr);
360 for (
size_t j = 0; j <
N; ++j) {
361 for (
size_t i = 0; i <
N; ++i) {
370 for (
size_t i = 0; i < 2*
N; ++i) {
375 for (
size_t j = 0; j <
N; ++j) {
377 for (
size_t i = 0; i < j; ++i) {
379 double val =
factors[i] * 2*
m / (k*g) * pow(g/k,
m);
383 double val =
factors[j] *
m / (k*k) - 1.;
388 for (
size_t i = j+1; i <
N; ++i) {
390 double val =
factors[i] * 2*
m / (k*g) * pow(k/g,
m);
395 for (
size_t i = 0; i <
N; ++i)
work(i,i) = 1.;
396 for (
size_t i = 0; i <
N; ++i)
work(i+
N,i+
N) = 1.;
403 for (
size_t j = 0; j <
N; ++j) {
408 zgemm(
'N',
'N',
int(
N),
int(
N),
int(
N), 1.,
JpJm.data(),
int(
N),
work.data()+2*
N*
N,
int(2*
N), 1.,
410 zgemm(
'N',
'N',
int(
N),
int(
N),
int(
N), 1.,
JmJp.data(),
int(
N),
work.data()+
N,
int(2*
N), 1.,
414 for (
size_t ri = 0;
ri != nr; ++
ri) {
417 for (
size_t i = 0; i <
N; ++i) {
419 Jm[i] = cyl_bessel_j(
m-1,
kr);
420 Jp[i] = cyl_bessel_j(
m+1,
kr);
422 for (
size_t i = 0; i <
N; ++i) {
424 for (
size_t j = 0; j <
N; ++j) {
430 for (
size_t i = 0; i <
N; ++i) {
441 for (
size_t ri = 0;
ri != nr; ++
ri) {
444 for (
size_t i = 0; i <
N; ++i) {
446 J[i] = cyl_bessel_j(
m,
kr);
448 for (
size_t j = 0; j <
N; ++j) {
449 for (
size_t i = 0; i <
N; ++i) {
454 for (
size_t i = 0; i <
N; ++i)
work(i,i) +=
dataz0;
458 for (
int i = 0; i <
N; ++i) {