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

Method needs_P

src/susceptibility.cpp:76–82  ·  view source on GitHub ↗

Return whether or not we need to allocate P[c][cmp]. (We don't need to allocate P[c] if we can be sure it will be zero.) We are a bit wasteful because if sigma is nontrivial in *any* chunk, we allocate the corresponding P on *every* owned chunk. This greatly simplifies communication in boundaries.cpp, because we can be sure that one chunk has a P then any chunk it borders has the

Source from the content-addressed store, hash-verified

74 TODO: reduce memory usage (bookkeeping seem much harder, though).
75*/
76bool susceptibility::needs_P(component c, int cmp, realnum *W[NUM_FIELD_COMPONENTS][2]) const {
77 if (!is_electric(c) && !is_magnetic(c)) return false;
78 FOR_DIRECTIONS(d) {
79 if (!trivial_sigma[c][d] && W[direction_component(c, d)][cmp]) return true;
80 }
81 return false;
82}
83
84/* return whether we need the notowned parts of the W field --
85 by default, this is only the case if sigma has offdiagonal components

Callers 1

FOR_FT_COMPONENTSFunction · 0.80

Calls 2

is_electricFunction · 0.85
is_magneticFunction · 0.85

Tested by

no test coverage detected