Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
AppController.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
17
18#include <functional>
19#include <map>
20#include <memory>
21#include <string>
22#include <string_view>
23
24class AppControllerTests;
25class AppWindow;
26
28
29class AnalysisRunner;
30class FileIOHandler;
31class InputValidator;
32class PlotController;
35
45public:
48
56 AppController(AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher,
57 ProgramOptions &options);
58
67 AppController(AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher,
68 BondCutoffService &cutoff_service, ProgramOptions &options);
69
74
78 void loadSettings();
79
83 void saveSettings() const;
84
90 void loadTrajectory(const std::string &filepath, std::function<void(bool)> on_complete = nullptr);
91
96 void addRecentFile(const std::string &filepath);
97
101 void runAnalysis();
102
108
112 void handleOptionstoUI();
113
118
122 void setBondCutoffs();
123
129
139
145 void setCalculatorsEnabled(bool enabled, std::string_view group_filter = {});
146
152 void setCalculatorGroupsExpanded(bool expanded, std::string_view group_filter = {});
153
158
162 void markResultsStaleIfDone() noexcept;
163
168
173
178
183
188 return structure_3d_controller_.get();
189 }
190
192
193private:
194 friend class ::AppControllerTests;
195 AppWindow &window_;
199
201 std::unique_ptr<AnalysisRunner> analysis_runner_;
202 std::unique_ptr<FileIOHandler> file_io_handler_;
203 std::unique_ptr<InputValidator> input_validator_;
204 std::unique_ptr<PlotController> plot_controller_;
205 std::unique_ptr<PresetController> preset_controller_;
206 std::unique_ptr<Structure3DController> structure_3d_controller_;
207 std::shared_ptr<std::atomic<bool>> alive_{std::make_shared<std::atomic<bool>>(true)};
208 std::atomic<bool> export_3d_busy_{false};
209 std::jthread export_3d_thread_;
211 std::map<std::string, bool, std::less<>> calculator_group_expanded_;
212
213 [[nodiscard]] bool isCalculatorGroupExpanded(std::string_view group_name,
214 size_t group_index) const;
215
222 void handleSelectDualLeftPlot(int idx);
225};
226} // namespace correlation::app
Service coordinating correlation analysis execution and file export.
Configuration structures and defaults for application analysis.
Controller managing bond cutoff matrix operations and UI synchronization.
Service providing atomic pair cutoff calculations, scaling, and uniform matrices.
Manages application window and layout settings persistence.
Service responsible for loading trajectories and extracting structural metadata.
Contiguous 2D matrix of element-pair bond cutoff ranges.
Definition AnalysisTypes.hpp:48
Dispatches analysis workflows to CorrelationEngine, handles cancellation, and exports data.
Definition AnalysisDispatcher.hpp:32
Manages the background thread and logic for running analysis workflows.
Definition AnalysisRunner.hpp:29
void registerPhaseSearchCallbacks()
Definition AppController3DCallbacks.cpp:307
std::jthread export_3d_thread_
Definition AppController.hpp:209
AppController(AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, BondCutoffService &cutoff_service, ProgramOptions &options)
Constructs the AppController with injected domain services (transitional).
void setBondCutoffs()
Updates the UI with the recommended bond cutoffs from the backend.
Definition AppController.cpp:227
AppController(AppWindow &window, TrajectoryLoader &loader, AnalysisDispatcher &dispatcher, ProgramOptions &options)
Constructs the AppController with injected domain services.
void addRecentFile(const std::string &filepath)
Appends a path to MRU recent files and updates UI.
Definition AppController.cpp:159
InputValidator * getInputValidator()
Returns the InputValidator instance.
Definition AppController.hpp:167
BondCutoffController bond_cutoff_controller_
Definition AppController.hpp:200
std::unique_ptr< Structure3DController > structure_3d_controller_
Definition AppController.hpp:206
void registerPresetAndOptionCallbacks()
Definition AppControllerCallbacks.cpp:401
AnalysisDispatcher & dispatcher_
Definition AppController.hpp:197
void registerCameraCallbacks()
Definition AppController3DCallbacks.cpp:136
correlation::analysis::BondCutoffMatrix getBondCutoffs()
Parses and retrieves the user-modified bond cutoff matrix from the UI.
Definition AppController.cpp:229
std::unique_ptr< FileIOHandler > file_io_handler_
Definition AppController.hpp:202
TrajectoryLoader & loader_
Definition AppController.hpp:196
~AppController()
Destructor. Ensures analysis threads are joined before destruction.
Definition AppController.cpp:132
void populateExportAnalyses()
Populates the export analyses selection list with computed histograms.
Definition AppControllerCalculators.cpp:244
void handleOptionstoUI()
Populates the UI with options from the backend.
Definition AppController.cpp:204
PlotController * getPlotController()
Returns the PlotController instance.
Definition AppController.hpp:172
void registerStructure3DCallbacks()
Definition AppController3DCallbacks.cpp:128
void handleSelectDualLeftPlot(int idx)
Definition AppController3DCallbacks.cpp:262
std::unique_ptr< PresetController > preset_controller_
Definition AppController.hpp:205
void loadSettings()
Loads application layout settings and applies window/column geometry.
Definition AppController.cpp:142
std::unique_ptr< PlotController > plot_controller_
Definition AppController.hpp:204
const BondCutoffController & getBondCutoffController() const
Returns the const BondCutoffController instance.
Definition AppController.hpp:182
AppWindow & window_
Definition AppController.hpp:195
void populateCalculatorGroups()
Populates the UI calculator groups from CalculatorFactory.
Definition AppControllerCalculators.cpp:165
Structure3DController * getStructure3DController() noexcept
Returns the Structure3DController instance.
Definition AppController.hpp:187
void runAnalysis()
Executes configured analyses on the active trajectory.
Definition AppController.cpp:198
void setCalculatorGroupsExpanded(bool expanded, std::string_view group_filter={})
Sets the expansion state of calculator selection sub-trees.
Definition AppControllerCalculators.cpp:233
void saveSettings() const
Saves current layout settings and window geometry to disk.
Definition AppController.cpp:174
std::map< std::string, bool, std::less<> > calculator_group_expanded_
Definition AppController.hpp:211
void registerExportCallbacks()
Definition AppControllerCallbacks.cpp:539
ProgramOptions handleOptionsfromUI()
Retrieves the current user-selected options from the UI.
Definition AppController.cpp:216
BondCutoffController & getBondCutoffController()
Returns the BondCutoffController instance.
Definition AppController.hpp:177
ProgramOptions & options_
Definition AppController.hpp:198
void registerAnalysesCallbacks()
Definition AppControllerCallbacks.cpp:292
bool isCalculatorGroupExpanded(std::string_view group_name, size_t group_index) const
Definition AppControllerCalculators.cpp:156
AppSettings settings_
Definition AppController.hpp:210
void loadTrajectory(const std::string &filepath, std::function< void(bool)> on_complete=nullptr)
Loads a structure or trajectory file asynchronously.
Definition AppController.cpp:191
void registerActionCallbacks()
Definition AppControllerCallbacks.cpp:199
std::unique_ptr< AnalysisRunner > analysis_runner_
Definition AppController.hpp:201
void registerPlotCallbacks()
Definition AppControllerCallbacks.cpp:312
void setCalculatorsEnabled(bool enabled, std::string_view group_filter={})
Enables or disables every calculator, optionally restricted to a single group.
Definition AppControllerCalculators.cpp:199
std::shared_ptr< std::atomic< bool > > alive_
Definition AppController.hpp:207
std::unique_ptr< InputValidator > input_validator_
Definition AppController.hpp:203
std::atomic< bool > export_3d_busy_
Definition AppController.hpp:208
void markResultsStaleIfDone() noexcept
Flags current plot results as stale if an analysis has already completed.
Definition AppController.cpp:210
void updateActiveGroupFlags()
Updates active group flags in the UI based on active calculators.
Definition AppController.cpp:206
Controller that manages element-pair bond cutoff matrices and synchronizes with the UI.
Definition BondCutoffController.hpp:32
Service calculating and managing covalent bond cutoffs on trajectories and cells.
Definition BondCutoffService.hpp:21
Manages open/save file dialogs and background file loading.
Definition FileIOHandler.hpp:30
Handles UI input validation.
Definition InputValidator.hpp:23
Manages plot rendering, caching, interactions, and exports.
Definition PlotController.hpp:59
Manages parameter presets and material type configurations.
Definition PresetController.hpp:27
Coordinates 3D orbit interactions, scene streaming, and asynchronous off-thread rendering.
Definition Structure3DController.hpp:57
Manages loading of structure/trajectory files and provides atomic/cell metadata.
Definition TrajectoryLoader.hpp:34
Definition AppController.hpp:27
Stores layout geometry and window dimensions across app sessions.
Definition SettingsManager.hpp:22
Encapsulates all configurable options for the application.
Definition AppOptions.hpp:122