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

Method add_srcdata

src/sources.cpp:314–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314void fields::add_srcdata(struct sourcedata cur_data, src_time *src, size_t n,
315 std::complex<double> *amp_arr, bool needs_boundary_fix) {
316 if (n == 0) {
317 n = cur_data.idx_arr.size();
318 assert(amp_arr == NULL);
319 amp_arr = cur_data.amp_arr.data();
320 }
321 assert(n == cur_data.idx_arr.size());
322 sources = src->add_to(sources, &src);
323 std::vector<ptrdiff_t> index_arr(cur_data.idx_arr);
324 std::vector<std::complex<double> > amplitudes(amp_arr, amp_arr + n);
325 component c = cur_data.near_fd_comp;
326 field_type ft = is_H_or_B(c) ? B_stuff : D_stuff;
327 if (0 > cur_data.fc_idx or cur_data.fc_idx >= num_chunks)
328 meep::abort("fields chunk index out of range");
329 fields_chunk *fc = chunks[cur_data.fc_idx];
330 if (!fc->is_mine()) meep::abort("wrong fields chunk");
331
332 fc->add_source(ft,
333 src_vol(c, src, std::move(index_arr), std::move(amplitudes), needs_boundary_fix));
334 // We can't do require_component(c) since that only works if all processes are adding
335 // srcdata for the same components in the same order, which may not be true.
336 // ... instead, the caller should call fields::require_source_components()
337 // after all add_srcdata calls are complete.
338}
339
340static double *amp_func_data_re = NULL;
341static double *amp_func_data_im = NULL;

Callers 1

add_sourceMethod · 0.80

Calls 6

is_H_or_BFunction · 0.85
abortFunction · 0.85
add_toMethod · 0.80
src_volClass · 0.70
is_mineMethod · 0.45
add_sourceMethod · 0.45

Tested by

no test coverage detected