source: src/Actions/MapOfActions.cpp@ eee966

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 eee966 was eee966, checked in by Frederik Heber <heber@…>, 15 years ago

New Action FillVoidWithMoleculeAction.

  • Property mode set to 100644
File size: 54.9 KB
RevLine 
[bcf653]1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
[97ebf8]8/*
9 * MapOfActions.cpp
10 *
11 * Created on: 10.05.2010
12 * Author: heber
13 */
14
[bf3817]15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
[112b09]20#include "Helpers/MemDebug.hpp"
21
[97ebf8]22using namespace std;
23
24#include "Actions/MapOfActions.hpp"
[d02e07]25#include "Descriptors/AtomIdDescriptor.hpp"
26#include "Descriptors/MoleculeIdDescriptor.hpp"
[97ebf8]27#include "Helpers/Assert.hpp"
[4e145c]28#include "Patterns/Singleton_impl.hpp"
[97ebf8]29
[0286bc]30#include <boost/lexical_cast.hpp>
31#include <boost/optional.hpp>
32#include <boost/program_options.hpp>
33
[986ed3]34#include <iostream>
35
[ab9a27]36#include "atom.hpp"
[d02e07]37#include "Box.hpp"
[97ebf8]38#include "CommandLineParser.hpp"
[ab9a27]39#include "element.hpp"
[952f38]40#include "Helpers/Log.hpp"
[57f243]41#include "LinearAlgebra/Matrix.hpp"
[ab9a27]42#include "molecule.hpp"
[d02e07]43#include "periodentafel.hpp"
[72f611]44#include "LinearAlgebra/BoxVector.hpp"
[57f243]45#include "LinearAlgebra/Vector.hpp"
[952f38]46#include "Helpers/Verbose.hpp"
[97ebf8]47
[326bbe]48#include "Actions/ActionRegistry.hpp"
49#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
50#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
[d02e07]51#include "Actions/AnalysisAction/PointCorrelationAction.hpp"
[326bbe]52#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
[d02e07]53#include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
[326bbe]54#include "Actions/AtomAction/AddAction.hpp"
55#include "Actions/AtomAction/ChangeElementAction.hpp"
56#include "Actions/AtomAction/RemoveAction.hpp"
[22c44bf]57#include "Actions/AtomAction/RotateAroundOriginByAngleAction.hpp"
[34c338]58#include "Actions/AtomAction/TranslateAction.hpp"
[53d01c]59#include "Actions/CommandAction/BondLengthTableAction.hpp"
60#include "Actions/CommandAction/ElementDbAction.hpp"
61#include "Actions/CommandAction/FastParsingAction.hpp"
62#include "Actions/CommandAction/HelpAction.hpp"
63#include "Actions/CommandAction/VerboseAction.hpp"
64#include "Actions/CommandAction/VersionAction.hpp"
[1a7fd2]65#include "Actions/FragmentationAction/ConstructBondGraphAction.hpp"
[326bbe]66#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
67#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
68#include "Actions/FragmentationAction/FragmentationAction.hpp"
69#include "Actions/MoleculeAction/BondFileAction.hpp"
70#include "Actions/MoleculeAction/ChangeNameAction.hpp"
[1a7fd2]71#include "Actions/MoleculeAction/CopyAction.hpp"
[326bbe]72#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
[eee966]73#include "Actions/MoleculeAction/FillVoidWithMoleculeAction.hpp"
[326bbe]74#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
[eaf4ae]75#include "Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp"
[b2531f]76#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
[326bbe]77#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
78#include "Actions/MoleculeAction/SaveBondsAction.hpp"
79#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
[b2531f]80#include "Actions/MoleculeAction/SuspendInWaterAction.hpp"
[326bbe]81#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
82#include "Actions/ParserAction/LoadXyzAction.hpp"
83#include "Actions/ParserAction/SaveXyzAction.hpp"
[e472eab]84#include "Actions/SelectionAction/AllAtomsAction.hpp"
[1cc87e]85#include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
86#include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
[770287]87#include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp"
[e472eab]88#include "Actions/SelectionAction/AllMoleculesAction.hpp"
[51769f]89#include "Actions/SelectionAction/AtomByElementAction.hpp"
[533838]90#include "Actions/SelectionAction/AtomByIdAction.hpp"
[e212ff]91#include "Actions/SelectionAction/ClearAllAtomsAction.hpp"
[2218d94]92#include "Actions/SelectionAction/ClearAllMoleculesAction.hpp"
[51769f]93#include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
[533838]94#include "Actions/SelectionAction/MoleculeByIdAction.hpp"
[481e92]95#include "Actions/SelectionAction/MoleculeOfAtomAction.hpp"
[e472eab]96#include "Actions/SelectionAction/NotAllAtomsAction.hpp"
[1cc87e]97#include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
98#include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
[381c5f]99#include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp"
[e472eab]100#include "Actions/SelectionAction/NotAllMoleculesAction.hpp"
[51769f]101#include "Actions/SelectionAction/NotAtomByElementAction.hpp"
[533838]102#include "Actions/SelectionAction/NotAtomByIdAction.hpp"
[51769f]103#include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
[533838]104#include "Actions/SelectionAction/NotMoleculeByIdAction.hpp"
[75a80f]105#include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp"
[326bbe]106#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
107#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
108#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
109#include "Actions/WorldAction/BoundInBoxAction.hpp"
110#include "Actions/WorldAction/CenterInBoxAction.hpp"
111#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
112#include "Actions/WorldAction/ChangeBoxAction.hpp"
113#include "Actions/WorldAction/InputAction.hpp"
114#include "Actions/WorldAction/OutputAction.hpp"
115#include "Actions/WorldAction/RepeatBoxAction.hpp"
116#include "Actions/WorldAction/ScaleBoxAction.hpp"
117#include "Actions/WorldAction/SetDefaultNameAction.hpp"
118#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
[b9c847]119#include "Actions/WorldAction/SetOutputFormatsAction.hpp"
[0286bc]120#include "Actions/Values.hpp"
121
122void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int)
123{
124 VectorValue VV;
[b540f3]125 std::vector<std::string> components;
126
127 // split comma-separated values
128 if (values.size() != 1) {
129 cerr << "Not one vector but " << components.size() << " given " << endl;
130 throw boost::program_options::validation_error("Unequal to one vector given");
131 }
132 std::string argument(values.at(0));
133 std::string::iterator Aiter = argument.begin();
134 std::string::iterator Biter = argument.begin();
135 for (; Aiter != argument.end(); ++Aiter) {
136 if (*Aiter == ',') {
137 components.push_back(string(Biter,Aiter));
138 do {
139 Aiter++;
140 } while (*Aiter == ' ' || *Aiter == '\t');
141 Biter = Aiter;
142 }
143 }
144 components.push_back(string(Biter,argument.end()));
145
146 if (components.size() != 3) {
147 cerr << "Specified vector does not have three components but " << components.size() << endl;
[0286bc]148 throw boost::program_options::validation_error("Specified vector does not have three components");
149 }
[b540f3]150 VV.x = boost::lexical_cast<double>(components.at(0));
151 VV.y = boost::lexical_cast<double>(components.at(1));
152 VV.z = boost::lexical_cast<double>(components.at(2));
[0286bc]153 v = boost::any(VectorValue(VV));
154}
155
156void validate(boost::any& v, const std::vector<std::string>& values, BoxValue *, int)
157{
158 BoxValue BV;
[b540f3]159 std::vector<std::string> components;
160
161 // split comma-separated values
162 if (values.size() != 1) {
163 cerr << "Not one vector but " << components.size() << " given " << endl;
164 throw boost::program_options::validation_error("Unequal to one vector given");
165 }
166 std::string argument(values.at(0));
167 std::string::iterator Aiter = argument.begin();
168 std::string::iterator Biter = argument.begin();
169 for (; Aiter != argument.end(); ++Aiter) {
170 if (*Aiter == ',') {
171 components.push_back(string(Biter,Aiter));
172 do {
173 Aiter++;
174 } while (*Aiter == ' ' || *Aiter == '\t');
175 Biter = Aiter;
176 }
177 }
178 components.push_back(string(Biter,argument.end()));
179
180 if (components.size() != 6) {
181 cerr << "Specified vector does not have three components but " << components.size() << endl;
[0286bc]182 throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");
183 }
[b540f3]184 BV.xx = boost::lexical_cast<double>(components.at(0));
[8467df]185 BV.yx = boost::lexical_cast<double>(components.at(1));
186 BV.yy = boost::lexical_cast<double>(components.at(2));
187 BV.zx = boost::lexical_cast<double>(components.at(3));
188 BV.zy = boost::lexical_cast<double>(components.at(4));
[b540f3]189 BV.zz = boost::lexical_cast<double>(components.at(5));
[0286bc]190 v = boost::any(BoxValue(BV));
191}
192
[97ebf8]193/** Constructor of class MapOfActions.
194 *
195 */
196MapOfActions::MapOfActions()
197{
198 // initialise lookup map
199 CmdParserLookup[&generic] = &(CommandLineParser::getInstance().generic);
200 CmdParserLookup[&config] = &(CommandLineParser::getInstance().config);
201 CmdParserLookup[&hidden] = &(CommandLineParser::getInstance().hidden);
202 CmdParserLookup[&visible] = &(CommandLineParser::getInstance().visible);
203
204 // keys for actions
205 DescriptionMap["add-atom"] = "add atom of specified element";
206 DescriptionMap["bond-table"] = "setting name of the bond length table file";
207 DescriptionMap["bond-file"] = "name of the bond file";
208 DescriptionMap["boundary"] = "change box to add an empty boundary around all atoms";
209 DescriptionMap["bound-in-box"] = "bound all atoms in the domain";
210 DescriptionMap["center-edge"] = "center edge of all atoms on (0,0,0)";
211 DescriptionMap["center-in-box"] = "center all atoms in the domain";
212 DescriptionMap["change-box"] = "change the symmetrc matrix of the simulation domain";
213 DescriptionMap["change-element"] = "change the element of an atom";
214 DescriptionMap["change-molname"] = "change the name of a molecule";
[e212ff]215 DescriptionMap["clear-atom-selection"] = "clear the atom selection";
[2218d94]216 DescriptionMap["clear-molecule-selection"] = "clear the molecule selection";
[c449d9]217 DescriptionMap["construct-bondgraph"] = "construct the bond graph of the selected atoms";
[97ebf8]218 DescriptionMap["convex-envelope"] = "create the convex envelope for a molecule";
[1a7fd2]219 DescriptionMap["copy-molecule"] = "copies a molecule with all atoms and bonds";
[97ebf8]220 DescriptionMap["default-molname"] = "set the default name of new molecules";
221 DescriptionMap["depth-first-search"] = "Depth-First Search analysis of the molecular system";
222 DescriptionMap["element-db"] = "setting the path where the element databases can be found";
223 DescriptionMap["fastparsing"] = "setting whether trajectories shall be parsed completely (n) or just first step (y)";
[eee966]224 DescriptionMap["fill-molecule"] = "fill around molecules' surface with a filler molecule";
225 DescriptionMap["fill-void"] = "fill void space of box with a filler molecule";
[97ebf8]226 DescriptionMap["fragment-mol"] = "create for a given molecule into fragments up to given order";
[a77976]227 DescriptionMap["help"] = "Give this help screen";
[4f7f34e]228 DescriptionMap["input"] = "specify input files";
[97ebf8]229 DescriptionMap["linear-interpolate"] = "linear interpolation in discrete steps between start and end position of a molecule";
230 DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule";
[b9c847]231 DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule";
232 DescriptionMap["output"] = "write output files";
233 DescriptionMap["set-output"] = "specify output formats";
[e65de8]234 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements";
[97ebf8]235 DescriptionMap["parse-xyz"] = "parse xyz file into World";
[e65de8]236 DescriptionMap["point-correlation"] = "pair correlation analysis between element and point";
[97ebf8]237 DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule";
[446bc1]238 DescriptionMap["redo"] = "redo last action";
[97ebf8]239 DescriptionMap["remove-atom"] = "remove a specified atom";
240 DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis";
[22c44bf]241 DescriptionMap["rotate-origin"] = "rotate selected atoms by a specific angle around origin";
[eaf4ae]242 DescriptionMap["rotate-self"] = "rotates molecules by a specific angle around own center of gravity";
[97ebf8]243 DescriptionMap["rotate-to-pas"] = "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis";
244 DescriptionMap["save-adjacency"] = "name of the adjacency file to write to";
245 DescriptionMap["save-bonds"] = "name of the bonds file to write to";
246 DescriptionMap["save-temperature"] = "name of the temperature file to write to";
[326bbe]247 DescriptionMap["SaveXyz"] = "save world as xyz file";
[2a92ff]248 DescriptionMap["scale-box"] = "scale box and atomic positions inside";
[4e4c4d]249 DescriptionMap["select-all-atoms"] = "select all atoms";
250 DescriptionMap["select-all-molecules"] = "select all molecules";
[51769f]251 DescriptionMap["select-atom-by-element"] = "select an atom by element";
[4e4c4d]252 DescriptionMap["select-atom-by-id"] = "select an atom by index";
[1cc87e]253 DescriptionMap["select-atoms-inside-cuboid"] = "select all atoms inside a cuboid";
254 DescriptionMap["select-atoms-inside-sphere"] = "select all atoms inside a sphere";
[4e4c4d]255 DescriptionMap["select-molecule-by-id"] = "select a molecule by index";
[51769f]256 DescriptionMap["select-molecule-by-formula"] = "select a molecule by chemical formula";
[481e92]257 DescriptionMap["select-molecule-of-atom"] = "select a molecule to which a given atom belongs";
[770287]258 DescriptionMap["select-molecules-atoms"] = "select all atoms of a molecule";
[b9c847]259 DescriptionMap["set-basis"] = "set the name of the gaussian basis set for MPQC";
260 DescriptionMap["set-output"] = "specify output formats";
[6866aa]261 DescriptionMap["subgraph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";
[e65de8]262 DescriptionMap["surface-correlation"] = "pair correlation analysis between element and surface";
[97ebf8]263 DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified";
[34c338]264 DescriptionMap["translate-atoms"] = "translate all selected atoms by given vector";
[446bc1]265 DescriptionMap["undo"] = "undo last action";
[4e4c4d]266 DescriptionMap["unselect-all-atoms"] = "unselect all atoms";
267 DescriptionMap["unselect-all-molecules"] = "unselect all molecules";
[51769f]268 DescriptionMap["unselect-atom-by-element"] = "unselect an atom by element";
[4e4c4d]269 DescriptionMap["unselect-atom-by-id"] = "unselect an atom by index";
[1cc87e]270 DescriptionMap["unselect-atoms-inside-cuboid"] = "unselect all atoms inside a cuboid";
271 DescriptionMap["unselect-atoms-inside-sphere"] = "unselect all atoms inside a sphere";
[51769f]272 DescriptionMap["unselect-molecule-by-formula"] = "unselect a molecule by chemical formula";
[4e4c4d]273 DescriptionMap["unselect-molecule-by-id"] = "unselect a molecule by index";
[75a80f]274 DescriptionMap["unselect-molecule-of-atom"] = "unselect a molecule to which a given atom belongs";
[381c5f]275 DescriptionMap["unselect-molecules-atoms"] = "unselect all atoms of a molecule";
[97ebf8]276 DescriptionMap["verbose"] = "set verbosity level";
277 DescriptionMap["verlet-integrate"] = "perform verlet integration of a given force file";
278 DescriptionMap["version"] = "show version";
279 // keys for values
[31fb1d]280 DescriptionMap["angle-x"] = "angle of a rotation around x axis";
281 DescriptionMap["angle-y"] = "angle of a rotation around y axis";
282 DescriptionMap["angle-z"] = "angle of a rotation around z axis";
[97ebf8]283 DescriptionMap["bin-output-file"] = "name of the bin output file";
284 DescriptionMap["bin-end"] = "start of the last bin";
285 DescriptionMap["bin-start"] = "start of the first bin";
286 DescriptionMap["bin-width"] = "width of the bins";
[f6bd32]287 DescriptionMap["convex-file"] = "filename of the non-convex envelope";
[97ebf8]288 DescriptionMap["distance"] = "distance in space";
289 DescriptionMap["distances"] = "list of three of distances in space, one for each axis direction";
[0286bc]290 DescriptionMap["DoRotate"] = "whether to rotate or just report angles";
[58bbd3]291 DescriptionMap["element"] = "single element";
292 DescriptionMap["elements"] = "set of elements";
[a02462]293 DescriptionMap["end-step"] = "last or end step";
294 DescriptionMap["id-mapping"] = "whether the identity shall be used in mapping atoms onto atoms or some closest distance measure shall be used";
[97ebf8]295 DescriptionMap["input"] = "name of input file";
296 DescriptionMap["length"] = "length in space";
297 DescriptionMap["lengths"] = "list of three of lengths in space, one for each axis direction";
298 DescriptionMap["MaxDistance"] = "maximum distance in space";
299 DescriptionMap["molecule-by-id"] = "index of a molecule";
[f6bd32]300 DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope";
[e4b5de]301 DescriptionMap["order"] = "order of a discretization, dissection, ...";
[97ebf8]302 DescriptionMap["output-file"] = "name of the output file";
303 DescriptionMap["periodic"] = "system is constraint to periodic boundary conditions (y/n)";
304 DescriptionMap["position"] = "position in R^3 space";
[a02462]305 DescriptionMap["start-step"] = "first or start step";
[97ebf8]306
307 // short forms for the actions
308 ShortFormMap["add-atom"] = "a";
309 ShortFormMap["bond-table"] = "g";
310 ShortFormMap["bond-file"] = "A";
311 ShortFormMap["boundary"] = "c";
[6ca1f7]312 ShortFormMap["change-box"] = "B";
[97ebf8]313 ShortFormMap["center-edge"] = "O";
314 ShortFormMap["center-in-box"] = "b";
315 ShortFormMap["change-element"] = "E";
[b9c847]316// ShortFormMap["convex-envelope"] = "x";
[97ebf8]317 ShortFormMap["default-molname"] = "X";
318 ShortFormMap["depth-first-search"] = "D";
319 ShortFormMap["element-db"] = "e";
320 ShortFormMap["fastparsing"] = "n";
321 ShortFormMap["fill-molecule"] = "F";
322 ShortFormMap["fragment-mol"] = "f";
323 ShortFormMap["help"] = "h";
324 ShortFormMap["input"] = "i";
325 ShortFormMap["linear-interpolate"] = "L";
326 ShortFormMap["nonconvex-envelope"] = "N";
[cd8e55]327// ShortFormMap["output"] = "o";
[e65de8]328// ShortFormMap["pair-correlation"] = "C";
[97ebf8]329 ShortFormMap["parse-xyz"] = "p";
330 ShortFormMap["remove-atom"] = "r";
331 ShortFormMap["repeat-box"] = "d";
332 ShortFormMap["rotate-to-pas"] = "m";
333 ShortFormMap["save-adjacency"] = "J";
334 ShortFormMap["save-bonds"] = "j";
335 ShortFormMap["save-temperature"] = "S";
336 ShortFormMap["scale-box"] = "s";
337 ShortFormMap["set-basis"] = "M";
[b9c847]338 ShortFormMap["set-output"] = "o";
[6866aa]339 ShortFormMap["subgraph-dissect"] = "I";
[48ab70a]340 ShortFormMap["suspend-in-water"] = "u";
[34c338]341 ShortFormMap["translate-atoms"] = "t";
[6670a97]342 ShortFormMap["verbose"] = "v";
[97ebf8]343 ShortFormMap["verlet-integrate"] = "P";
[6670a97]344 ShortFormMap["version"] = "V";
[97ebf8]345
346 // value types for the actions
[e5c0a1]347 TypeMap["add-atom"] = &typeid(const element);
[ab9a27]348 TypeMap["bond-file"] = &typeid(std::string);
349 TypeMap["bond-table"] = &typeid(std::string);
350 TypeMap["boundary"] = &typeid(VectorValue);
351 TypeMap["center-in-box"] = &typeid(BoxValue);
352 TypeMap["change-box"] = &typeid(BoxValue);
[e5c0a1]353 TypeMap["change-element"] = &typeid(const element);
[ab9a27]354 TypeMap["change-molname"] = &typeid(std::string);
[e212ff]355 TypeMap["clear-atom-selection"] = &typeid(void);
[2218d94]356 TypeMap["clear-molecule-selection"] = &typeid(void);
[c449d9]357 TypeMap["construct-bondgraph"] = &typeid(void);
[1d9b7d2]358 TypeMap["convex-envelope"] = &typeid(void);
[1a7fd2]359 TypeMap["copy-molecule"] = &typeid(molecule);
[ab9a27]360 TypeMap["default-molname"] = &typeid(std::string);
361 TypeMap["depth-first-search"] = &typeid(double);
362 TypeMap["element-db"] = &typeid(std::string);
363 TypeMap["fastparsing"] = &typeid(bool);
364 TypeMap["fill-molecule"] = &typeid(std::string);
[eee966]365 TypeMap["fill-void"] = &typeid(std::string);
[ab9a27]366 TypeMap["fragment-mol"] = &typeid(std::string);
367 TypeMap["input"] = &typeid(std::string);
368 TypeMap["linear-interpolate"] = &typeid(std::string);
369 TypeMap["molecular-volume"] = &typeid(molecule);
[1d9b7d2]370 TypeMap["nonconvex-envelope"] = &typeid(double);
[ab9a27]371 TypeMap["output"] = &typeid(void);
372 TypeMap["parse-xyz"] = &typeid(std::string);
[e65de8]373 TypeMap["pair-correlation"] = &typeid(void);
374 TypeMap["point-correlation"] = &typeid(void);
[b76394]375 TypeMap["principal-axis-system"] = &typeid(void);
[446bc1]376 TypeMap["redo"] = &typeid(void);
[120088]377 TypeMap["remove-atom"] = &typeid(void);
[ab9a27]378 TypeMap["repeat-box"] = &typeid(VectorValue);
[eaf4ae]379 TypeMap["rotate-origin"] = &typeid(double);
380 TypeMap["rotate-self"] = &typeid(double);
381 TypeMap["rotate-to-pas"] = &typeid(VectorValue);
[ab9a27]382 TypeMap["save-adjacency"] = &typeid(std::string);
383 TypeMap["save-bonds"] = &typeid(std::string);
384 TypeMap["save-temperature"] = &typeid(std::string);
385 TypeMap["scale-box"] = &typeid(VectorValue);
[770287]386 TypeMap["select-all-atoms"] = &typeid(void);
387 TypeMap["select-all-molecules"] = &typeid(void);
[51769f]388 TypeMap["select-atom-by-element"] = &typeid(const element);
[770287]389 TypeMap["select-atom-by-id"] = &typeid(atom);
[1cc87e]390 TypeMap["select-atoms-inside-cuboid"] = &typeid(VectorValue);
391 TypeMap["select-atoms-inside-sphere"] = &typeid(double);
[51769f]392 TypeMap["select-molecule-by-formula"] = &typeid(std::string);
[770287]393 TypeMap["select-molecule-by-id"] = &typeid(molecule);
[481e92]394 TypeMap["select-molecule-of-atom"] = &typeid(atom);
[770287]395 TypeMap["select-molecules-atoms"] = &typeid(molecule);
[ab9a27]396 TypeMap["set-basis"] = &typeid(std::string);
397 TypeMap["set-output"] = &typeid(std::vector<std::string>);
398 TypeMap["subgraph-dissect"] = &typeid(void);
[e65de8]399 TypeMap["surface-correlation"] = &typeid(void);
[ab9a27]400 TypeMap["suspend-in-water"] = &typeid(double);
[34c338]401 TypeMap["translate-atoms"] = &typeid(VectorValue);
[446bc1]402 TypeMap["undo"] = &typeid(void);
[770287]403 TypeMap["unselect-all-atoms"] = &typeid(void);
404 TypeMap["unselect-all-molecules"] = &typeid(void);
[51769f]405 TypeMap["unselect-atom-by-element"] = &typeid(const element);
[770287]406 TypeMap["unselect-atom-by-id"] = &typeid(atom);
[1cc87e]407 TypeMap["unselect-atoms-inside-cuboid"] = &typeid(VectorValue);
408 TypeMap["unselect-atoms-inside-sphere"] = &typeid(double);
[51769f]409 TypeMap["unselect-molecule-by-formula"] = &typeid(std::string);
[770287]410 TypeMap["unselect-molecule-by-id"] = &typeid(molecule);
[75a80f]411 TypeMap["unselect-molecule-of-atom"] = &typeid(atom);
[381c5f]412 TypeMap["unselect-molecules-atoms"] = &typeid(molecule);
[ab9a27]413 TypeMap["verlet-integrate"] = &typeid(std::string);
414 TypeMap["verbose"] = &typeid(int);
[e30ce8]415
[97ebf8]416 // value types for the values
[31fb1d]417 TypeMap["angle-x"] = &typeid(double);
418 TypeMap["angle-y"] = &typeid(double);
419 TypeMap["angle-z"] = &typeid(double);
[ab9a27]420 TypeMap["bin-output-file"] = &typeid(std::string);
421 TypeMap["bin-end"] = &typeid(double);
422 TypeMap["bin-start"] = &typeid(double);
423 TypeMap["bin-width"] = &typeid(double);
424 TypeMap["convex-file"] = &typeid(std::string);
425 TypeMap["distance"] = &typeid(double);
426 TypeMap["distances"] = &typeid(VectorValue);
427 TypeMap["DoRotate"] = &typeid(bool);
[e5c0a1]428 TypeMap["element"] = &typeid(const element);
429 TypeMap["elements"] = &typeid(std::vector<const element *>);
[ab9a27]430 TypeMap["end-step"] = &typeid(int);
431 TypeMap["id-mapping"] = &typeid(bool);
432 TypeMap["length"] = &typeid(double);
433 TypeMap["lengths"] = &typeid(VectorValue);
434 TypeMap["MaxDistance"] = &typeid(double);
[e65de8]435 TypeMap["molecule-by-id"] = &typeid(molecule);
[ab9a27]436 TypeMap["nonconvex-file"] = &typeid(std::string);
437 TypeMap["order"] = &typeid(int);
438 TypeMap["output-file"] = &typeid(std::string);
439 TypeMap["periodic"] = &typeid(bool);
440 TypeMap["position"] = &typeid(VectorValue);
441 TypeMap["start-step"] = &typeid(int);
442
[0b0a20]443 TypeEnumMap[&typeid(void)] = None;
444 TypeEnumMap[&typeid(bool)] = Boolean;
[ab9a27]445 TypeEnumMap[&typeid(int)] = Integer;
[0b0a20]446 TypeEnumMap[&typeid(std::vector<int>)] = ListOfIntegers;
[ab9a27]447 TypeEnumMap[&typeid(double)] = Double;
[0b0a20]448 TypeEnumMap[&typeid(std::vector<double>)] = ListOfDoubles;
[ab9a27]449 TypeEnumMap[&typeid(std::string)] = String;
[0b0a20]450 TypeEnumMap[&typeid(std::vector<std::string>)] = ListOfStrings;
451 TypeEnumMap[&typeid(VectorValue)] = Vector;
[39b639]452 TypeEnumMap[&typeid(std::vector<VectorValue>)] = ListOfVectors;
[0b0a20]453 TypeEnumMap[&typeid(BoxValue)] = Box;
454 TypeEnumMap[&typeid(molecule)] = Molecule;
455 TypeEnumMap[&typeid(std::vector<molecule *>)] = ListOfMolecules;
[ab9a27]456 TypeEnumMap[&typeid(atom)] = Atom;
[0b0a20]457 TypeEnumMap[&typeid(std::vector<atom *>)] = ListOfAtoms;
[e5c0a1]458 TypeEnumMap[&typeid(const element)] = Element;
459 TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElements;
[97ebf8]460
[e30ce8]461 // default values for any action that needs one (always string!)
[ab9a27]462 CurrentValue["bin-width"] = "0.5";
463 CurrentValue["fastparsing"] = "0";
464 CurrentValue["periodic"] = "0";
[e30ce8]465
[326bbe]466 // put action into each menu category
[b2531f]467 MenuDescription["analysis"] = pair<std::string,std::string>("Analysis (pair correlation, volume)", "Analysis");
[5b5c4d]468 MenuDescription["atom"] = pair<std::string,std::string>("Edit atoms", "Atoms");
469 MenuDescription["command"] = pair<std::string,std::string>("Configuration", "configuration options");
[b2531f]470 MenuDescription["fragmentation"] = pair<std::string,std::string>("Fragmentation", "Fragmentation");
[5b5c4d]471 MenuDescription["molecule"] = pair<std::string,std::string>("Parse files into system", "Molecules");
472 MenuDescription["parser"] = pair<std::string,std::string>("Edit molecules (load, parse, save)", "Input/Output");
473 MenuDescription["selection"] = pair<std::string,std::string>("Select atoms/molecules", "Selection");
474 MenuDescription["tesselation"] = pair<std::string,std::string>("Tesselate molecules", "Tesselation");
475 MenuDescription["world"] = pair<std::string,std::string>("Edit world", "Globals");
[b2531f]476
[326bbe]477 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "molecular-volume") );
478 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "pair-correlation") );
[e65de8]479 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "point-correlation") );
480 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "surface-correlation") );
[326bbe]481 MenuContainsActionMap.insert( pair<std::string, std::string> ("analysis", "principal-axis-system") );
[e30ce8]482
[326bbe]483 MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "add-atom") );
484 MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "change-element") );
485 MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "remove-atom") );
[34c338]486 MenuContainsActionMap.insert( pair<std::string, std::string> ("atom", "translate-atoms") );
[326bbe]487
488 MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "bond-table") );
489 MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "element-db") );
490 MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "fastparsing") );
491 MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "verbose") );
492 MenuContainsActionMap.insert( pair<std::string, std::string> ("command", "version") );
493
[c449d9]494 MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "construct-bondgraph") );
[326bbe]495 MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "depth-first-search") );
496 MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "fragment-mol") );
497 MenuContainsActionMap.insert( pair<std::string, std::string> ("fragmentation", "subgraph-dissect") );
498
499 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "bond-file") );
[1a7fd2]500 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "copy-molecule") );
[326bbe]501 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "change-molname") );
502 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") );
[eee966]503 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-void") );
[326bbe]504 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") );
[eaf4ae]505 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-origin") );
506 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-self") );
[326bbe]507 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-to-pas") );
508 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-adjacency") );
509 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-bonds") );
510 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "save-temperature") );
511 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "suspend-in-water") );
512 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "verlet-integrate") );
513
514 MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "parse-xyz") );
515 MenuContainsActionMap.insert( pair<std::string, std::string> ("parser", "SaveXyz") );
516
[e212ff]517 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "clear-atom-selection") );
[2218d94]518 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "clear-molecule-selection") );
[e212ff]519 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-atoms") );
520 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-molecules") );
[51769f]521 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-element") );
[5b5c4d]522 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-id") );
[1cc87e]523 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-cuboid") );
524 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-sphere") );
[5b5c4d]525 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-id") );
[51769f]526 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-formula") );
[481e92]527 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-of-atom") );
[770287]528 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecules-atoms") );
[e212ff]529 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-atoms") );
530 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-molecules") );
[51769f]531 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-element") );
[5b5c4d]532 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-id") );
[1cc87e]533 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-cuboid") );
534 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-sphere") );
[51769f]535 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-formula") );
[5b5c4d]536 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-id") );
[75a80f]537 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-of-atom") );
[381c5f]538 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecules-atoms") );
[5b5c4d]539
[326bbe]540 MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "convex-envelope") );
541 MenuContainsActionMap.insert( pair<std::string, std::string> ("tesselation", "nonconvex-envelope") );
542
543 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "boundary") );
544 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "bound-in-box") );
545 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-in-box") );
546 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "center-edge") );
547 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "change-box") );
548 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "input") );
549 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "output") );
550 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "repeat-box") );
551 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "scale-box") );
552 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "default-molname") );
553 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-basis") );
[b9c847]554 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "set-output") );
[326bbe]555
556 // put actions into command line category
[f0a3ec]557 generic.insert("add-atom");
[f4bd01]558 generic.insert("bond-file");
[39af9f]559 generic.insert("bond-table");
[116f37]560 generic.insert("boundary");
[97ebf8]561// generic.insert("bound-in-box");
[584a2a]562 generic.insert("center-edge");
[158c594]563 generic.insert("center-in-box");
[6ca1f7]564 generic.insert("change-box");
[97ebf8]565// generic.insert("change-molname");
[e212ff]566 generic.insert("change-element");
567 generic.insert("clear-atom-selection");
[2218d94]568 generic.insert("clear-molecule-selection");
[c449d9]569 generic.insert("construct-bondgraph");
[f6bd32]570 generic.insert("convex-envelope");
[1a7fd2]571 generic.insert("copy-molecule");
[387b36]572 generic.insert("default-molname");
[8540f0]573 generic.insert("depth-first-search");
[198494]574 generic.insert("element-db");
[f821d6]575 generic.insert("fastparsing");
[0286bc]576 generic.insert("fill-molecule");
[eee966]577 generic.insert("fill-void");
[e4b5de]578 generic.insert("fragment-mol");
[97ebf8]579 generic.insert("help");
[4f7f34e]580 generic.insert("input");
581 generic.insert("linear-interpolate");
[97ebf8]582// generic.insert("molecular-volume");
[980dd6]583 generic.insert("nonconvex-envelope");
[4f7f34e]584 generic.insert("output");
[58bbd3]585 generic.insert("pair-correlation");
[a1e929]586 generic.insert("parse-xyz");
[e65de8]587 generic.insert("point-correlation");
[97ebf8]588// generic.insert("principal-axis-system");
[446bc1]589 generic.insert("redo");
[d55743e]590 generic.insert("remove-atom");
[0286bc]591 generic.insert("repeat-box");
[eaf4ae]592 generic.insert("rotate-origin");
593 generic.insert("rotate-self");
[2b5574]594 generic.insert("rotate-to-pas");
[77de81]595 generic.insert("save-adjacency");
596 generic.insert("save-bonds");
[a307af]597 generic.insert("save-temperature");
[2a92ff]598 generic.insert("scale-box");
[e472eab]599 generic.insert("select-all-atoms");
600 generic.insert("select-all-molecules");
[51769f]601 generic.insert("select-atom-by-element");
[e472eab]602 generic.insert("select-atom-by-id");
[1cc87e]603 generic.insert("select-atoms-inside-cuboid");
604 generic.insert("select-atoms-inside-sphere");
[e472eab]605 generic.insert("select-molecule-by-id");
[51769f]606 generic.insert("select-molecule-by-formula");
[481e92]607 generic.insert("select-molecule-of-atom");
[770287]608 generic.insert("select-molecules-atoms");
[bdaacd]609 generic.insert("set-basis");
[b9c847]610 generic.insert("set-output");
[6866aa]611 generic.insert("subgraph-dissect");
[e65de8]612 generic.insert("surface-correlation");
[48ab70a]613 generic.insert("suspend-in-water");
[34c338]614 generic.insert("translate-atoms");
[446bc1]615 generic.insert("undo");
[e472eab]616 generic.insert("unselect-all-atoms");
617 generic.insert("unselect-all-molecules");
[51769f]618 generic.insert("unselect-atom-by-element");
[e472eab]619 generic.insert("unselect-atom-by-id");
[1cc87e]620 generic.insert("unselect-atoms-inside-cuboid");
621 generic.insert("unselect-atoms-inside-sphere");
[51769f]622 generic.insert("unselect-molecule-by-formula");
[e472eab]623 generic.insert("unselect-molecule-by-id");
[75a80f]624 generic.insert("unselect-molecule-of-atom");
[381c5f]625 generic.insert("unselect-molecules-atoms");
[97ebf8]626 generic.insert("verbose");
[aacce8]627 generic.insert("verlet-integrate");
[97ebf8]628 generic.insert("version");
629
630 // positional arguments
[f6bd32]631 generic.insert("input");
[0286bc]632
633 // hidden arguments
[31fb1d]634 hidden.insert("angle-x");
635 hidden.insert("angle-y");
636 hidden.insert("angle-z");
[533838]637 hidden.insert("bin-end");
638 hidden.insert("bin-output-file");
639 hidden.insert("bin-start");
640 hidden.insert("bin-width");
641 hidden.insert("convex-file");
642 hidden.insert("distance");
643 hidden.insert("DoRotate");
644 hidden.insert("distances");
645 hidden.insert("element");
646 hidden.insert("elements");
647 hidden.insert("end-step");
648 hidden.insert("id-mapping");
649 hidden.insert("lengths");
650 hidden.insert("MaxDistance");
[e65de8]651 hidden.insert("molecule-by-id");
[533838]652 hidden.insert("nonconvex-file");
653 hidden.insert("order");
654 hidden.insert("output-file");
655 hidden.insert("periodic");
656 hidden.insert("position");
657 hidden.insert("start-step");
[97ebf8]658}
659
660/** Destructor of class MapOfActions.
661 *
662 */
663MapOfActions::~MapOfActions()
664{
665 DescriptionMap.clear();
666}
667
[03c902]668bool MapOfActions::isCurrentValuePresent(const char *name) const
669{
670 return (CurrentValue.find(name) != CurrentValue.end());
671}
672
[d02e07]673void MapOfActions::queryCurrentValue(const char * name, class atom * &_T)
674{
675 int atomID = -1;
[4e145c]676 if (typeid( atom ) == *TypeMap[name]) {
677 if (CurrentValue.find(name) == CurrentValue.end())
678 throw MissingValueException(__FILE__, __LINE__);
[d02e07]679 atomID = lexical_cast<int>(CurrentValue[name].c_str());
[4e145c]680 CurrentValue.erase(name);
681 } else
[d02e07]682 throw IllegalTypeException(__FILE__,__LINE__);
683 _T = World::getInstance().getAtom(AtomById(atomID));
684}
685
[e5c0a1]686void MapOfActions::queryCurrentValue(const char * name, const element * &_T) {
[d02e07]687 int Z = -1;
[e5c0a1]688 if (typeid(const element ) == *TypeMap[name]) {
[4e145c]689 if (CurrentValue.find(name) == CurrentValue.end())
690 throw MissingValueException(__FILE__, __LINE__);
[d02e07]691 Z = lexical_cast<int>(CurrentValue[name].c_str());
[4e145c]692 CurrentValue.erase(name);
693 } else
[d02e07]694 throw IllegalTypeException(__FILE__,__LINE__);
695 _T = World::getInstance().getPeriode()->FindElement(Z);
696}
697
698void MapOfActions::queryCurrentValue(const char * name, class molecule * &_T) {
699 int molID = -1;
[4e145c]700 if (typeid( molecule ) == *TypeMap[name]) {
701 if (CurrentValue.find(name) == CurrentValue.end())
702 throw MissingValueException(__FILE__, __LINE__);
[d02e07]703 molID = lexical_cast<int>(CurrentValue[name].c_str());
[4e145c]704 CurrentValue.erase(name);
705 } else
[d02e07]706 throw IllegalTypeException(__FILE__,__LINE__);
707 _T = World::getInstance().getMolecule(MoleculeById(molID));
708}
709
710void MapOfActions::queryCurrentValue(const char * name, class Box &_T) {
711 Matrix M;
712 double tmp;
713 if (typeid( BoxValue ) == *TypeMap[name]) {
[4e145c]714 if (CurrentValue.find(name) == CurrentValue.end())
715 throw MissingValueException(__FILE__, __LINE__);
[d02e07]716 std::istringstream stream(CurrentValue[name]);
717 stream >> tmp;
718 M.set(0,0,tmp);
719 stream >> tmp;
720 M.set(0,1,tmp);
721 M.set(1,0,tmp);
722 stream >> tmp;
723 M.set(0,2,tmp);
724 M.set(2,0,tmp);
725 stream >> tmp;
726 M.set(1,1,tmp);
727 stream >> tmp;
728 M.set(1,2,tmp);
729 M.set(2,1,tmp);
730 stream >> tmp;
731 M.set(2,2,tmp);
[39b639]732 _T = M;
733 CurrentValue.erase(name);
[d02e07]734 } else
735 throw IllegalTypeException(__FILE__,__LINE__);
736}
737
738void MapOfActions::queryCurrentValue(const char * name, class Vector &_T) {
739 if (typeid( VectorValue ) == *TypeMap[name]) {
740 std::istringstream stream(CurrentValue[name]);
[4e145c]741 CurrentValue.erase(name);
[d02e07]742 stream >> _T[0];
743 stream >> _T[1];
744 stream >> _T[2];
745 } else
746 throw IllegalTypeException(__FILE__,__LINE__);
747}
748
[72f611]749void MapOfActions::queryCurrentValue(const char * name, class BoxVector &_T) {
750 if (typeid( VectorValue ) == *TypeMap[name]) {
751 std::istringstream stream(CurrentValue[name]);
752 CurrentValue.erase(name);
753 stream >> _T[0];
754 stream >> _T[1];
755 stream >> _T[2];
756 } else
757 throw IllegalTypeException(__FILE__,__LINE__);
758}
759
[0b0a20]760void MapOfActions::queryCurrentValue(const char * name, std::vector<atom *>&_T)
761{
762 int atomID = -1;
763 atom *Walker = NULL;
764 if (typeid( std::vector<atom *> ) == *TypeMap[name]) {
765 if (CurrentValue.find(name) == CurrentValue.end())
766 throw MissingValueException(__FILE__, __LINE__);
767 std::istringstream stream(CurrentValue[name]);
768 CurrentValue.erase(name);
769 while (!stream.fail()) {
[e65de8]770 stream >> atomID >> ws;
[0b0a20]771 Walker = World::getInstance().getAtom(AtomById(atomID));
772 if (Walker != NULL)
773 _T.push_back(Walker);
[e65de8]774 atomID = -1;
775 Walker = NULL;
[0b0a20]776 }
777 } else
778 throw IllegalTypeException(__FILE__,__LINE__);
779}
780
[e5c0a1]781void MapOfActions::queryCurrentValue(const char * name, std::vector<const element *>&_T)
[d02e07]782{
783 int Z = -1;
[e5c0a1]784 const element *elemental = NULL;
785 if (typeid( std::vector<const element *> ) == *TypeMap[name]) {
[4e145c]786 if (CurrentValue.find(name) == CurrentValue.end())
787 throw MissingValueException(__FILE__, __LINE__);
[d02e07]788 std::istringstream stream(CurrentValue[name]);
[4e145c]789 CurrentValue.erase(name);
[d02e07]790 while (!stream.fail()) {
[e65de8]791 stream >> Z >> ws;
[d02e07]792 elemental = World::getInstance().getPeriode()->FindElement(Z);
793 if (elemental != NULL)
794 _T.push_back(elemental);
[e65de8]795 Z = -1;
[d02e07]796 }
797 } else
798 throw IllegalTypeException(__FILE__,__LINE__);
799}
800
[0b0a20]801void MapOfActions::queryCurrentValue(const char * name, std::vector<molecule *>&_T)
[3e54d0]802{
[0b0a20]803 int molID = -1;
804 molecule *mol = NULL;
805 if (typeid( std::vector<molecule *> ) == *TypeMap[name]) {
[4e145c]806 if (CurrentValue.find(name) == CurrentValue.end())
807 throw MissingValueException(__FILE__, __LINE__);
[3e54d0]808 std::istringstream stream(CurrentValue[name]);
[4e145c]809 CurrentValue.erase(name);
[3e54d0]810 while (!stream.fail()) {
[e65de8]811 stream >> molID >> ws;
[0b0a20]812 mol = World::getInstance().getMolecule(MoleculeById(molID));
813 if (mol != NULL)
814 _T.push_back(mol);
[e65de8]815 molID = -1;
816 mol = NULL;
[3e54d0]817 }
818 } else
819 throw IllegalTypeException(__FILE__,__LINE__);
820}
821
[d02e07]822
823void MapOfActions::setCurrentValue(const char * name, class atom * &_T)
824{
825 if (typeid( atom ) == *TypeMap[name]) {
826 std::ostringstream stream;
827 stream << _T->getId();
828 CurrentValue[name] = stream.str();
829 } else
830 throw IllegalTypeException(__FILE__,__LINE__);
831}
832
[e5c0a1]833void MapOfActions::setCurrentValue(const char * name, const element * &_T)
[d02e07]834{
[e5c0a1]835 if (typeid(const element ) == *TypeMap[name]) {
[d02e07]836 std::ostringstream stream;
[83f176]837 stream << _T->getAtomicNumber();
[d02e07]838 CurrentValue[name] = stream.str();
839 } else
840 throw IllegalTypeException(__FILE__,__LINE__);
841}
842
843void MapOfActions::setCurrentValue(const char * name, class molecule * &_T)
844{
845 if (typeid( molecule ) == *TypeMap[name]) {
846 std::ostringstream stream;
847 stream << _T->getId();
848 CurrentValue[name] = stream.str();
849 } else
850 throw IllegalTypeException(__FILE__,__LINE__);
851}
852
853void MapOfActions::setCurrentValue(const char * name, class Box &_T)
854{
855 const Matrix &M = _T.getM();
[39b639]856 if (typeid( BoxValue ) == *TypeMap[name]) {
[d02e07]857 std::ostringstream stream;
858 stream << M.at(0,0) << " ";
859 stream << M.at(0,1) << " ";
860 stream << M.at(0,2) << " ";
861 stream << M.at(1,1) << " ";
862 stream << M.at(1,2) << " ";
863 stream << M.at(2,2) << " ";
864 CurrentValue[name] = stream.str();
865 } else
866 throw IllegalTypeException(__FILE__,__LINE__);
867}
868
869void MapOfActions::setCurrentValue(const char * name, class Vector &_T)
870{
[39b639]871 if (typeid( VectorValue ) == *TypeMap[name]){
[d02e07]872 std::ostringstream stream;
873 stream << _T[0] << " ";
874 stream << _T[1] << " ";
875 stream << _T[2] << " ";
876 CurrentValue[name] = stream.str();
877 } else
878 throw IllegalTypeException(__FILE__,__LINE__);
879}
880
[72f611]881void MapOfActions::setCurrentValue(const char * name, class BoxVector &_T)
882{
883 if (typeid( VectorValue ) == *TypeMap[name]){
884 std::ostringstream stream;
885 stream << _T[0] << " ";
886 stream << _T[1] << " ";
887 stream << _T[2] << " ";
888 CurrentValue[name] = stream.str();
889 } else
890 throw IllegalTypeException(__FILE__,__LINE__);
891}
892
[0b0a20]893void MapOfActions::setCurrentValue(const char * name, std::vector<atom *>&_T)
894{
895 if (typeid( std::vector<atom *> ) == *TypeMap[name]) {
896 std::ostringstream stream;
897 for (std::vector<atom *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
898 stream << (*iter)->getId() << " ";
899 }
900 CurrentValue[name] = stream.str();
901 } else
902 throw IllegalTypeException(__FILE__,__LINE__);
903}
904
[e5c0a1]905void MapOfActions::setCurrentValue(const char * name, std::vector<const element *>&_T)
[d02e07]906{
[e5c0a1]907 if (typeid( std::vector<const element *> ) == *TypeMap[name]) {
[d02e07]908 std::ostringstream stream;
[e5c0a1]909 for (std::vector<const element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
[83f176]910 stream << (*iter)->getAtomicNumber() << " ";
[d02e07]911 }
912 CurrentValue[name] = stream.str();
913 } else
914 throw IllegalTypeException(__FILE__,__LINE__);
915}
916
[0b0a20]917void MapOfActions::setCurrentValue(const char * name, std::vector<molecule *>&_T)
[3e54d0]918{
[0b0a20]919 if (typeid( std::vector<molecule *> ) == *TypeMap[name]) {
[3e54d0]920 std::ostringstream stream;
[0b0a20]921 for (std::vector<molecule *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
922 stream << (*iter)->getId() << " ";
[3e54d0]923 }
924 CurrentValue[name] = stream.str();
925 } else
926 throw IllegalTypeException(__FILE__,__LINE__);
927}
928
[d02e07]929
[326bbe]930
931void MapOfActions::populateActions()
932{
933 new AnalysisMolecularVolumeAction();
934 new AnalysisPairCorrelationAction();
[d02e07]935 new AnalysisPointCorrelationAction();
[326bbe]936 new AnalysisPrincipalAxisSystemAction();
[d02e07]937 new AnalysisSurfaceCorrelationAction();
[326bbe]938
939 new AtomAddAction();
940 new AtomChangeElementAction();
941 new AtomRemoveAction();
[22c44bf]942 new AtomRotateAroundOriginByAngleAction();
[34c338]943 new AtomTranslateAction();
[326bbe]944
[53d01c]945 new CommandBondLengthTableAction();
946 new CommandElementDbAction();
947 new CommandFastParsingAction();
948 new CommandHelpAction();
949 new CommandVerboseAction();
950 new CommandVersionAction();
[326bbe]951
[1a7fd2]952 new FragmentationConstructBondGraphAction();
[326bbe]953 new FragmentationDepthFirstSearchAction();
954 new FragmentationFragmentationAction();
955 new FragmentationSubgraphDissectionAction();
956
957 new MoleculeBondFileAction();
958 new MoleculeChangeNameAction();
[1a7fd2]959 new MoleculeCopyAction();
[326bbe]960 new MoleculeFillWithMoleculeAction();
[eee966]961 new MoleculeFillVoidWithMoleculeAction();
[326bbe]962 new MoleculeLinearInterpolationofTrajectoriesAction();
[eaf4ae]963 new MoleculeRotateAroundSelfByAngleAction();
[b2531f]964 new MoleculeRotateToPrincipalAxisSystemAction();
[326bbe]965 new MoleculeSaveAdjacencyAction();
966 new MoleculeSaveBondsAction();
967 new MoleculeSaveTemperatureAction();
[b2531f]968 new MoleculeSuspendInWaterAction();
[326bbe]969 new MoleculeVerletIntegrationAction();
970
971 new ParserLoadXyzAction();
972 new ParserSaveXyzAction();
973
[e212ff]974 new SelectionClearAllAtomsAction();
[2218d94]975 new SelectionClearAllMoleculesAction();
[e472eab]976 new SelectionAllAtomsAction();
[1cc87e]977 new SelectionAllAtomsInsideCuboidAction();
978 new SelectionAllAtomsInsideSphereAction();
[770287]979 new SelectionAllAtomsOfMoleculeAction();
[e472eab]980 new SelectionAllMoleculesAction();
[51769f]981 new SelectionAtomByElementAction();
[533838]982 new SelectionAtomByIdAction();
983 new SelectionMoleculeByIdAction();
[51769f]984 new SelectionMoleculeByFormulaAction();
[481e92]985 new SelectionMoleculeOfAtomAction();
[e472eab]986 new SelectionNotAllAtomsAction();
[1cc87e]987 new SelectionNotAllAtomsInsideCuboidAction();
988 new SelectionNotAllAtomsInsideSphereAction();
[381c5f]989 new SelectionNotAllAtomsOfMoleculeAction();
[e472eab]990 new SelectionNotAllMoleculesAction();
[51769f]991 new SelectionNotAtomByElementAction();
[533838]992 new SelectionNotAtomByIdAction();
[51769f]993 new SelectionNotMoleculeByFormulaAction();
[533838]994 new SelectionNotMoleculeByIdAction();
[75a80f]995 new SelectionNotMoleculeOfAtomAction();
[533838]996
[326bbe]997 new TesselationConvexEnvelopeAction();
998 new TesselationNonConvexEnvelopeAction();
999
1000 new WorldAddEmptyBoundaryAction();
1001 new WorldBoundInBoxAction();
1002 new WorldCenterInBoxAction();
1003 new WorldCenterOnEdgeAction();
1004 new WorldChangeBoxAction();
1005 new WorldInputAction();
1006 new WorldOutputAction();
1007 new WorldRepeatBoxAction();
1008 new WorldScaleBoxAction();
1009 new WorldSetDefaultNameAction();
1010 new WorldSetGaussianBasisAction();
[b9c847]1011 new WorldSetOutputFormatsAction();
[326bbe]1012}
1013
[97ebf8]1014/** Adds all options to the CommandLineParser.
1015 *
1016 */
1017void MapOfActions::AddOptionsToParser()
1018{
1019 // add other options
1020 for (map< set<string>*, po::options_description* >::iterator ListRunner = CmdParserLookup.begin(); ListRunner != CmdParserLookup.end(); ++ListRunner) {
1021 for (set<string>::iterator OptionRunner = ListRunner->first->begin(); OptionRunner != ListRunner->first->end(); ++OptionRunner) {
1022 if (hasValue(*OptionRunner)) {
[e65de8]1023 DoLog(1) && (Log() << Verbose(1) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner]->name() << " to CommandLineParser." << endl);
[ab9a27]1024 switch(TypeEnumMap[TypeMap[*OptionRunner]]) {
[97ebf8]1025 default:
1026 case None:
1027 ListRunner->second->add_options()
1028 (getKeyAndShortForm(*OptionRunner).c_str(), getDescription(*OptionRunner).c_str())
1029 ;
1030 break;
1031 case Boolean:
1032 ListRunner->second->add_options()
[e30ce8]1033 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1034 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
[39b639]1035 po::value< bool >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
[e30ce8]1036 po::value< bool >(),
1037 getDescription(*OptionRunner).c_str())
[97ebf8]1038 ;
1039 break;
[0286bc]1040 case Box:
1041 ListRunner->second->add_options()
1042 (getKeyAndShortForm(*OptionRunner).c_str(),
[39b639]1043 po::value<BoxValue>(),
[0286bc]1044 getDescription(*OptionRunner).c_str())
1045 ;
1046 break;
[97ebf8]1047 case Integer:
1048 ListRunner->second->add_options()
[e30ce8]1049 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1050 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
[39b639]1051 po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
[e30ce8]1052 po::value< int >(),
1053 getDescription(*OptionRunner).c_str())
[97ebf8]1054 ;
1055 break;
[0b0a20]1056 case ListOfIntegers:
[97ebf8]1057 ListRunner->second->add_options()
[e30ce8]1058 (getKeyAndShortForm(*OptionRunner).c_str(),
1059 po::value< vector<int> >()->multitoken(),
1060 getDescription(*OptionRunner).c_str())
[97ebf8]1061 ;
1062 break;
1063 case Double:
1064 ListRunner->second->add_options()
[e30ce8]1065 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1066 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
[39b639]1067 po::value< double >()->default_value(lexical_cast<double>(CurrentValue[*OptionRunner].c_str())) :
[e30ce8]1068 po::value< double >(),
1069 getDescription(*OptionRunner).c_str())
[97ebf8]1070 ;
1071 break;
1072 case ListOfDoubles:
1073 ListRunner->second->add_options()
[e30ce8]1074 (getKeyAndShortForm(*OptionRunner).c_str(),
1075 po::value< vector<double> >()->multitoken(),
1076 getDescription(*OptionRunner).c_str())
[97ebf8]1077 ;
1078 break;
1079 case String:
1080 ListRunner->second->add_options()
[e30ce8]1081 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1082 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
1083 po::value< std::string >()->default_value(CurrentValue[*OptionRunner]) :
[e30ce8]1084 po::value< std::string >(),
1085 getDescription(*OptionRunner).c_str())
[97ebf8]1086 ;
1087 break;
[0b0a20]1088 case ListOfStrings:
[cd8e55]1089 ListRunner->second->add_options()
1090 (getKeyAndShortForm(*OptionRunner).c_str(),
1091 po::value< vector<std::string> >()->multitoken(),
1092 getDescription(*OptionRunner).c_str())
1093 ;
1094 break;
[0b0a20]1095 case Vector:
[97ebf8]1096 ListRunner->second->add_options()
[e30ce8]1097 (getKeyAndShortForm(*OptionRunner).c_str(),
[0b0a20]1098 po::value<VectorValue>(),
[e30ce8]1099 getDescription(*OptionRunner).c_str())
[97ebf8]1100 ;
1101 break;
[0b0a20]1102 case ListOfVectors:
[97ebf8]1103 ListRunner->second->add_options()
[e30ce8]1104 (getKeyAndShortForm(*OptionRunner).c_str(),
[0b0a20]1105 po::value< vector<VectorValue> >()->multitoken(),
[e30ce8]1106 getDescription(*OptionRunner).c_str())
[97ebf8]1107 ;
1108 break;
1109 case Molecule:
1110 ListRunner->second->add_options()
[e30ce8]1111 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1112 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
[39b639]1113 po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
[e30ce8]1114 po::value< int >(),
1115 getDescription(*OptionRunner).c_str())
[97ebf8]1116 ;
1117 break;
1118 case ListOfMolecules:
1119 ListRunner->second->add_options()
[e30ce8]1120 (getKeyAndShortForm(*OptionRunner).c_str(),
1121 po::value< vector<int> >()->multitoken(),
1122 getDescription(*OptionRunner).c_str())
[97ebf8]1123 ;
1124 break;
1125 case Atom:
1126 ListRunner->second->add_options()
[e30ce8]1127 (getKeyAndShortForm(*OptionRunner).c_str(),
[ab9a27]1128 CurrentValue.find(*OptionRunner) != CurrentValue.end() ?
[39b639]1129 po::value< int >()->default_value(lexical_cast<int>(CurrentValue[*OptionRunner].c_str())) :
[e30ce8]1130 po::value< int >(),
1131 getDescription(*OptionRunner).c_str())
[97ebf8]1132 ;
1133 break;
1134 case ListOfAtoms:
1135 ListRunner->second->add_options()
[e30ce8]1136 (getKeyAndShortForm(*OptionRunner).c_str(),
1137 po::value< vector<int> >()->multitoken(),
1138 getDescription(*OptionRunner).c_str())
[97ebf8]1139 ;
1140 break;
1141 case Element:
1142 ListRunner->second->add_options()
[e30ce8]1143 (getKeyAndShortForm(*OptionRunner).c_str(),
[39b639]1144 po::value< int >(),
[e30ce8]1145 getDescription(*OptionRunner).c_str())
[97ebf8]1146 ;
1147 break;
1148 case ListOfElements:
1149 ListRunner->second->add_options()
[e30ce8]1150 (getKeyAndShortForm(*OptionRunner).c_str(),
1151 po::value< vector<int> >()->multitoken(),
1152 getDescription(*OptionRunner).c_str())
[97ebf8]1153 ;
1154 break;
1155 }
1156 } else {
[0b0a20]1157 DoLog(3) && (Log() << Verbose(3) << "Adding option " << *OptionRunner << " to CommandLineParser." << endl);
[97ebf8]1158 ListRunner->second->add_options()
1159 (getKeyAndShortForm(*OptionRunner).c_str(), getDescription(*OptionRunner).c_str())
1160 ;
1161 }
1162 }
1163 }
1164}
1165
1166/** Getter for MapOfActions:DescriptionMap.
1167 * Note that we assert when action does not exist in CommandLineParser::DescriptionMap.
1168 * \param actionname name of the action to lookup
1169 * \return Description of the action
1170 */
1171std::string MapOfActions::getDescription(string actionname)
1172{
1173 ASSERT(DescriptionMap.find(actionname) != DescriptionMap.end(), "Unknown action name passed to MapOfActions::getDescription");
1174 return DescriptionMap[actionname];
1175}
1176
1177/** Specific Getter for a MapOfActions:ShortFormMap.
1178 * If action has a short for, then combination is as "actionname,ShortForm" (this is
1179 * the desired format for boost::program_options). If no short form exists in the map,
1180 * just actionname will be returned
1181 * Note that we assert when action does not exist in CommandLineParser::DescriptionMap.
1182 * \param actionname name of the action to lookup
1183 * \return actionname,ShortForm or Description of the action
1184 */
1185std::string MapOfActions::getKeyAndShortForm(string actionname)
1186{
1187 stringstream output;
1188 ASSERT(DescriptionMap.find(actionname) != DescriptionMap.end(), "Unknown action name passed to MapOfActions::getDescriptionAndShortForm");
1189 output << actionname;
1190 if (ShortFormMap.find(actionname) != DescriptionMap.end())
1191 output << "," << ShortFormMap[actionname];
1192 return output.str();
1193}
1194
1195/** Getter for MapOfActions:ShortFormMap.
1196 * Note that we assert when action does not exist CommandLineParser::ShortFormMap.
1197 * \param actionname name of the action to lookup
1198 * \return ShortForm of the action
1199 */
1200std::string MapOfActions::getShortForm(string actionname)
1201{
1202 ASSERT(ShortFormMap.find(actionname) != ShortFormMap.end(), "Unknown action name passed to MapOfActions::getShortForm");
1203 return ShortFormMap[actionname];
1204}
1205
1206/** Returns whether the given action needs a value or not.
1207 * \param actionname name of the action to look up
1208 * \return true - value is needed, false - no value is stored in MapOfActions::TypeMap
1209 */
1210bool MapOfActions::hasValue(string actionname)
1211{
1212 return (TypeMap.find(actionname) != TypeMap.end());
1213}
1214
1215/** Getter for MapOfActions::TypeMap.
1216 * \param actionname name of the action to look up
1217 * \return type of the action
1218 */
[ab9a27]1219std::string MapOfActions::getValueType(string actionname)
[97ebf8]1220{
[ab9a27]1221 return TypeMap[actionname]->name();
[97ebf8]1222}
1223
1224/** Searches whether action is registered with CommandLineParser.
1225 * Note that this method is only meant transitionally for ParseCommandLineOptions' removal.
1226 * I.e. All actions that are already handled by the new CommandLineUIFactory can be checked
1227 * by this function.
1228 * \param shortform command short form to look for
1229 * \return true - action has been registered, false - action has not been registered.
1230 */
1231bool MapOfActions::isShortFormPresent(string shortform)
1232{
1233 bool result = false;
1234 string actionname;
1235 for (map<std::string, std::string>::iterator ShortFormRunner = ShortFormMap.begin(); ShortFormRunner != ShortFormMap.end(); ++ShortFormRunner)
1236 if (ShortFormRunner->second == shortform) {
1237 actionname = ShortFormRunner->first;
1238 break;
1239 }
1240 result = result || (generic.find(actionname) != generic.end());
1241 result = result || (config.find(actionname) != config.end());
1242 result = result || (hidden.find(actionname) != hidden.end());
1243 result = result || (visible.find(actionname) != visible.end());
1244 result = result || (inputfile.find(actionname) != inputfile.end());
1245 return result;
1246}
1247
[7e6b00]1248/** Returns the inverse to MapOfActions::ShortFormMap, i.e. lookup actionname for its short form.
1249 * \return map from short form of action to name of action
1250 */
1251map <std::string, std::string> MapOfActions::getShortFormToActionMap()
1252{
1253 map <std::string, std::string> result;
1254
1255 for (map<std::string, std::string>::iterator iter = ShortFormMap.begin(); iter != ShortFormMap.end(); ++iter)
1256 result[iter->second] = iter->first;
1257
1258 return result;
1259}
[97ebf8]1260
1261
1262CONSTRUCT_SINGLETON(MapOfActions)
Note: See TracBrowser for help on using the repository browser.