34 :
Scafacos{comm, std::move(method), std::move(parameters)} {
35 fcs_int near_field_delegation;
36 fcs_get_near_field_delegation(
m_handle, &near_field_delegation);
37 m_method_can_delegate_near_field =
static_cast<bool>(near_field_delegation);
38 m_delegate_near_field = m_method_can_delegate_near_field;
42 int const *
const periodicity,
43 int const total_particles) {
44 auto const near_field_flag = get_near_field_flag();
50 if (delegate != m_delegate_near_field) {
51 if (delegate and not m_method_can_delegate_near_field) {
52 throw std::runtime_error(
"Method '" +
get_method() +
53 "' cannot delegate short-range calculation");
55 m_delegate_near_field = delegate;
56 auto const near_field_flag = get_near_field_flag();
62 if (m_delegate_near_field) {
71 if (m_delegate_near_field) {
76void Coulomb::run(std::vector<double> &charges, std::vector<double> &positions,
77 std::vector<double> &fields,
78 std::vector<double> &potentials) {
80 auto const n_part = charges.size();
81 fields.resize(3ul * n_part);
82 potentials.resize(n_part);
84 tune(charges, positions);
85 auto const size =
static_cast<int>(n_part);
87 fields.data(), potentials.data()));
91 std::vector<double> &positions) {
92 auto const n_part = charges.size();
93 auto const size =
static_cast<int>(n_part);
#define handle_error(stmt)
void run(std::vector< double > &charges, std::vector< double > &positions, std::vector< double > &fields, std::vector< double > &potentials)
Calculate the fields and potentials for charges.
void set_near_field_delegation(bool delegate)
Delegate the short-range calculation.
void tune(std::vector< double > &charges, std::vector< double > &positions)
Tune parameters.
void set_r_cut(double r_cut)
Set short-range cutoff.
Coulomb(MPI_Comm comm, std::string method, std::string parameters)
double r_cut() const
Get short-range cutoff (0.0 if not supported by the method).
void set_runtime_parameters(double const *box_l, int const *periodicity, int total_particles)
Set box geometry and number of particles.
void set_runtime_parameters(double const *box_l, int const *periodicity, int total_particles, int near_field_flag)
Set box geometry, number of particles and calculation type.
std::string get_method() const
Get active method name.
FCS m_handle
Handle from the library.