Changeset a82f61 for src


Ignore:
Timestamp:
Jul 28, 2015, 2:03:59 PM (10 years ago)
Author:
Frederik Heber <heber@…>
Branches:
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
Children:
42b40a
Parents:
143263
git-author:
Frederik Heber <heber@…> (07/19/15 12:39:16)
git-committer:
Frederik Heber <heber@…> (07/28/15 14:03:59)
Message:

Added Action::setOptionValue() which allows setting the option via a string.

  • this is preparatory for allowing the creation of MakroActions inside the code. We need to set the options without going through dialogs in some way or another and without being completely inside the Actions as is the case for the COMMAND variants and the python function calls.
Location:
src
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.hpp

    r143263 ra82f61  
    198198  virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const=0;
    199199
     200  /** Sets the option defined by \a _token to \a _value for this action.
     201   *
     202   * This is needed when constructing MakroActions.
     203   *
     204   * \param _token token of the option
     205   * \param _value new value
     206   */
     207  virtual void setOptionValue(const std::string &_token, const std::string &_value)=0;
     208
    200209  /**
    201210   * Traits resemble all necessary information that "surrounds" an action, such as
  • src/Actions/ActionSequence.cpp

    r143263 ra82f61  
    195195    (*it)->outputAsPython(ost, prefix);
    196196}
     197
     198void ActionSequence::setOptionValue(const std::string &_token, const std::string &_value)
     199{
     200  for(std::deque<Action*>::const_iterator it=actions.begin();it!=actions.end();++it)
     201    (*it)->setOptionValue(_token, _value);
     202}
  • src/Actions/ActionSequence.hpp

    r143263 ra82f61  
    5151  void outputAsCLI(std::ostream &ost) const;
    5252  void outputAsPython(std::ostream &ost, const std::string &prefix) const;
     53  void setOptionValue(const std::string &_token, const std::string &_value);
    5354
    5455protected:
  • src/Actions/Action_impl_header.hpp

    r143263 ra82f61  
    252252  } params;
    253253
     254  virtual void setOptionValue(const std::string &_token, const std::string &_value);
     255
    254256protected:
    255257  virtual Dialog * fillDialog(Dialog*);
  • src/Actions/Action_impl_pre.hpp

    r143263 ra82f61  
    222222        stringtype
    223223
     224// prints if ( token == "select-molecule-by-id" ) { prefix.ids.setAsString(_value); }
     225#define setparameterifmatch_print(z,n,container, reference, token, value) \
     226  if ( token == BOOST_PP_SEQ_ELEM(n, container) ) { \
     227    params. \
     228          BOOST_PP_SEQ_ELEM(n, reference) \
     229          .setAsString( \
     230          value \
     231          ); \
     232  }
    224233
    225234//#include "Actions/ActionTraits.hpp"
     
    301310#endif
    302311    {}
     312
     313void ACTION::setOptionValue(const std::string &_token, const std::string &_value)
     314{
     315  // check whether it is a valid token and set
     316#if defined paramtokens && defined paramreferences
     317#define BOOST_PP_LOCAL_MACRO(n) setparameterifmatch_print(~, n, paramtokens, paramreferences, _token, _value)
     318#define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
     319#include BOOST_PP_LOCAL_ITERATE()
     320#endif
     321}
    303322
    304323// =========== clone Action ===========
  • src/Actions/Calculation.hpp

    r143263 ra82f61  
    4747  virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const;
    4848
     49  virtual void setOptionValue(const std::string &_token, const std::string &_value);
     50
    4951  /**
    5052   * Does the actual calculation and returns the result.
  • src/Actions/Calculation_impl.hpp

    r143263 ra82f61  
    7878{}
    7979
     80template<typename T>
     81void Calculation<T>::setOptionValue(const std::string &_token, const std::string &_value)
     82{}
     83
    8084// methods for calculation infrastructure
    8185
  • src/Actions/MakroAction.cpp

    r143263 ra82f61  
    164164  actions.outputAsPython(ost, prefix);
    165165}
     166
     167void MakroAction::setOptionValue(const std::string &_token, const std::string &_value)
     168{
     169  actions.setOptionValue(_token, _value);
     170}
  • src/Actions/MakroAction.hpp

    r143263 ra82f61  
    4848  virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const;
    4949
     50  virtual void setOptionValue(const std::string &_token, const std::string &_value);
     51
    5052  // must be called after all primitive actions are present
    5153  virtual void prepare(ActionRegistry &AR);
  • src/Actions/ManipulateAtomsProcess.cpp

    r143263 ra82f61  
    9090{}
    9191
     92void ManipulateAtomsProcess::setOptionValue(const std::string &_token, const std::string &_value)
     93{}
     94
    9295void ManipulateAtomsProcess::doManipulate(World *world){
    9396  setMaxSteps(world->numAtoms());
  • src/Actions/ManipulateAtomsProcess.hpp

    r143263 ra82f61  
    4343  void outputAsPython(std::ostream &ost, const std::string &prefix) const;
    4444
     45  void setOptionValue(const std::string &_token, const std::string &_value);
     46
    4547  virtual void doManipulate(World *);
    4648
  • src/Actions/MethodAction.cpp

    r143263 ra82f61  
    9696void MethodAction::outputAsPython(std::ostream &ost, const std::string &prefix) const
    9797{}
     98
     99void MethodAction::setOptionValue(const std::string &_token, const std::string &_value)
     100{}
  • src/Actions/MethodAction.hpp

    r143263 ra82f61  
    3838  void outputAsCLI(std::ostream &ost) const;
    3939  void outputAsPython(std::ostream &ost, const std::string &prefix) const;
     40  void setOptionValue(const std::string &_token, const std::string &_value);
    4041
    4142protected:
  • src/Actions/unittests/ActionSequenceUnitTest.cpp

    r143263 ra82f61  
    9595  void outputAsPython(std::ostream &ost, const std::string &prefix) const
    9696  {}
     97  void setOptionValue(const std::string &_token, const std::string &_value)
     98  {}
    9799};
    98100
     
    134136  void outputAsPython(std::ostream &ost, const std::string &prefix) const
    135137  {}
     138  void setOptionValue(const std::string &_token, const std::string &_value)
     139  {}
    136140};
    137141
     
    175179  {}
    176180  void outputAsPython(std::ostream &ost, const std::string &prefix) const
     181  {}
     182  void setOptionValue(const std::string &_token, const std::string &_value)
    177183  {}
    178184  bool wasCalled(){
  • src/UIElements/Menu/TextMenu/TxMenuLeaveAction.cpp

    r143263 ra82f61  
    8585{}
    8686
     87void TxMenu::LeaveAction::setOptionValue(const std::string &_token, const std::string &_value)
     88{}
     89
    8790/** Internal function to construct the dialog.
    8891 * We do not need this function as there is no dialog to construct.
  • src/UIElements/Menu/TextMenu/TxMenuLeaveAction.hpp

    r143263 ra82f61  
    3737  void outputAsCLI(std::ostream &ost) const;
    3838  void outputAsPython(std::ostream &ost, const std::string &prefix) const;
     39  void setOptionValue(const std::string &_token, const std::string &_value);
    3940
    4041protected:
Note: See TracChangeset for help on using the changeset viewer.