source: src/UIElements/CommandLineUI/CommandLineWindow.cpp@ cd5047

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since cd5047 was 0fb9f6, checked in by Frederik Heber <heber@…>, 15 years ago

Fixes to prevent seg'faults.

  • CommandLineWindow::~CommandLineWindow() - does not unregister and delete all actions as this is done by the ActionRegistry anyway
  • main() - use atexit(cleanUp) (by Till) to ensure correct order of the cleanup
  • performCriticalExit() - don't free still allocated memory as this is handled by any good operation system nowadays
  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*
2 * CommandLineWindow.cpp
3 *
4 * Created on: May 8, 2010
5 * Author: heber
6 */
7
8#include <boost/bind.hpp>
9
10#include "CommandLineUI/CommandLineWindow.hpp"
11#include "CommandLineUI/CommandLineStatusIndicator.hpp"
12
13#include "Actions/ActionRegistry.hpp"
14#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
15#include "Actions/AnalysisAction/PairCorrelationToPointAction.hpp"
16#include "Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp"
17#include "Actions/AtomAction/AddAction.hpp"
18#include "Actions/AtomAction/ChangeElementAction.hpp"
19#include "Actions/AtomAction/RemoveAction.hpp"
20#include "Actions/CmdAction/BondLengthTableAction.hpp"
21#include "Actions/CmdAction/ElementDbAction.hpp"
22#include "Actions/CmdAction/FastParsingAction.hpp"
23#include "Actions/CmdAction/HelpAction.hpp"
24#include "Actions/CmdAction/VerboseAction.hpp"
25#include "Actions/CmdAction/VersionAction.hpp"
26#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
27#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
28#include "Actions/MoleculeAction/BondFileAction.hpp"
29#include "Actions/MoleculeAction/ChangeNameAction.hpp"
30#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
31#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
32#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
33#include "Actions/MoleculeAction/SaveBondsAction.hpp"
34#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
35#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
36#include "Actions/ParserAction/LoadXyzAction.hpp"
37#include "Actions/ParserAction/SaveXyzAction.hpp"
38#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
39#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
40#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
41#include "Actions/WorldAction/BoundInBoxAction.hpp"
42#include "Actions/WorldAction/CenterInBoxAction.hpp"
43#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
44#include "Actions/WorldAction/ChangeBoxAction.hpp"
45#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
46#include "Actions/WorldAction/RepeatBoxAction.hpp"
47#include "Actions/WorldAction/ScaleBoxAction.hpp"
48#include "Actions/WorldAction/SetDefaultNameAction.hpp"
49#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
50#include "CommandLineParser.hpp"
51
52#include <iostream>
53
54using namespace std;
55
56// TODO: see what code can be moved to a base class for Graphic and CommandLine Windows
57CommandLineWindow::CommandLineWindow()
58{
59 // create and register all command line callable actions
60 populateAnalysisActions();
61 populateAtomActions();
62 populateCmdActions();
63 populateFragmentationActions();
64 populateMoleculeActions();
65 populateParserActions();
66 populateTesselationActions();
67 populateWorldActions();
68
69 // Add status indicators etc...
70 statusIndicator = new CommandLineStatusIndicator();
71}
72
73CommandLineWindow::~CommandLineWindow()
74{
75// // go through all possible actions
76// for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) {
77// ActionRegistry::getInstance().unregisterAction(ActionRunner->second);
78// delete(ActionRunner->second);
79// }
80
81 delete statusIndicator;
82}
83
84void CommandLineWindow::display() {
85 // go through all possible actions
86 for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRunner != ActionRegistry::getInstance().getEndIter(); ActionRunner++) {
87 // check whether action is present in command line
88 if (CommandLineParser::getInstance().vm.count(ActionRunner->first)) {
89 ActionRunner->second->call();
90 }
91 }
92}
93
94void CommandLineWindow::populateAnalysisActions()
95{
96 new AnalysisPairCorrelationAction();
97 new AnalysisPairCorrelationToPointAction();
98 new AnalysisPairCorrelationToSurfaceAction();
99}
100
101void CommandLineWindow::populateAtomActions()
102{
103 new AtomAddAction();
104 new AtomChangeElementAction();
105 new AtomRemoveAction();
106}
107
108void CommandLineWindow::populateCmdActions()
109{
110 new CommandLineBondLengthTableAction();
111 new CommandLineElementDbAction();
112 new CommandLineFastParsingAction();
113 new CommandLineHelpAction();
114 new CommandLineVerboseAction();
115 new CommandLineVersionAction();
116}
117
118void CommandLineWindow::populateFragmentationActions()
119{
120 new FragmentationDepthFirstSearchAction();
121}
122
123void CommandLineWindow::populateMoleculeActions()
124{
125 new MoleculeBondFileAction();
126 new MoleculeChangeNameAction();
127 new MoleculeFillWithMoleculeAction();
128 new MoleculeLinearInterpolationofTrajectoriesAction();
129 new MoleculeSaveAdjacencyAction();
130 new MoleculeSaveBondsAction();
131 new MoleculeSaveTemperatureAction();
132 new MoleculeVerletIntegrationAction();
133}
134
135void CommandLineWindow::populateParserActions()
136{
137 new ParserLoadXyzAction();
138 new ParserSaveXyzAction();
139}
140
141void CommandLineWindow::populateTesselationActions()
142{
143 new TesselationConvexEnvelopeAction();
144 new TesselationNonConvexEnvelopeAction();
145}
146
147void CommandLineWindow::populateWorldActions()
148{
149 new WorldAddEmptyBoundaryAction();
150 new WorldBoundInBoxAction();
151 new WorldCenterInBoxAction();
152 new WorldCenterOnEdgeAction();
153 new WorldChangeBoxAction();
154 new WorldRemoveSphereOfAtomsAction();
155 new WorldRepeatBoxAction();
156 new WorldScaleBoxAction();
157 new WorldSetDefaultNameAction();
158 new WorldSetGaussianBasisAction();
159}
Note: See TracBrowser for help on using the repository browser.