Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::AnalysisDispatcher Class Reference

Dispatches analysis workflows to CorrelationEngine, handles cancellation, and exports data. More...

#include <AnalysisDispatcher.hpp>

Collaboration diagram for correlation::app::AnalysisDispatcher:

Public Types

using ProgressCallback = std::function<void(float, const std::string &)>

Public Member Functions

 AnalysisDispatcher ()=default
 ~AnalysisDispatcher ()
 AnalysisDispatcher (const AnalysisDispatcher &)=delete
AnalysisDispatcher & operator= (const AnalysisDispatcher &)=delete
 AnalysisDispatcher (AnalysisDispatcher &&)=delete
AnalysisDispatcher & operator= (AnalysisDispatcher &&)=delete
std::expected< void, std::string > runAnalysis (correlation::core::Trajectory *trajectory, const ProgramOptions &options)
 Executes analysis for the given trajectory and options.
std::expected< void, std::string > runAnalysis (correlation::core::Trajectory &trajectory, const ProgramOptions &options)
 Executes analysis for the given trajectory reference and options.
std::expected< void, std::string > runFastPreviewRDF (correlation::core::Trajectory *trajectory, const ProgramOptions &options)
 Executes a rapid single-frame RDF calculation for fast live calibration preview.
std::expected< void, std::string > runSelectiveRecalculation (correlation::core::Trajectory *trajectory, const ProgramOptions &options)
 Selectively recalculates only bond-dependent algorithms when bond cutoffs change. Preserves already calculated distance-based distributions (RDF, S(Q), XRD) and dynamic properties. If no previous results exist, falls back to full analysis.
std::expected< void, std::string > runSelectiveRecalculation (correlation::core::Trajectory &trajectory, const ProgramOptions &options)
 Selectively recalculates only bond-dependent algorithms when bond cutoffs change.
std::expected< void, std::string > writeFiles (const ProgramOptions &options) const
 Writes analytical results to disk (CSV, HDF5, Parquet).
void cancelAnalysis () noexcept
 Signals running analysis to abort at next cancellation checkpoint.
bool isCancelled () const noexcept
 Checks if cancellation was requested.
void setProgressCallback (ProgressCallback callback)
 Sets progress notification hook.
std::vector< std::string > getAvailableHistogramNames () const
 Gets all available histogram names from last completed analysis.
const correlation::analysis::Histogram * getHistogram (const std::string &name) const
 Retrieves a specific analytical histogram by name.
const std::map< std::string, correlation::analysis::Histogram > & getHistograms () const
 Retrieves all analytical histograms from last run.
std::map< std::string, real_t > getAshcroftWeights () const
 Retrieves Ashcroft-Langreth weights for partial structure factors.
const correlation::analysis::DistributionFunctions * getDistributionFunctions () const noexcept
 Returns active DistributionFunctions pointer.
void setDistributionFunctions (std::unique_ptr< correlation::analysis::DistributionFunctions > distribution_functions) noexcept
 Injects an existing DistributionFunctions container (useful for testing).
void clear () noexcept
 Clears current results.
void bindPerFrameTrajectory (std::shared_ptr< const correlation::core::Trajectory > trajectory)
 Attaches a shared trajectory to lazily populate out-of-range 1D frame curves on demand.
void startPerFramePrebake (std::shared_ptr< const correlation::core::Trajectory > trajectory, std::function< void()> on_complete=nullptr)
 Starts a cancellable background worker to pre-bake remaining 1D per-frame curves.
void stopPerFramePrebake () noexcept
 Stops and joins any running per-frame pre-bake worker thread.

Static Public Member Functions

static bool isBondDependentCalculator (std::string_view calc_id) noexcept
 Queries whether a calculator depends on bond cutoffs.
static std::vector< std::string > getBondDependentCalculatorNames ()
 Gets all canonical calculator names that depend on bond cutoffs.
static std::expected< void, std::string > validateOptions (const ProgramOptions &options)
 Validates analysis configuration before execution.

Private Attributes

std::shared_mutex df_mutex_
std::unique_ptr< correlation::analysis::DistributionFunctions > df_
correlation::analysis::AnalysisSettings last_settings_ {}
correlation::analysis::BondCutoffMatrix last_bond_cutoffs_ {}
std::atomic< bool > cancel_flag_ {false}
std::atomic< bool > prebake_cancel_ {false}
std::jthread prebake_thread_
ProgressCallback progress_callback_

Detailed Description

Dispatches analysis workflows to CorrelationEngine, handles cancellation, and exports data.

