Changeset c09f94 for src/Actions


Ignore:
Timestamp:
Apr 29, 2014, 12:42:44 PM (11 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:
0d4168
Parents:
d9f2b3
git-author:
Frederik Heber <heber@…> (08/26/13 22:19:31)
git-committer:
Frederik Heber <heber@…> (04/29/14 12:42:44)
Message:

Transformed FragmentationAutomationAction into a Process.

  • Removed MaxSteps parameter in Process' cstor (MaxSteps is not a const member anyway).
  • Action preprocessor magic knows new token BASECLASS by which derivation may be switche from Action to Process (defaults to Action).
  • FragmentationAutomationAction::performCall() uses start(), stop(), and setMaxSteps().
Location:
src/Actions
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action_impl_header.hpp

    rd9f2b3 rc09f94  
    194194};
    195195
     196#if defined BASECLASS
     197class ACTION : public BASECLASS {
     198#else
    196199class ACTION : public Action {
     200#endif
    197201  #if defined paramtypes && defined paramreferences
    198202  friend void COMMAND(
     
    271275#undef MENUPOSITION
    272276#undef TOKEN
     277#undef BASECLASS
    273278
    274279#undef DESCRIPTION
  • src/Actions/Action_impl_pre.hpp

    rd9f2b3 rc09f94  
    264264// =========== constructor ===========
    265265ACTION::ACTION () :
     266#if defined BASECLASS
     267  BASECLASS(ActionTraits< ACTION >())
     268#else
    266269  Action(ActionTraits< ACTION >())
     270#endif
    267271{}
    268272
  • src/Actions/Calculation_impl.hpp

    rd9f2b3 rc09f94  
    2424template<typename T>
    2525Calculation<T>::Calculation(int _maxSteps, const ActionTrait &_trait) :
    26   Process(_maxSteps,_trait),
     26  Process(_trait),
    2727  result(0),
    2828  done(false)
    29 {}
     29{
     30  setMaxSteps(_maxSteps);
     31}
    3032
    3133template<typename T>
  • src/Actions/FragmentationAction/FragmentationAction.def

    rd9f2b3 rc09f94  
    4747#define TOKEN "fragment-molecule"
    4848
    49 
    5049// finally the information stored in the ActionTrait specialization
    5150#define DESCRIPTION "create for a given molecule into fragments up to given order"
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    rd9f2b3 rc09f94  
    7373#include "World.hpp"
    7474
     75#include <boost/bind.hpp>
     76#include <boost/thread.hpp>
    7577#include <fstream>
    7678#include <iostream>
     
    9597{
    9698  return NULL;
     99}
     100
     101static void updateSteps(Process &p, const size_t step, const size_t total)
     102{
     103  LOG(1, "There are " << step << " steps out of " << total << " done.");
     104  p.setCurrStep(step);
    97105}
    98106
     
    126134
    127135    // Phase Three: calculate result
    128     mpqccontroller.waitforResults(NumberJobs);
     136    setMaxSteps(NumberJobs);
     137    mpqccontroller.setUpdateHandler(
     138        boost::bind(&updateSteps, boost::ref(*this), _1, _2)
     139        );
     140    start();
     141    boost::thread wait_thread(
     142        boost::bind(&MPQCFragmentController::waitforResults, boost::ref(mpqccontroller), boost::cref(NumberJobs))
     143    );
     144    wait_thread.join();
     145    stop();
    129146    mpqccontroller.getResults(shortrangedata);
    130147
  • src/Actions/FragmentationAction/FragmentationAutomationAction.def

    rd9f2b3 rc09f94  
    4545#define TOKEN "fragment-automation"
    4646
     47// if base class is undefined, it defaults to Action
     48#define BASECLASS Process
    4749
    4850// finally the information stored in the ActionTrait specialization
  • src/Actions/FragmentationAction/FragmentationAutomationAction.hpp

    rd9f2b3 rc09f94  
    1515
    1616
    17 #include "Actions/Action.hpp"
     17#include "Actions/Process.hpp"
    1818
    1919#include "FragmentationAutomationAction.def"
  • src/Actions/ManipulateAtomsProcess.cpp

    rd9f2b3 rc09f94  
    4848    AtomDescriptor _descr,
    4949    const ActionTrait &_trait) :
    50   Process(0,_trait),
     50  Process(_trait),
    5151  descr(_descr),
    5252  operation(_operation)
  • src/Actions/Process.cpp

    rd9f2b3 rc09f94  
    4141using namespace MoleCuilder;
    4242
    43 Process::Process(int _maxSteps, const ActionTrait &_trait) :
     43Process::Process(const ActionTrait &_trait) :
    4444  Action(_trait),
    4545  Observable("Process"),
    46   maxSteps(_maxSteps),
     46  maxSteps(0),
    4747  active(false),
    4848  starts(false),
  • src/Actions/Process.hpp

    rd9f2b3 rc09f94  
    5151{
    5252public:
    53   Process(int _maxSteps, const ActionTrait &_trait);
     53  Process(const ActionTrait &_trait);
    5454  virtual ~Process();
    5555
Note: See TracChangeset for help on using the changeset viewer.