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

Method phase_shift

src/vec.cpp:1347–1369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1345}
1346
1347complex<double> symmetry::phase_shift(component c, int n) const {
1348 if (c == Dielectric || c == Permeability || c == NO_COMPONENT) return 1.0;
1349 complex<double> phase = transform(component_direction(c), n).phase;
1350 // flip tells us if we need to flip the sign. For vectors (E), it is
1351 // just this simple:
1352 bool flip = transform(component_direction(c), n).flipped;
1353 if (is_magnetic(c) || is_B(c)) {
1354 // Because H is a pseudovector, here we have to figure out if the
1355 // transformation changes the handedness of the basis.
1356 bool have_one = false, have_two = false;
1357 FOR_DIRECTIONS(d) {
1358 if (transform(d, n).flipped) flip = !flip;
1359 int shift = (transform(d, n).d - d + 6) % 3;
1360 if (shift == 1) have_one = true;
1361 if (shift == 2) have_two = true;
1362 }
1363 if (have_one && have_two) flip = !flip;
1364 }
1365 if (flip)
1366 return -phase;
1367 else
1368 return phase;
1369}
1370
1371complex<double> symmetry::phase_shift(derived_component c, int n) const {
1372 if (is_poynting(c)) {

Callers 12

get_fieldMethod · 0.80
add_dft_chunkloopFunction · 0.80
integrate_chunkloopFunction · 0.80
h5_output_chunkloopFunction · 0.80
integrate_chunkloopFunction · 0.80
stress_chunkloopFunction · 0.80
stress_chunkloop_blochFunction · 0.80
check_2dFunction · 0.80
check_3dFunction · 0.80

Calls 7

component_directionFunction · 0.85
is_magneticFunction · 0.85
is_BFunction · 0.85
is_poyntingFunction · 0.85
is_derivedFunction · 0.85
derived_componentEnum · 0.85
componentEnum · 0.85

Tested by 2

check_2dFunction · 0.64
check_3dFunction · 0.64