Member Typedef Documentation

◆ ProgressCallback

using correlation::app::AnalysisDispatcher::ProgressCallback = std::function<void(float, const std::string &)>

Constructor & Destructor Documentation

◆ AnalysisDispatcher() [1/3]

correlation::app::AnalysisDispatcher::AnalysisDispatcher ( )
default
Here is the caller graph for this function:

◆ ~AnalysisDispatcher()

correlation::app::AnalysisDispatcher::~AnalysisDispatcher ( )
Here is the call graph for this function:

◆ AnalysisDispatcher() [2/3]

correlation::app::AnalysisDispatcher::AnalysisDispatcher ( const AnalysisDispatcher & )
delete
Here is the call graph for this function:

◆ AnalysisDispatcher() [3/3]

correlation::app::AnalysisDispatcher::AnalysisDispatcher ( AnalysisDispatcher && )
delete
Here is the call graph for this function:

Member Function Documentation

◆ bindPerFrameTrajectory()

void correlation::app::AnalysisDispatcher::bindPerFrameTrajectory ( std::shared_ptr< const correlation::core::Trajectory > trajectory)

Attaches a shared trajectory to lazily populate out-of-range 1D frame curves on demand.

Parameters
[in]trajectoryShared pointer to active trajectory.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelAnalysis()

void correlation::app::AnalysisDispatcher::cancelAnalysis ( )
inlinenoexcept

Signals running analysis to abort at next cancellation checkpoint.

◆ clear()

void correlation::app::AnalysisDispatcher::clear ( )
noexcept

Clears current results.

Here is the call graph for this function:

◆ getAshcroftWeights()

std::map< std::string, real_t > correlation::app::AnalysisDispatcher::getAshcroftWeights ( ) const
nodiscard

Retrieves Ashcroft-Langreth weights for partial structure factors.

◆ getAvailableHistogramNames()

std::vector< std::string > correlation::app::AnalysisDispatcher::getAvailableHistogramNames ( ) const
nodiscard

Gets all available histogram names from last completed analysis.

◆ getBondDependentCalculatorNames()

std::vector< std::string > correlation::app::AnalysisDispatcher::getBondDependentCalculatorNames ( )
staticnodiscard

Gets all canonical calculator names that depend on bond cutoffs.

Returns
Vector of canonical calculator name strings.

◆ getDistributionFunctions()

const correlation::analysis::DistributionFunctions * correlation::app::AnalysisDispatcher::getDistributionFunctions ( ) const
inlinenodiscardnoexcept

Returns active DistributionFunctions pointer.

◆ getHistogram()

const correlation::analysis::Histogram * correlation::app::AnalysisDispatcher::getHistogram ( const std::string & name) const
nodiscard

Retrieves a specific analytical histogram by name.

◆ getHistograms()

const std::map< std::string, correlation::analysis::Histogram > & correlation::app::AnalysisDispatcher::getHistograms ( ) const
nodiscard

Retrieves all analytical histograms from last run.

◆ isBondDependentCalculator()

bool correlation::app::AnalysisDispatcher::isBondDependentCalculator ( std::string_view calc_id)
staticnodiscardnoexcept

Queries whether a calculator depends on bond cutoffs.

Parameters
[in]calc_idName or abbreviation of calculator.
Returns
True if calculator depends on bond cutoffs, false otherwise.

◆ isCancelled()

bool correlation::app::AnalysisDispatcher::isCancelled ( ) const
inlinenodiscardnoexcept

Checks if cancellation was requested.

◆ operator=() [1/2]

AnalysisDispatcher & correlation::app::AnalysisDispatcher::operator= ( AnalysisDispatcher && )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

AnalysisDispatcher & correlation::app::AnalysisDispatcher::operator= ( const AnalysisDispatcher & )
delete
Here is the call graph for this function:

◆ runAnalysis() [1/2]

std::expected< void, std::string > correlation::app::AnalysisDispatcher::runAnalysis ( correlation::core::Trajectory & trajectory,
const ProgramOptions & options )

Executes analysis for the given trajectory reference and options.

Parameters
[in]trajectorySource trajectory reference with structures to analyze.
[in]optionsAnalytical configuration parameters.
Returns
Success or error message.
Here is the call graph for this function:

◆ runAnalysis() [2/2]

std::expected< void, std::string > correlation::app::AnalysisDispatcher::runAnalysis ( correlation::core::Trajectory * trajectory,
const ProgramOptions & options )

Executes analysis for the given trajectory and options.

