| [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 |
|
|---|
| 55 | using namespace std;
|
|---|
| 56 |
|
|---|
| 57 | // TODO: see what code can be moved to a base class for Graphic and CommandLine Windows
|
|---|
| [d893f79] | 58 | CommandLineWindow::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 |
|
|---|
| 74 | CommandLineWindow::~CommandLineWindow()
|
|---|
| 75 | {
|
|---|
| 76 | delete statusIndicator;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | void CommandLineWindow::display() {
|
|---|
| [4380af] | 80 | // go through all possible actions
|
|---|
| [7e6b00] | 81 | for (std::list<std::string>::iterator CommandRunner = CommandLineParser::getInstance().SequenceOfActions.begin(); CommandRunner != CommandLineParser::getInstance().SequenceOfActions.end(); ++CommandRunner) {
|
|---|
| 82 | cout << "Checking presence of " << *CommandRunner << endl;
|
|---|
| 83 | if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner))
|
|---|
| 84 | ActionRegistry::getInstance().getActionByName(*CommandRunner)->call();
|
|---|
| [4380af] | 85 | }
|
|---|
| [a2ab15] | 86 | }
|
|---|
| [d893f79] | 87 |
|
|---|
| [97ebf8] | 88 | void CommandLineWindow::populateAnalysisActions()
|
|---|
| 89 | {
|
|---|
| [104524] | 90 | new AnalysisMolecularVolumeAction();
|
|---|
| [97ebf8] | 91 | new AnalysisPairCorrelationAction();
|
|---|
| [104524] | 92 | new AnalysisPrincipalAxisSystemAction();
|
|---|
| [97ebf8] | 93 | }
|
|---|
| 94 |
|
|---|
| [50dfda] | 95 | void CommandLineWindow::populateAtomActions()
|
|---|
| 96 | {
|
|---|
| [97ebf8] | 97 | new AtomAddAction();
|
|---|
| 98 | new AtomChangeElementAction();
|
|---|
| 99 | new AtomRemoveAction();
|
|---|
| [50dfda] | 100 | }
|
|---|
| 101 |
|
|---|
| 102 | void 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 |
|
|---|
| 112 | void CommandLineWindow::populateFragmentationActions()
|
|---|
| 113 | {
|
|---|
| [97ebf8] | 114 | new FragmentationDepthFirstSearchAction();
|
|---|
| [e4b5de] | 115 | new FragmentationFragmentationAction();
|
|---|
| 116 | new FragmentationSubgraphDissectionAction();
|
|---|
| [50dfda] | 117 | }
|
|---|
| 118 |
|
|---|
| 119 | void 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 |
|
|---|
| 131 | void CommandLineWindow::populateParserActions()
|
|---|
| 132 | {
|
|---|
| [d893f79] | 133 | new ParserLoadXyzAction();
|
|---|
| 134 | new ParserSaveXyzAction();
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| [50dfda] | 137 | void CommandLineWindow::populateTesselationActions()
|
|---|
| 138 | {
|
|---|
| [97ebf8] | 139 | new TesselationConvexEnvelopeAction();
|
|---|
| 140 | new TesselationNonConvexEnvelopeAction();
|
|---|
| [50dfda] | 141 | }
|
|---|
| 142 |
|
|---|
| [97ebf8] | 143 | void 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 | }
|
|---|