46 if (
name ==
"count_number_of_particles_per_type") {
47 auto const &cs = m_cell_system->get_cell_structure();
49 std::vector<int> local_numbers;
50 std::vector<int> global_numbers(types.size());
52 for (
auto const &type : types) {
54 throw std::runtime_error(
"Types may not be negative");
57 for (
auto const &p : cs.local_particles()) {
58 if (p.type() == type) {
62 local_numbers.emplace_back(counter);
65 boost::mpi::reduce(
context()->get_comm(), local_numbers, global_numbers,
67 return global_numbers;
69 if (
name ==
"single_update") {
73 auto const &cs = m_cell_system->get_cell_structure();
74 auto const *p = cs.get_local_particle(pid);
75 if (p !=
nullptr and p->is_ghost()) {
79 if (
context()->is_head_node()) {
88 for (
auto const &[param_name, value] :
89 std::map<std::string, Variant>(properties.begin(), properties.end())) {
94 if (
name ==
"batch_update") {
97 for (
int pid : pids) {
99 for (
auto const &[param_name, value] : std::map<std::string, Variant>(
100 properties.begin(), properties.end())) {
106 if (
name ==
"delete_particle") {
111 if (
name ==
"delete_particles") {
113 for (
int pid : pids) {
120 if (
context()->is_head_node()) {
121 throw std::runtime_error(
"unknown method '" +
name +
"'");
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
virtual boost::mpi::communicator const & get_comm() const =0