Parameters
[in]trajectorySource trajectory with structures to analyze.
[in]optionsAnalytical configuration parameters.
Returns
Success or error message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ runFastPreviewRDF()

std::expected< void, std::string > correlation::app::AnalysisDispatcher::runFastPreviewRDF ( correlation::core::Trajectory * trajectory,
const ProgramOptions & options )

Executes a rapid single-frame RDF calculation for fast live calibration preview.

Parameters
[in]trajectorySource trajectory reference with structures to analyze.
[in]optionsAnalytical configuration parameters.
Returns
Success or error message.
Here is the call graph for this function:

◆ runSelectiveRecalculation() [1/2]

std::expected< void, std::string > correlation::app::AnalysisDispatcher::runSelectiveRecalculation ( correlation::core::Trajectory & trajectory,
const ProgramOptions & options )

Selectively recalculates only bond-dependent algorithms when bond cutoffs change.

Parameters
[in]trajectorySource trajectory reference with structures to analyze.
[in]optionsAnalytical configuration parameters with updated bond cutoffs.
Returns
Success or error message.
Here is the call graph for this function:

◆ runSelectiveRecalculation() [2/2]

std::expected< void, std::string > correlation::app::AnalysisDispatcher::runSelectiveRecalculation ( correlation::core::Trajectory * trajectory,
const ProgramOptions & options )

Selectively recalculates only bond-dependent algorithms when bond cutoffs change. Preserves already calculated distance-based distributions (RDF, S(Q), XRD) and dynamic properties. If no previous results exist, falls back to full analysis.

Parameters
[in]trajectorySource trajectory with structures to analyze.
[in]optionsAnalytical configuration parameters with updated bond cutoffs.
Returns
Success or error message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDistributionFunctions()

void correlation::app::AnalysisDispatcher::setDistributionFunctions ( std::unique_ptr< correlation::analysis::DistributionFunctions > distribution_functions)
inlinenoexcept

Injects an existing DistributionFunctions container (useful for testing).

Parameters
distribution_functionsContainer to inject.

◆ setProgressCallback()

void correlation::app::AnalysisDispatcher::setProgressCallback ( ProgressCallback callback)
inline

Sets progress notification hook.

Here is the caller graph for this function:

◆ startPerFramePrebake()

void correlation::app::AnalysisDispatcher::startPerFramePrebake ( std::shared_ptr< const correlation::core::Trajectory > trajectory,
std::function< void()> on_complete = nullptr )

Starts a cancellable background worker to pre-bake remaining 1D per-frame curves.

Parameters
[in]trajectoryShared pointer to active trajectory.
[in]on_completeOptional completion callback.
Here is the call graph for this function:

◆ stopPerFramePrebake()

void correlation::app::AnalysisDispatcher::stopPerFramePrebake ( )
noexcept

Stops and joins any running per-frame pre-bake worker thread.

Here is the caller graph for this function:

◆ validateOptions()

std::expected< void, std::string > correlation::app::AnalysisDispatcher::validateOptions ( const ProgramOptions & options)
staticnodiscard

Validates analysis configuration before execution.

Parameters
[in]optionsOptions to validate.
Returns
Success (void) or error message string.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeFiles()

std::expected< void, std::string > correlation::app::AnalysisDispatcher::writeFiles ( const ProgramOptions & options) const

Writes analytical results to disk (CSV, HDF5, Parquet).

Parameters
[in]optionsConfiguration specifying output formats and destination.
Returns
Success or error message.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cancel_flag_

std::atomic<bool> correlation::app::AnalysisDispatcher::cancel_flag_ {false}
private

◆ df_

std::unique_ptr<correlation::analysis::DistributionFunctions> correlation::app::AnalysisDispatcher::df_
private

◆ df_mutex_

std::shared_mutex correlation::app::AnalysisDispatcher::df_mutex_
mutableprivate

◆ last_bond_cutoffs_

correlation::analysis::BondCutoffMatrix correlation::app::AnalysisDispatcher::last_bond_cutoffs_ {}
private

◆ last_settings_

correlation::analysis::AnalysisSettings correlation::app::AnalysisDispatcher::last_settings_ {}
private

◆ prebake_cancel_

std::atomic<bool> correlation::app::AnalysisDispatcher::prebake_cancel_ {false}
private

◆ prebake_thread_

std::jthread correlation::app::AnalysisDispatcher::prebake_thread_
private

◆ progress_callback_

ProgressCallback correlation::app::AnalysisDispatcher::progress_callback_
private

The documentation for this class was generated from the following files: