|
Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
|
Thread-safe repository for per-frame 1D distribution curves and their ensemble mean. More...
#include <PerFrameDistributionStore.hpp>
Classes | |
| struct | MeanFrameWindow |
Public Types | |
| using | FrameCurveArray = std::array<std::vector<real_t>, METRIC_COUNT> |
| using | FrameCurveGenerator = std::function<FrameCurveArray(std::size_t)> |
Public Member Functions | |
| PerFrameDistributionStore (std::size_t total_frames) | |
| Constructs a store pre-allocated for a specific total frame count. | |
| void | setBins (DistributionMetric metric, std::vector< real_t > bins) |
| Sets the shared bin coordinates for a metric. | |
| void | setMeanCurve (DistributionMetric metric, std::vector< real_t > mean_curve) |
| Sets the ensemble mean curve for a metric. | |
| void | setFrameCurve (DistributionMetric metric, std::size_t frame_idx, std::vector< real_t > curve) |
| Sets the 1D distribution curve for a specific trajectory frame. | |
| std::size_t | getTotalFrames () const noexcept |
| Returns the total trajectory frame count allocated in this store. | |
| bool | hasData (DistributionMetric metric) const noexcept |
| Checks if bins and curves are available for a given metric. | |
| bool | hasFrame (DistributionMetric metric, std::size_t frame_idx) const noexcept |
| Checks if curve data is populated for a specific frame index. | |
| const std::vector< real_t > & | getBins (DistributionMetric metric) const |
| Retrieves the shared bin coordinates for a metric. | |
| const std::vector< real_t > & | getMeanCurve (DistributionMetric metric) const |
| Retrieves the ensemble mean curve for a metric. | |
| const std::vector< real_t > & | getFrameCurve (DistributionMetric metric, std::size_t frame_idx) const |
| Retrieves the curve for a specific frame index. | |
| const MetricCurveData & | getMetricData (DistributionMetric metric) const |
| Retrieves const reference to the full metric curve dataset. | |
| MetricCurveData & | getMetricData (DistributionMetric metric) |
| Retrieves mutable reference to the full metric curve dataset. | |
| void | configureMeanFrames (MeanFrameWindow window) |
| Records the strided [start_frame, start_frame + sample_count * stride) mean window. | |
| void | markFrameInMean (std::size_t frame_idx, bool in_mean=true) |
| Explicitly marks whether a single frame contributed to the ensemble mean. | |
| bool | isFrameInMean (std::size_t frame_idx) const noexcept |
| Queries whether a trajectory frame contributed to the ensemble mean. | |
| void | setFrameGenerator (FrameCurveGenerator generator) |
| Installs an on-demand 1D curve generator for frames outside the initial mean range. | |
| void | clearFrameGenerator () noexcept |
| Detaches any active lazy frame generator. | |
| 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. | |
| void | ensureFrame (std::size_t frame_idx) const |
| Lazily computes and caches missing 1D curves for frame_idx if a generator is attached. | |
Static Public Attributes | |
| static constexpr std::size_t | METRIC_COUNT = 4 |
Private Member Functions | |
| bool | needsFrameGenerationUnlocked (std::size_t frame_idx) const noexcept |
Static Private Member Functions | |
| static std::size_t | toIndex (DistributionMetric metric) noexcept |
Private Attributes | |
| std::shared_mutex | mutex_ |
| std::mutex | generation_mutex_ |
| std::size_t | total_frames_ {0} |
| std::array< MetricCurveData, METRIC_COUNT > | metrics_ |
| bool | has_explicit_mean_mask_ {false} |
| std::vector< uint8_t > | in_mean_mask_ |
| FrameCurveGenerator | frame_generator_ |
Static Private Attributes | |
| static const std::vector< real_t > | EMPTY_CURVE {} |
Thread-safe repository for per-frame 1D distribution curves and their ensemble mean.
Designed to provide ultra-low latency scrub playback in 3D viewers. Holds compact 1D curves (~2.5 KB per frame) without retaining heavy 3D structures or partial matrices.
| using correlation::analysis::PerFrameDistributionStore::FrameCurveArray = std::array<std::vector<real_t>, METRIC_COUNT> |
| using correlation::analysis::PerFrameDistributionStore::FrameCurveGenerator = std::function<FrameCurveArray(std::size_t)> |
|
explicit |
Constructs a store pre-allocated for a specific total frame count.
| [in] | total_frames | Total number of frames across the full trajectory. |

