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

Controller class for the application orchestrating services and UI. More...

#include <AppController.hpp>

Collaboration diagram for correlation::app::AppController:

Public Member Functions

Constructors & Methods
 AppController (AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, ProgramOptions &options)
 Constructs the AppController with injected domain services.
 AppController (AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, BondCutoffService &cutoff_service, ProgramOptions &options)
 Constructs the AppController with injected domain services (transitional).
 ~AppController ()
 Destructor. Ensures analysis threads are joined before destruction.
void loadSettings ()
 Loads application layout settings and applies window/column geometry.
void saveSettings () const
 Saves current layout settings and window geometry to disk.
void loadTrajectory (const std::string &filepath, std::function< void(bool)> on_complete=nullptr)
 Loads a structure or trajectory file asynchronously.
void addRecentFile (const std::string &filepath)
 Appends a path to MRU recent files and updates UI.
void runAnalysis ()
 Executes configured analyses on the active trajectory.
ProgramOptions handleOptionsfromUI ()
 Retrieves the current user-selected options from the UI.
void handleOptionstoUI ()
 Populates the UI with options from the backend.
void populateExportAnalyses ()
 Populates the export analyses selection list with computed histograms.
void setBondCutoffs ()
 Updates the UI with the recommended bond cutoffs from the backend.
correlation::analysis::BondCutoffMatrix getBondCutoffs ()
 Parses and retrieves the user-modified bond cutoff matrix from the UI.
void populateCalculatorGroups ()
 Populates the UI calculator groups from CalculatorFactory.
void setCalculatorsEnabled (bool enabled, std::string_view group_filter={})
 Enables or disables every calculator, optionally restricted to a single group.
void setCalculatorGroupsExpanded (bool expanded, std::string_view group_filter={})
 Sets the expansion state of calculator selection sub-trees.
void updateActiveGroupFlags ()
 Updates active group flags in the UI based on active calculators.
void markResultsStaleIfDone () noexcept
 Flags current plot results as stale if an analysis has already completed.
InputValidator * getInputValidator ()
 Returns the InputValidator instance.
PlotController * getPlotController ()
 Returns the PlotController instance.
BondCutoffController & getBondCutoffController ()
 Returns the BondCutoffController instance.
const BondCutoffController & getBondCutoffController () const
 Returns the const BondCutoffController instance.
Structure3DController * getStructure3DController () noexcept
 Returns the Structure3DController instance.

Private Member Functions

bool isCalculatorGroupExpanded (std::string_view group_name, size_t group_index) const
void registerActionCallbacks ()
void registerAnalysesCallbacks ()
void registerPlotCallbacks ()
void registerStructure3DCallbacks ()
void registerCameraCallbacks ()
void registerPhaseSearchCallbacks ()
void handleSelectDualLeftPlot (int idx)
void registerPresetAndOptionCallbacks ()
void registerExportCallbacks ()

Private Attributes

AppWindow & window_
TrajectoryLoader & loader_
AnalysisDispatcher & dispatcher_
ProgramOptions & options_
BondCutoffController bond_cutoff_controller_
std::unique_ptr< AnalysisRunner > analysis_runner_
std::unique_ptr< FileIOHandler > file_io_handler_
std::unique_ptr< InputValidator > input_validator_
std::unique_ptr< PlotController > plot_controller_
std::unique_ptr< PresetController > preset_controller_
std::unique_ptr< Structure3DController > structure_3d_controller_
std::shared_ptr< std::atomic< bool > > alive_ {std::make_shared<std::atomic<bool>>(true)}
std::atomic< bool > export_3d_busy_ {false}
std::jthread export_3d_thread_
AppSettings settings_
std::map< std::string, bool, std::less<> > calculator_group_expanded_

Friends

class ::AppControllerTests

Detailed Description

Controller class for the application orchestrating services and UI.

This class handles the interaction between the User Interface (AppWindow) and domain services (TrajectoryLoader, AnalysisDispatcher, BondCutoffService). It manages event handling, threading for analysis, and data synchronization.

