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

Method require_source_components

src/fields.cpp:508–528  ·  view source on GitHub ↗

allocate fields for components required by any source on any process ... this is needed after calling the low-level fields::add_srcdata

Source from the content-addressed store, hash-verified

506// allocate fields for components required by any source on any process
507// ... this is needed after calling the low-level fields::add_srcdata
508void fields::require_source_components() {
509 fix_boundary_sources(); // needed if add_srcdata put sources on non-owned points
510
511 int needed[NUM_FIELD_COMPONENTS];
512 memset(needed, 0, sizeof(needed));
513 for (int i = 0; i < num_chunks; i++) {
514 FOR_FIELD_TYPES(ft) {
515 for (const auto &src : chunks[i]->get_sources(ft)) {
516 needed[src.c] = 1;
517 }
518 }
519 }
520 int allneeded[NUM_FIELD_COMPONENTS];
521 am_now_working_on(MpiAllTime);
522 or_to_all(needed, allneeded, NUM_FIELD_COMPONENTS);
523 finished_working();
524
525 bool aniso2d = is_aniso2d();
526 for (int c = 0; c < NUM_FIELD_COMPONENTS; ++c)
527 if (allneeded[c]) _require_component(component(c), aniso2d);
528}
529
530// check if we are in 2d but anisotropy couples xy with z
531bool fields::is_aniso2d() {

Callers 1

add_sourcesMethod · 0.80

Calls 2

or_to_allFunction · 0.85
componentEnum · 0.85

Tested by

no test coverage detected