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

Method structure_chunk

src/structure.cpp:709–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709structure_chunk::structure_chunk(const structure_chunk *o) : v(o->v) {
710 refcount = 1;
711
712 FOR_FIELD_TYPES(ft) {
713 {
714 susceptibility *cur = NULL;
715 chiP[ft] = NULL;
716 for (const susceptibility *ocur = o->chiP[ft]; ocur; ocur = ocur->next) {
717 if (cur) {
718 cur->next = ocur->clone();
719 cur = cur->next;
720 }
721 else { chiP[ft] = cur = ocur->clone(); }
722 cur->next = NULL;
723 }
724 }
725 }
726 a = o->a;
727 Courant = o->Courant;
728 dt = o->dt;
729 gv = o->gv;
730 the_proc = o->the_proc;
731 the_is_mine = my_rank() == n_proc();
732 cost = o->cost;
733 FOR_COMPONENTS(c) {
734 if (is_mine() && o->chi3[c]) {
735 chi3[c] = new realnum[gv.ntot()];
736 if (chi3[c] == NULL) meep::abort("Out of memory!\n");
737 for (size_t i = 0; i < gv.ntot(); i++)
738 chi3[c][i] = o->chi3[c][i];
739 }
740 else { chi3[c] = NULL; }
741 if (is_mine() && o->chi2[c]) {
742 chi2[c] = new realnum[gv.ntot()];
743 if (chi2[c] == NULL) meep::abort("Out of memory!\n");
744 for (size_t i = 0; i < gv.ntot(); i++)
745 chi2[c][i] = o->chi2[c][i];
746 }
747 else { chi2[c] = NULL; }
748 }
749 FOR_COMPONENTS(c) FOR_DIRECTIONS(d) { trivial_chi1inv[c][d] = true; }
750 FOR_COMPONENTS(c) FOR_DIRECTIONS(d) {
751 if (is_mine()) {
752 trivial_chi1inv[c][d] = o->trivial_chi1inv[c][d];
753 if (o->chi1inv[c][d]) {
754 chi1inv[c][d] = new realnum[gv.ntot()];
755 memcpy(chi1inv[c][d], o->chi1inv[c][d], gv.ntot() * sizeof(realnum));
756 }
757 else
758 chi1inv[c][d] = NULL;
759 if (o->conductivity[c][d]) {
760 conductivity[c][d] = new realnum[gv.ntot()];
761 memcpy(conductivity[c][d], o->conductivity[c][d], gv.ntot() * sizeof(realnum));
762 condinv[c][d] = new realnum[gv.ntot()];
763 memcpy(condinv[c][d], o->condinv[c][d], gv.ntot() * sizeof(realnum));
764 }
765 else
766 conductivity[c][d] = condinv[c][d] = NULL;

Callers

nothing calls this directly

Calls 5

my_rankFunction · 0.85
num_directionMethod · 0.80
surroundingsMethod · 0.80
FOR_COMPONENTSFunction · 0.70
FOR_DIRECTIONSFunction · 0.70

Tested by

no test coverage detected