31#ifdef FCS_ENABLE_DIPOLES
35Dipoles::Dipoles(MPI_Comm comm, std::string method, std::string parameters)
36 :
Scafacos{comm, std::move(method), std::move(parameters)} {}
38void Dipoles::set_runtime_parameters(
double const *
const box_l,
39 int const *
const periodicity,
40 int const total_particles) {
42 auto const near_field_flag = fcs_int{1};
43 Scafacos::set_runtime_parameters(box_l, periodicity, total_particles,
45 handle_error(fcs_set_total_dipole_particles(m_handle, total_particles));
48void Dipoles::run(std::vector<double> &dipoles, std::vector<double> &positions,
49 std::vector<double> &fields,
50 std::vector<double> &potentials) {
52 assert(dipoles.size() % 3ul == 0ul);
54 fields.resize(2ul * dipoles.size());
55 potentials.resize(dipoles.size());
57 auto const n_part =
static_cast<int>(dipoles.size() / 3ul);
58 handle_error(fcs_set_dipole_particles(m_handle, n_part, positions.data(),
59 dipoles.data(), fields.data(),
61 handle_error(fcs_run(m_handle, 0,
nullptr,
nullptr,
nullptr,
nullptr));
#define handle_error(stmt)