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
| 74 | TODO: reduce memory usage (bookkeeping seem much harder, though). |
| 75 | */ |
| 76 | bool 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 |
no test coverage detected