Constructor & Destructor Documentation

◆ AppController() [1/2]

correlation::app::AppController::AppController ( AppWindow & window,
TrajectoryLoader & loader,
AnalysisDispatcher & dispatcher,
ProgramOptions & options )

Constructs the AppController with injected domain services.

Parameters
windowReference to the main application window.
loaderReference to the trajectory loading service.
dispatcherReference to the analysis dispatching service.
optionsReference to application configuration options.

◆ AppController() [2/2]

correlation::app::AppController::AppController ( AppWindow & window,
TrajectoryLoader & loader,
AnalysisDispatcher & dispatcher,
BondCutoffService & cutoff_service,
ProgramOptions & options )

Constructs the AppController with injected domain services (transitional).

Parameters
windowReference to the main application window.
loaderReference to the trajectory loading service.
dispatcherReference to the analysis dispatching service.
cutoff_serviceReference to the bond cutoff service.
optionsReference to application configuration options.

◆ ~AppController()

correlation::app::AppController::~AppController ( )

Destructor. Ensures analysis threads are joined before destruction.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addRecentFile()

void correlation::app::AppController::addRecentFile ( const std::string & filepath)

Appends a path to MRU recent files and updates UI.

Parameters
filepathLoaded file path.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBondCutoffController() [1/2]

BondCutoffController & correlation::app::AppController::getBondCutoffController ( )
inline

Returns the BondCutoffController instance.

◆ getBondCutoffController() [2/2]

const BondCutoffController & correlation::app::AppController::getBondCutoffController ( ) const
inline

Returns the const BondCutoffController instance.

◆ getBondCutoffs()

correlation::analysis::BondCutoffMatrix correlation::app::AppController::getBondCutoffs ( )

Parses and retrieves the user-modified bond cutoff matrix from the UI.

Returns
A BondCutoffMatrix representing both min and max squared cutoffs.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInputValidator()

InputValidator * correlation::app::AppController::getInputValidator ( )
inline

Returns the InputValidator instance.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlotController()

PlotController * correlation::app::AppController::getPlotController ( )
inline

Returns the PlotController instance.

◆ getStructure3DController()

Structure3DController * correlation::app::AppController::getStructure3DController ( )
inlinenodiscardnoexcept

Returns the Structure3DController instance.

◆ handleOptionsfromUI()

ProgramOptions correlation::app::AppController::handleOptionsfromUI ( )

Retrieves the current user-selected options from the UI.

Returns
The populated ProgramOptions struct.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleOptionstoUI()

void correlation::app::AppController::handleOptionstoUI ( )

Populates the UI with options from the backend.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSelectDualLeftPlot()

void correlation::app::AppController::handleSelectDualLeftPlot ( int idx)
private
Here is the caller graph for this function:

◆ isCalculatorGroupExpanded()

bool correlation::app::AppController::isCalculatorGroupExpanded ( std::string_view group_name,
size_t group_index ) const
nodiscardprivate
Here is the caller graph for this function:

◆ loadSettings()

void correlation::app::AppController::loadSettings ( )

Loads application layout settings and applies window/column geometry.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadTrajectory()

void correlation::app::AppController::loadTrajectory ( const std::string & filepath,
std::function< void(bool)> on_complete = nullptr )

Loads a structure or trajectory file asynchronously.

Parameters
filepathPath to the structure or trajectory file.
on_completeOptional callback invoked on event loop when loading finishes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ markResultsStaleIfDone()

void correlation::app::AppController::markResultsStaleIfDone ( )
noexcept

Flags current plot results as stale if an analysis has already completed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateCalculatorGroups()

void correlation::app::AppController::populateCalculatorGroups ( )

Populates the UI calculator groups from CalculatorFactory.

Rebuilds the calculator selection tree (per-group enabled counts, short symbols, and persisted sub-tree expansion state). When the existing Slint group model has the same group layout, rows are updated in place so that open sub-trees and scroll position are preserved across selection changes.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateExportAnalyses()

void correlation::app::AppController::populateExportAnalyses ( )

