| 312 | } |
| 313 | |
| 314 | void 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 | |
| 340 | static double *amp_func_data_re = NULL; |
| 341 | static double *amp_func_data_im = NULL; |
no test coverage detected