Ignore:
Timestamp:
May 17, 2012, 3:21:50 PM (14 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, Candidate_v1.7.0, Candidate_v1.7.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:
d6fe76
Parents:
73d6fc
git-author:
Frederik Heber <heber@…> (12/11/11 16:20:52)
git-committer:
Frederik Heber <heber@…> (05/17/12 15:21:50)
Message:

Extracted all other derived Operation's too and placed into folder Controller/Commands.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/Controller/FragmentController.hpp

    r73d6fc r167b63  
    2323
    2424#include "Controller/Commands/Operation.hpp"
     25#include "Controller/Commands/CheckResultsOperation.hpp"
     26#include "Controller/Commands/ReceiveJobsOperation.hpp"
     27#include "Controller/Commands/SendResultsOperation.hpp"
     28#include "Controller/Commands/ShutdownOperation.hpp"
    2529
    2630/** The FragmentController sends bunches of jobs to a FragmentScheduler,
     
    3842  FragmentController(boost::asio::io_service& io_service, const std::string& _host, const std::string& _service);
    3943  ~FragmentController();
    40 
    41   class ReceiveJobsOperation : public Operation {
    42   public:
    43     /// Constructor for class ReceiveJobsOperation.
    44     ReceiveJobsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
    45       Operation(_connection, _host, _service) {}
    46     /// Destructor for class ReceiveJobsOperation
    47     ~ReceiveJobsOperation() {}
    48 
    49   public:
    50     /// Placing receive jobs operations into an io_service
    51     virtual void operator()();
    52 
    53     /// Handle completion of a calculate operation.
    54     void handle_connect_calc(const boost::system::error_code& e,
    55         boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
    56 
    57     /// Callback function when bunch of jobs have been sent.
    58     void handle_SendJobs(const boost::system::error_code& e);
    59 
    60     /// Handle completion of an operation.
    61     void handle_FinishOperation(const boost::system::error_code& e);
    62 
    63     /// internal function to connect to server and send jobs for calculation
    64     void connect_calc();
    65 
    66     /// Setter for jobs
    67     void addJobs(const std::vector<FragmentJob> &jobs);
    68 
    69     /// Getter for number of size of jobs
    70     size_t getPresentJobs() const;
    71 
    72   protected:
    73     /// bunch of jobs
    74     std::vector<FragmentJob> jobs;
    75   };
    76 
    77   struct CheckResultsOperation : public Operation  {
    78   public:
    79     /// Constructor for class CheckResultsOperation.
    80     CheckResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
    81       Operation(_connection, _host, _service),
    82       doneJobs(0)
    83     {}
    84     /// Destructor for class CheckResultsOperation
    85     ~CheckResultsOperation() {}
    86 
    87   public:
    88     // placing receive jobs operations into an io_service
    89     virtual void operator()();
    90 
    91     /// Handle completion of a CheckResults operation.
    92     void handle_connect_check(const boost::system::error_code& e,
    93         boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
    94 
    95     /// Callback function when doneJobs have been received.
    96     void handle_ReceiveDoneJobs(const boost::system::error_code& e);
    97 
    98     /// Handle completion of an operation.
    99     void handle_FinishOperation(const boost::system::error_code& e);
    100 
    101     /// internal function to connect to server and check done jobs
    102     void connect_check();
    103 
    104     /// Getter for doneJobs
    105     size_t getDoneJobs() const;
    106 
    107   protected:
    108     /// currently calculated results
    109     size_t doneJobs;
    110   };
    111 
    112   struct SendResultsOperation : public Operation  {
    113   public:
    114     /// Constructor for class SendResultsOperation.
    115     SendResultsOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
    116       Operation(_connection, _host, _service) {}
    117     /// Destructor for class SendResultsOperation
    118     ~SendResultsOperation() {}
    119 
    120   public:
    121     // placing receive jobs operations into an io_service
    122     virtual void operator()();
    123 
    124     /// Handle completion of a GetResults operation.
    125     void handle_connect_get(const boost::system::error_code& e,
    126         boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
    127 
    128     /// Callback function when results are about to be received.
    129     void handle_ReceivingResults(const boost::system::error_code& e);
    130 
    131     /// Callback function when results have been received.
    132     void handle_ReceivedResults(const boost::system::error_code& e);
    133 
    134     /// internal function to connect to server and receive calculated results
    135     void connect_get();
    136 
    137     /// Getter for results
    138     std::vector<FragmentResult> getResults();
    139 
    140   protected:
    141     /// bunch of results
    142     std::vector<FragmentResult> results;
    143   };
    144 
    145   struct ShutdownOperation : public Operation  {
    146   public:
    147     /// Constructor for class ShutdownOperation.
    148     ShutdownOperation(Connection &_connection, const std::string& _host, const std::string& _service) :
    149       Operation(_connection, _host, _service) {}
    150     /// Destructor for class ShutdownOperation
    151     ~ShutdownOperation() {}
    152 
    153   public:
    154     // placing receive jobs operations into an io_service
    155     virtual void operator()();
    156 
    157     /// Handle completion of a Shutdown operation.
    158     void handle_connect_shutdown(const boost::system::error_code& e,
    159         boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
    160 
    161     /// internal function to connect to server and receive calculated results
    162     void connect_shutdown();
    163 
    164   };
    16544
    16645protected:
Note: See TracChangeset for help on using the changeset viewer.