MCPcopy Create free account
hub / github.com/NanoComp/meep / integrate_chunkloop

Function integrate_chunkloop

src/integrate2.cpp:52–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52static void integrate_chunkloop(fields_chunk *fc, int ichunk, component cgrid, ivec is, ivec ie,
53 vec s0, vec s1, vec e0, vec e1, double dV0, double dV1, ivec shift,
54 complex<double> shift_phase, const symmetry &S, int sn,
55 void *data_) {
56 (void)ichunk; // unused
57 integrate_data *data = (integrate_data *)data_;
58 ptrdiff_t *off = data->offsets;
59 component *cS = data->cS;
60 complex<realnum> *fvals = data->fvals;
61 complex<double> *ph = data->ph;
62 complex<long double> sum = 0.0;
63 double maxabs = 0;
64 const component *iecs = data->inveps_cs;
65 const direction *ieds = data->inveps_ds;
66 ptrdiff_t ieos[6];
67 const component *imcs = data->invmu_cs;
68 const direction *imds = data->invmu_ds;
69 int num_fvals1 = data->num_fvals;
70 int num_fvals2 = data->num_fvals2;
71 ptrdiff_t imos[6];
72 const fields_chunk *fc2 = data->fields2->chunks[ichunk];
73
74 for (int i = 0; i < num_fvals1; ++i) {
75 cS[i] = S.transform(data->components[i], -sn);
76 if (cS[i] == Dielectric || cS[i] == Permeability)
77 ph[i] = 1.0;
78 else {
79 if (cgrid == Centered) fc->gv.yee2cent_offsets(cS[i], off[2 * i], off[2 * i + 1]);
80 ph[i] = shift_phase * S.phase_shift(cS[i], sn);
81 }
82 }
83 for (int i = 0; i < num_fvals2; ++i) {
84 int j = i + num_fvals1;
85 cS[j] = S.transform(data->components2[i], -sn);
86 if (cS[j] == Dielectric || cS[j] == Permeability)
87 ph[j] = 1.0;
88 else {
89 if (cgrid == Centered) fc->gv.yee2cent_offsets(cS[j], off[2 * j], off[2 * j + 1]);
90 ph[j] = shift_phase * S.phase_shift(cS[j], sn);
91 }
92 }
93 for (int k = 0; k < data->ninveps; ++k)
94 fc->gv.yee2cent_offsets(iecs[k], ieos[2 * k], ieos[2 * k + 1]);
95 for (int k = 0; k < data->ninvmu; ++k)
96 fc->gv.yee2cent_offsets(imcs[k], imos[2 * k], imos[2 * k + 1]);
97
98 vec rshift(shift * (0.5 * fc->gv.inva));
99 LOOP_OVER_IVECS(fc->gv, is, ie, idx) {
100 IVEC_LOOP_LOC(fc->gv, loc);
101 loc = S.transform(loc, sn) + rshift;
102
103 for (int i = 0; i < data->num_fvals; ++i) {
104 if (cS[i] == Dielectric) {
105 double tr = 0.0;
106 for (int k = 0; k < data->ninveps; ++k) {
107 const realnum *ie = fc->s->chi1inv[iecs[k]][ieds[k]];
108 if (ie)
109 tr += (ie[idx] + ie[idx + ieos[2 * k]] + ie[idx + ieos[1 + 2 * k]] +

Callers

nothing calls this directly

Calls 6

absFunction · 0.85
yee2cent_offsetsMethod · 0.80
phase_shiftMethod · 0.80
LOOP_OVER_IVECSFunction · 0.70
maxFunction · 0.70
transformMethod · 0.45

Tested by

no test coverage detected