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

Function array_to_fields

src/cw_fields.cpp:47–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47static void array_to_fields(const complex<realnum> *x, fields &f) {
48 size_t ix = 0;
49 for (int i = 0; i < f.num_chunks; i++)
50 if (f.chunks[i]->is_mine()) FOR_COMPONENTS(c) {
51 if (is_D(c) || is_B(c)) {
52 realnum *fr, *fi;
53#define COPY_TO_FIELD(fld) \
54 if ((fr = f.chunks[i]->fld[0]) && (fi = f.chunks[i]->fld[1])) \
55 LOOP_OVER_VOL_OWNED(f.chunks[i]->gv, c, idx) { \
56 fr[idx] = real(x[ix]); \
57 fi[idx] = imag(x[ix++]); \
58 }
59 COPY_TO_FIELD(f[c]);
60 COPY_TO_FIELD(f_u[c]);
61 COPY_TO_FIELD(f_cond[c]);
62 COPY_TO_FIELD(f_bfast[c]);
63 component c2 = field_type_component(is_D(c) ? E_stuff : H_stuff, c);
64 COPY_TO_FIELD(f_w[c2]);
65 if (f.chunks[i]->f_w[c2][0]) COPY_TO_FIELD(f[c2]);
66#undef COPY_TO_FIELD
67 }
68 }
69
70 f.step_boundaries(D_stuff);
71 f.update_eh(E_stuff, true);
72 f.step_boundaries(E_stuff);
73
74 /* done in f.step before updating D:
75 f.step_boundaries(B_stuff);
76 f.update_eh(H_stuff);
77 f.step_boundaries(H_stuff); */
78}
79
80typedef struct {
81 size_t n;

Callers 2

fieldopFunction · 0.85
solve_cwMethod · 0.85

Calls 7

is_DFunction · 0.85
is_BFunction · 0.85
field_type_componentFunction · 0.85
step_boundariesMethod · 0.80
update_ehMethod · 0.80
FOR_COMPONENTSFunction · 0.70
is_mineMethod · 0.45

Tested by

no test coverage detected