15#include <shared_mutex>
132 std::
size_t frame_idx) const;
166 [[nodiscard]]
bool isFrameInMean(std::
size_t frame_idx) const noexcept;
199 mutable std::array<MetricCurveData, METRIC_COUNT>
metrics_;
Floating point precision type definitions for Correlation.
const std::vector< real_t > & getMeanCurve(DistributionMetric metric) const
Retrieves the ensemble mean curve for a metric.
Definition PerFrameDistributionStore.cpp:112
const std::vector< real_t > & getBins(DistributionMetric metric) const
Retrieves the shared bin coordinates for a metric.
Definition PerFrameDistributionStore.cpp:106
std::array< MetricCurveData, METRIC_COUNT > metrics_
Definition PerFrameDistributionStore.hpp:199
void markFrameInMean(std::size_t frame_idx, bool in_mean=true)
Explicitly marks whether a single frame contributed to the ensemble mean.
Definition PerFrameDistributionStore.cpp:150
std::mutex generation_mutex_
Definition PerFrameDistributionStore.hpp:197
std::vector< uint8_t > in_mean_mask_
Definition PerFrameDistributionStore.hpp:201
bool has_explicit_mean_mask_
Definition PerFrameDistributionStore.hpp:200
bool isFrameInMean(std::size_t frame_idx) const noexcept
Queries whether a trajectory frame contributed to the ensemble mean.
Definition PerFrameDistributionStore.cpp:162
std::function< FrameCurveArray(std::size_t)> FrameCurveGenerator
Definition PerFrameDistributionStore.hpp:54
static std::size_t toIndex(DistributionMetric metric) noexcept
Definition PerFrameDistributionStore.cpp:60
static const std::vector< real_t > EMPTY_CURVE
Definition PerFrameDistributionStore.hpp:203
bool hasData(DistributionMetric metric) const noexcept
Checks if bins and curves are available for a given metric.
Definition PerFrameDistributionStore.cpp:90
std::array< std::vector< real_t >, METRIC_COUNT > FrameCurveArray
Definition PerFrameDistributionStore.hpp:53
void ensureFrame(std::size_t frame_idx) const
Lazily computes and caches missing 1D curves for frame_idx if a generator is attached.
Definition PerFrameDistributionStore.cpp:198
void clearFrameGenerator() noexcept
Detaches any active lazy frame generator.
Definition PerFrameDistributionStore.cpp:178
bool hasFrame(DistributionMetric metric, std::size_t frame_idx) const noexcept
Checks if curve data is populated for a specific frame index.
Definition PerFrameDistributionStore.cpp:96
std::size_t total_frames_
Definition PerFrameDistributionStore.hpp:198
static constexpr std::size_t METRIC_COUNT
Definition PerFrameDistributionStore.hpp:52
const MetricCurveData & getMetricData(DistributionMetric metric) const
Retrieves const reference to the full metric curve dataset.
Definition PerFrameDistributionStore.cpp:127
FrameCurveGenerator frame_generator_
Definition PerFrameDistributionStore.hpp:202
const std::vector< real_t > & getFrameCurve(DistributionMetric metric, std::size_t frame_idx) const
Retrieves the curve for a specific frame index.
Definition PerFrameDistributionStore.cpp:117
std::shared_mutex mutex_
Definition PerFrameDistributionStore.hpp:196
bool needsFrameGenerationUnlocked(std::size_t frame_idx) const noexcept
Definition PerFrameDistributionStore.cpp:183
void setBins(DistributionMetric metric, std::vector< real_t > bins)
Sets the shared bin coordinates for a metric.
Definition PerFrameDistributionStore.cpp:64
std::size_t getTotalFrames() const noexcept
Returns the total trajectory frame count allocated in this store.
Definition PerFrameDistributionStore.cpp:88
void configureMeanFrames(MeanFrameWindow window)
Records the strided [start_frame, start_frame + sample_count * stride) mean window.
Definition PerFrameDistributionStore.cpp:137
bool needsFrameGeneration(std::size_t frame_idx) const noexcept
Checks whether any metric with a populated mean curve is missing a curve for frame_idx.
Definition PerFrameDistributionStore.cpp:193
void setFrameCurve(DistributionMetric metric, std::size_t frame_idx, std::vector< real_t > curve)
Sets the 1D distribution curve for a specific trajectory frame.
Definition PerFrameDistributionStore.cpp:75
void setFrameGenerator(FrameCurveGenerator generator)
Installs an on-demand 1D curve generator for frames outside the initial mean range.
Definition PerFrameDistributionStore.cpp:173
PerFrameDistributionStore(std::size_t total_frames)
Constructs a store pre-allocated for a specific total frame count.
Definition PerFrameDistributionStore.cpp:16
void setMeanCurve(DistributionMetric metric, std::vector< real_t > mean_curve)
Sets the ensemble mean curve for a metric.
Definition PerFrameDistributionStore.cpp:69
Definition AnalysisTypes.hpp:11
DistributionMetric
Identifiers for 1D distributions tracked on a per-frame basis.
Definition PerFrameDistributionStore.hpp:24
@ RDF
Radial Distribution Function g(r).
Definition PerFrameDistributionStore.hpp:25
@ SQ
Structure Factor S(Q).
Definition PerFrameDistributionStore.hpp:27
@ XRD
X-Ray Diffraction Pattern I(2θ).
Definition PerFrameDistributionStore.hpp:28
@ PAD
Planar Angle Distribution θ
Definition PerFrameDistributionStore.hpp:26
double real_t
Definition Precision.hpp:18
Holds 1D curve data for a specific distribution across an entire trajectory.
Definition PerFrameDistributionStore.hpp:34
std::string y_unit
Physical unit for Y axis.
Definition PerFrameDistributionStore.hpp:41
std::string name
Short metric identifier ("g(r)", "PAD", "S(Q)").
Definition PerFrameDistributionStore.hpp:38
std::string x_unit
Physical unit for X axis ("Å", "deg", "Å⁻¹").
Definition PerFrameDistributionStore.hpp:40
std::vector< real_t > bins
X-axis bin positions (shared across frames).
Definition PerFrameDistributionStore.hpp:35
std::vector< real_t > mean_curve
Y-axis ensemble mean curve (from [min_frame, max_frame]).
Definition PerFrameDistributionStore.hpp:36
std::vector< std::vector< real_t > > frame_curves
Y-axis per-frame curves (indexed by frame_idx).
Definition PerFrameDistributionStore.hpp:37
std::string title
Full display title.
Definition PerFrameDistributionStore.hpp:39
Definition PerFrameDistributionStore.hpp:56
std::size_t sample_count
Definition PerFrameDistributionStore.hpp:58
std::size_t start_frame
Definition PerFrameDistributionStore.hpp:57
std::size_t stride
Definition PerFrameDistributionStore.hpp:59