19#ifndef OBSERVABLES_DENSITYPROFILE_HPP
20#define OBSERVABLES_DENSITYPROFILE_HPP
25#include "system/System.hpp"
43 using pos_type =
decltype(
traits.position(std::declval<Particle>()));
46 std::vector<pos_type> local_folded_positions{};
47 local_folded_positions.reserve(local_particles.size());
49 for (
auto const &p : local_particles) {
50 local_folded_positions.emplace_back(
51 box_geo.folded_position(
traits.position(p)));
54 auto const global_folded_positions =
55 detail::gather(comm, local_folded_positions);
57 if (comm.rank() != 0) {
63 for (
auto const &vec : global_folded_positions) {
64 for (
auto const &p : vec) {
std::vector< double > evaluate(boost::mpi::communicator const &comm, ParticleReferenceRange const &local_particles, const ParticleObservables::traits< Particle > &traits) const override
PidProfileObservable(std::vector< int > const &ids, int n_x_bins, int n_y_bins, int n_z_bins, double min_x, double max_x, double min_y, double max_y, double min_z, double max_z)
std::shared_ptr< BoxGeometry > box_geo
Histogram in Cartesian coordinates.
virtual void normalize()
Normalize histogram.
std::vector< T > get_histogram() const
Get the histogram data.
void update(std::span< const U > pos)
Add data to the histogram.
std::vector< std::reference_wrapper< Particle const > > ParticleReferenceRange