38 std::unordered_map<int, int> m_type_index;
40 std::vector<Utils::Vector3d>
44 for (
auto const &p : particles) {
46 auto it = m_type_index.find(p.type());
47 if (
it != m_type_index.end()) {
48 ret[
it->second] += p.force();
55 std::vector<double> local_type_masses(
ParticleRange const &particles)
const {
56 std::vector<double>
ret(m_type_index.size(), 0.);
58 for (
auto const &p : particles) {
60 auto it = m_type_index.find(p.type());
61 if (
it != m_type_index.end()) {
62 ret[
it->second] += p.mass();
77 m_type_index[
p_type] = i++;
82 std::vector<int>
res{};
83 std::ranges::copy(std::views::keys(m_type_index), std::back_inserter(
res));
89 if (m_type_index.empty())
96 std::vector<Utils::Vector3d> forces(m_type_index.size(),
Utils::Vector3d{});
97 std::vector<double>
masses(m_type_index.size(), 0.0);
102 std::plus<Utils::Vector3d>{});
105 std::plus<double>{});
107 for (
auto &p : particles) {
109 auto it = m_type_index.find(p.type());
110 if (
it != m_type_index.end()) {
113 for (
unsigned int i = 0
u; i < 3u; i++) {