Populates the export analyses selection list with computed histograms.

◆ registerActionCallbacks()

void correlation::app::AppController::registerActionCallbacks ( )
private
Here is the call graph for this function:

◆ registerAnalysesCallbacks()

void correlation::app::AppController::registerAnalysesCallbacks ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerCameraCallbacks()

void correlation::app::AppController::registerCameraCallbacks ( )
private
Here is the caller graph for this function:

◆ registerExportCallbacks()

void correlation::app::AppController::registerExportCallbacks ( )
private

◆ registerPhaseSearchCallbacks()

void correlation::app::AppController::registerPhaseSearchCallbacks ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerPlotCallbacks()

void correlation::app::AppController::registerPlotCallbacks ( )
private
Here is the call graph for this function:

◆ registerPresetAndOptionCallbacks()

void correlation::app::AppController::registerPresetAndOptionCallbacks ( )
private
Here is the call graph for this function:

◆ registerStructure3DCallbacks()

void correlation::app::AppController::registerStructure3DCallbacks ( )
private
Here is the call graph for this function:

◆ runAnalysis()

void correlation::app::AppController::runAnalysis ( )

Executes configured analyses on the active trajectory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveSettings()

void correlation::app::AppController::saveSettings ( ) const

Saves current layout settings and window geometry to disk.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBondCutoffs()

void correlation::app::AppController::setBondCutoffs ( )

Updates the UI with the recommended bond cutoffs from the backend.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCalculatorGroupsExpanded()

void correlation::app::AppController::setCalculatorGroupsExpanded ( bool expanded,
std::string_view group_filter = {} )

Sets the expansion state of calculator selection sub-trees.

Parameters
expandedTarget expansion state.
group_filterGroup name to restrict the operation to; empty applies to all groups.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCalculatorsEnabled()

void correlation::app::AppController::setCalculatorsEnabled ( bool enabled,
std::string_view group_filter = {} )

Enables or disables every calculator, optionally restricted to a single group.

Parameters
enabledTarget activation state.
group_filterGroup name to restrict the operation to; empty applies to all groups.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateActiveGroupFlags()

void correlation::app::AppController::updateActiveGroupFlags ( )

Updates active group flags in the UI based on active calculators.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ::AppControllerTests

friend class ::AppControllerTests
friend

Member Data Documentation

◆ alive_

std::shared_ptr<std::atomic<bool> > correlation::app::AppController::alive_ {std::make_shared<std::atomic<bool>>(true)}
private

◆ analysis_runner_

std::unique_ptr<AnalysisRunner> correlation::app::AppController::analysis_runner_
private

◆ bond_cutoff_controller_

BondCutoffController correlation::app::AppController::bond_cutoff_controller_
private

◆ calculator_group_expanded_

std::map<std::string, bool, std::less<> > correlation::app::AppController::calculator_group_expanded_
private

◆ dispatcher_

AnalysisDispatcher& correlation::app::AppController::dispatcher_
private

◆ export_3d_busy_

std::atomic<bool> correlation::app::AppController::export_3d_busy_ {false}
private

◆ export_3d_thread_

std::jthread correlation::app::AppController::export_3d_thread_
private

◆ file_io_handler_

std::unique_ptr<FileIOHandler> correlation::app::AppController::file_io_handler_
private

◆ input_validator_

std::unique_ptr<InputValidator> correlation::app::AppController::input_validator_
private

◆ loader_

TrajectoryLoader& correlation::app::AppController::loader_
private

◆ options_

ProgramOptions& correlation::app::AppController::options_
private

◆ plot_controller_

std::unique_ptr<PlotController> correlation::app::AppController::plot_controller_
private

◆ preset_controller_

std::unique_ptr<PresetController> correlation::app::AppController::preset_controller_
private

◆ settings_

AppSettings correlation::app::AppController::settings_
private

◆ structure_3d_controller_

std::unique_ptr<Structure3DController> correlation::app::AppController::structure_3d_controller_
private

◆ window_

AppWindow& correlation::app::AppController::window_
private

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