|
noexcept |
Detaches any active lazy frame generator.
| void correlation::analysis::PerFrameDistributionStore::configureMeanFrames | ( | MeanFrameWindow | window | ) |
Records the strided [start_frame, start_frame + sample_count * stride) mean window.
| [in] | window | Sampled frame window parameters accumulated into the mean. |
| void correlation::analysis::PerFrameDistributionStore::ensureFrame | ( | std::size_t | frame_idx | ) | const |
Lazily computes and caches missing 1D curves for frame_idx if a generator is attached.
| [in] | frame_idx | Zero-based trajectory frame index. |

|
nodiscard |
Retrieves the shared bin coordinates for a metric.
| [in] | metric | Target distribution identifier. |

|
nodiscard |
Retrieves the curve for a specific frame index.
| [in] | metric | Target distribution identifier. |
| [in] | frame_idx | Zero-based trajectory frame index. |

|
nodiscard |
Retrieves the ensemble mean curve for a metric.
| [in] | metric | Target distribution identifier. |

|
nodiscard |
Retrieves mutable reference to the full metric curve dataset.
| [in] | metric | Target distribution identifier. |

|
nodiscard |
Retrieves const reference to the full metric curve dataset.
| [in] | metric | Target distribution identifier. |

|
nodiscardnoexcept |
Returns the total trajectory frame count allocated in this store.
|
nodiscardnoexcept |
Checks if bins and curves are available for a given metric.
| [in] | metric | Target distribution identifier. |

|
nodiscardnoexcept |
Checks if curve data is populated for a specific frame index.
| [in] | metric | Target distribution identifier. |
| [in] | frame_idx | Zero-based trajectory frame index. |

|
nodiscardnoexcept |
Queries whether a trajectory frame contributed to the ensemble mean.
| [in] | frame_idx | Zero-based trajectory frame index. |
| void correlation::analysis::PerFrameDistributionStore::markFrameInMean | ( | std::size_t | frame_idx, |
| bool | in_mean = true ) |
Explicitly marks whether a single frame contributed to the ensemble mean.
| [in] | frame_idx | Zero-based trajectory frame index. |
| [in] | in_mean | True if included in ensemble mean. |
|
nodiscardnoexcept |
Checks whether any metric with a populated mean curve is missing a curve for frame_idx.
| [in] | frame_idx | Zero-based trajectory frame index. |

|
nodiscardprivatenoexcept |

| void correlation::analysis::PerFrameDistributionStore::setBins | ( | DistributionMetric | metric, |
| std::vector< real_t > | bins ) |
Sets the shared bin coordinates for a metric.
| [in] | metric | Target distribution identifier. |
| [in] | bins | Bin values along the x-axis. |

| void correlation::analysis::PerFrameDistributionStore::setFrameCurve | ( | DistributionMetric | metric, |
| std::size_t | frame_idx, | ||
| std::vector< real_t > | curve ) |
Sets the 1D distribution curve for a specific trajectory frame.
| [in] | metric | Target distribution identifier. |
| [in] | frame_idx | Zero-based trajectory frame index. |
| [in] | curve | Normalized 1D curve values for the frame. |

| void correlation::analysis::PerFrameDistributionStore::setFrameGenerator | ( | FrameCurveGenerator | generator | ) |
Installs an on-demand 1D curve generator for frames outside the initial mean range.
| [in] | generator | Callback computing [RDF, PAD, SQ, XRD] curves for a given frame index. |
| void correlation::analysis::PerFrameDistributionStore::setMeanCurve | ( | DistributionMetric | metric, |
| std::vector< real_t > | mean_curve ) |
Sets the ensemble mean curve for a metric.
| [in] | metric | Target distribution identifier. |
| [in] | mean_curve | Normalized mean curve values. |

|
staticnodiscardprivatenoexcept |

|
staticprivate |
|
private |
|
mutableprivate |
|
private |
|
private |
|
staticconstexpr |
|
mutableprivate |
|
mutableprivate |
|
private |