source: src/UIElements/CommandLineUI/CommandLineWindow.cpp@ 2b5574

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 Candidate_v1.7.0 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 2b5574 was 1e6913, checked in by Frederik Heber <heber@…>, 15 years ago

Order of actions called did not conincide with order on command line.

CommandLineWindow::display()

  • Actions were called by going through the repository and checking whether present on CommandLine, this causes different sequence of actions to be called.
  • Now, we go through all command lind parameters and check whether they correspond to an action in the registry which we call.

ActionRegistry:

  • new function: ActionRegistry::isActionByNamePresent() checks whether action is present in registry
  • TESTFIX: MaxOrder now failws if not another action is called before (here now, -v 1). Otherwise, return code only occurs on third call not on second
  • Property mode set to 100644
File size: 5.1 KB
RevLine 
[a2ab15]1/*
2 * CommandLineWindow.cpp
3 *
4 * Created on: May 8, 2010
5 * Author: heber
6 */
7
8#include <boost/bind.hpp>
9
[5079a0]10#include "CommandLineUI/CommandLineWindow.hpp"
11#include "CommandLineUI/CommandLineStatusIndicator.hpp"
[a2ab15]12
[4380af]13#include "Actions/ActionRegistry.hpp"
[104524]14#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
[97ebf8]15#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
[104524]16#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
[97ebf8]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"
[d893f79]23#include "Actions/CmdAction/HelpAction.hpp"
[97ebf8]24#include "Actions/CmdAction/VerboseAction.hpp"
[50dfda]25#include "Actions/CmdAction/VersionAction.hpp"
[97ebf8]26#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
27#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
[e4b5de]28#include "Actions/FragmentationAction/FragmentationAction.hpp"
[97ebf8]29#include "Actions/MoleculeAction/BondFileAction.hpp"
30#include "Actions/MoleculeAction/ChangeNameAction.hpp"
31#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
32#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
33#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
34#include "Actions/MoleculeAction/SaveBondsAction.hpp"
35#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
36#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
[d893f79]37#include "Actions/ParserAction/LoadXyzAction.hpp"
38#include "Actions/ParserAction/SaveXyzAction.hpp"
[97ebf8]39#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
40#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
41#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
42#include "Actions/WorldAction/BoundInBoxAction.hpp"
43#include "Actions/WorldAction/CenterInBoxAction.hpp"
44#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
45#include "Actions/WorldAction/ChangeBoxAction.hpp"
46#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
47#include "Actions/WorldAction/RepeatBoxAction.hpp"
48#include "Actions/WorldAction/ScaleBoxAction.hpp"
49#include "Actions/WorldAction/SetDefaultNameAction.hpp"
50#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
[4380af]51#include "CommandLineParser.hpp"
[d893f79]52
[a2ab15]53#include <iostream>
54
55using namespace std;
56
57// TODO: see what code can be moved to a base class for Graphic and CommandLine Windows
[d893f79]58CommandLineWindow::CommandLineWindow()
[a2ab15]59{
[d893f79]60 // create and register all command line callable actions
[97ebf8]61 populateAnalysisActions();
[50dfda]62 populateAtomActions();
63 populateCmdActions();
64 populateFragmentationActions();
65 populateMoleculeActions();
[d893f79]66 populateParserActions();
[50dfda]67 populateTesselationActions();
[97ebf8]68 populateWorldActions();
[a2ab15]69
70 // Add status indicators etc...
71 statusIndicator = new CommandLineStatusIndicator();
72}
73
74CommandLineWindow::~CommandLineWindow()
75{
76 delete statusIndicator;
77}
78
79void CommandLineWindow::display() {
[4380af]80 // go through all possible actions
[1e6913]81 for (po::variables_map::iterator CommandRunner = CommandLineParser::getInstance().vm.begin(); CommandRunner != CommandLineParser::getInstance().vm.end(); ++CommandRunner) {
82 cout << "Checking presence of " << CommandRunner->first << endl;
83 if (ActionRegistry::getInstance().isActionByNamePresent(CommandRunner->first))
84 ActionRegistry::getInstance().getActionByName(CommandRunner->first)->call();
[4380af]85 }
[a2ab15]86}
[d893f79]87
[97ebf8]88void CommandLineWindow::populateAnalysisActions()
89{
[104524]90 new AnalysisMolecularVolumeAction();
[97ebf8]91 new AnalysisPairCorrelationAction();
[104524]92 new AnalysisPrincipalAxisSystemAction();
[97ebf8]93}
94
[50dfda]95void CommandLineWindow::populateAtomActions()
96{
[97ebf8]97 new AtomAddAction();
98 new AtomChangeElementAction();
99 new AtomRemoveAction();
[50dfda]100}
101
102void CommandLineWindow::populateCmdActions()
[d893f79]103{
[97ebf8]104 new CommandLineBondLengthTableAction();
105 new CommandLineElementDbAction();
106 new CommandLineFastParsingAction();
[e3ecc1a]107 new CommandLineHelpAction();
[97ebf8]108 new CommandLineVerboseAction();
[50dfda]109 new CommandLineVersionAction();
110}
111
112void CommandLineWindow::populateFragmentationActions()
113{
[97ebf8]114 new FragmentationDepthFirstSearchAction();
[e4b5de]115 new FragmentationFragmentationAction();
116 new FragmentationSubgraphDissectionAction();
[50dfda]117}
118
119void CommandLineWindow::populateMoleculeActions()
120{
[97ebf8]121 new MoleculeBondFileAction();
122 new MoleculeChangeNameAction();
123 new MoleculeFillWithMoleculeAction();
124 new MoleculeLinearInterpolationofTrajectoriesAction();
125 new MoleculeSaveAdjacencyAction();
126 new MoleculeSaveBondsAction();
127 new MoleculeSaveTemperatureAction();
128 new MoleculeVerletIntegrationAction();
[50dfda]129}
130
131void CommandLineWindow::populateParserActions()
132{
[d893f79]133 new ParserLoadXyzAction();
134 new ParserSaveXyzAction();
135}
136
[50dfda]137void CommandLineWindow::populateTesselationActions()
138{
[97ebf8]139 new TesselationConvexEnvelopeAction();
140 new TesselationNonConvexEnvelopeAction();
[50dfda]141}
142
[97ebf8]143void CommandLineWindow::populateWorldActions()
144{
145 new WorldAddEmptyBoundaryAction();
146 new WorldBoundInBoxAction();
147 new WorldCenterInBoxAction();
148 new WorldCenterOnEdgeAction();
149 new WorldChangeBoxAction();
150 new WorldRemoveSphereOfAtomsAction();
151 new WorldRepeatBoxAction();
152 new WorldScaleBoxAction();
153 new WorldSetDefaultNameAction();
154 new WorldSetGaussianBasisAction();
155}
Note: See TracBrowser for help on using the repository browser.