Changeset 014bc4
- Timestamp:
- Jul 6, 2012, 10:18:46 AM (12 years ago)
- 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:
- fd4d5e
- Parents:
- cbcbbd
- git-author:
- Frederik Heber <heber@…> (06/02/12 10:51:09)
- git-committer:
- Frederik Heber <heber@…> (07/06/12 10:18:46)
- Location:
- src
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
rcbcbbd r014bc4 381 381 Fragmentation/Automation/Pool/WorkerPool.hpp 382 382 383 Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp controller_ MPQCCommandJob.cpp controller_MPQCCommandJob.hpp ControllerCommand.hpp ControllerCommandRegistry.cpp ControllerCommandRegistry.hpp DefaultOptions.cpp DefaultOptions.hpp ControllerOptions.cpp ControllerOptions.hpp ControllerOptions_MPQCCommandJob.cpp ControllerOptions_MPQCCommandJob.hpp384 #controller_ SystemCommandJob.cpp controller_SystemCommandJob.hpp ControllerOptions_SystemCommandJob.cpp ControllerOptions_SystemCommandJob.hpp383 Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp controller_AddOn.hpp controller_AddOn_MPQCCommandJob.cpp controller_MPQCCommandJob.cpp controller_MPQCCommandJob.hpp ControllerCommand.hpp ControllerCommandRegistry.cpp ControllerCommandRegistry.hpp DefaultOptions.cpp DefaultOptions.hpp ControllerOptions.cpp ControllerOptions.hpp ControllerOptions_MPQCCommandJob.cpp ControllerOptions_MPQCCommandJob.hpp 384 #controller_AddOn_SystemCommandJob.cpp controller_SystemCommandJob.cpp controller_SystemCommandJob.hpp ControllerOptions_SystemCommandJob.cpp ControllerOptions_SystemCommandJob.hpp 385 385 Controller_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PROGRAM__OPTIONS_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS) 386 386 Controller_CXXFLAGS = $(AM_CPPFLAGS) -
src/controller.cpp
rcbcbbd r014bc4 37 37 #include <vector> 38 38 39 #include " Fragmentation/Automation/atexit.hpp"39 #include "CodePatterns/Assert.hpp" 40 40 #include "CodePatterns/Info.hpp" 41 41 #include "CodePatterns/Log.hpp" 42 42 43 #include "atexit.hpp" 43 44 #include "FragmentController.hpp" 44 #include "ControllerOptions_MPQCCommandJob.hpp"45 45 #include "ControllerCommandRegistry.hpp" 46 47 #include "controller_ MPQCCommandJob.hpp"46 #include "ControllerOptions.hpp" 47 #include "controller_AddOn.hpp" 48 48 49 49 /** Print the status of scheduled and done jobs. … … 75 75 size_t Exitflag = 0; 76 76 77 ControllerOptions *ControllerInfo = allocateControllerInfo(); 77 controller_AddOn *AddOn = getAddOn(); 78 ASSERT(AddOn != NULL, 79 "main() - returned AddOn is NULL."); 80 81 ControllerOptions *ControllerInfo = AddOn->allocateControllerInfo(); 78 82 boost::asio::io_service io_service; 79 83 FragmentController controller(io_service); … … 103 107 boost::ref(controller), boost::cref(ControllerInfo->server), boost::cref(ControllerInfo->serverport))) 104 108 )); 105 addSpecificCommands(registrator, controller, *ControllerInfo, vm);109 AddOn->addSpecificCommands(registrator, controller, *ControllerInfo); 106 110 107 111 // Declare the supported options. … … 113 117 ("command", boost::program_options::value< std::string >(), (std::string("command to send to server: ")+toString(getListOfCommands(ControllerCommands))).c_str()) 114 118 ; 115 addSpecificOptions(desc.add_options());119 AddOn->addSpecificOptions(desc.add_options()); 116 120 117 121 // parse command line … … 131 135 132 136 // all later parse functions depend on parsed command 133 status = addOtherParsings(*ControllerInfo, vm, ControllerCommands);137 status = AddOn->addOtherParsings(*ControllerInfo, vm); 134 138 if (status) return status; 135 139 … … 159 163 std::cerr << e.what() << std::endl; 160 164 } 161 delete ControllerInfo;165 delete AddOn; 162 166 163 167 return Exitflag; -
src/controller_MPQCCommandJob.cpp
rcbcbbd r014bc4 9 9 * controller_MPQCCommandJob.cpp 10 10 * 11 * Created on: Jun 6,201211 * Created on: 01.06.2012 12 12 * Author: heber 13 13 */ 14 15 14 16 15 // include config.h … … 31 30 32 31 #include "FragmentController.hpp" 33 #include "Jobs/ SystemCommandJob.hpp"32 #include "Jobs/MPQCCommandJob.hpp" 34 33 #include "Results/FragmentResult.hpp" 35 34 … … 47 46 #include "Jobs/MPQCCommandJob.hpp" 48 47 #include "Jobs/MPQCCommandJob_MPQCData.hpp" 48 49 49 50 50 /** Creates a MPQCCommandJob with argument \a filename. … … 258 258 } 259 259 260 260 261 /** Creates a SystemCommandJob out of give \a command with \a argument. 261 262 * … … 266 267 { 267 268 const JobId_t next_id = controller.getAvailableId(); 269 LOG(2, "DEBUG: Creating new SystemCommandJob with '" 270 +toString(ControllerInfo.executable)+"' and argument '" 271 +toString(ControllerInfo.jobcommand)+"'."); 268 272 FragmentJob::ptr testJob( 269 273 new SystemCommandJob(ControllerInfo.executable, ControllerInfo.jobcommand, next_id) ); … … 295 299 } 296 300 297 ControllerOptions *allocateControllerInfo() 301 inline std::vector<std::string> getListOfCommands(const ControllerCommandRegistry &ControllerCommands) 302 { 303 std::vector<std::string> Commands; 304 for (ControllerCommandRegistry::const_iterator iter = ControllerCommands.getBeginIter(); 305 iter != ControllerCommands.getEndIter(); ++iter) 306 Commands.push_back(iter->first); 307 308 return Commands; 309 } 310 311 ControllerOptions *controller_MPQCCommandJob::allocateControllerInfo() 298 312 { 299 313 return new ControllerOptions_MPQCCommandJob(); 300 314 } 301 315 302 void addSpecificCommands(316 void controller_MPQCCommandJob::addSpecificCommands( 303 317 boost::function<void (ControllerCommand *)> ®istrator, 304 318 FragmentController &controller, 305 ControllerOptions &ControllerInfo, 306 boost::program_options::variables_map &vm) 319 ControllerOptions &ControllerInfo) 307 320 { 308 321 ControllerOptions_MPQCCommandJob &CI = … … 310 323 registrator(new ControllerCommand("addjobs", 311 324 boost::assign::list_of< ControllerCommand::commands_t > 312 (boost::bind(&FragmentController::requestIds,313 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport),314 boost::bind(&std::vector<std::string>::size, boost::cref(CI.jobfiles))))315 (boost::bind(&AddJobs, boost::ref(controller), boost::cref(CI)))325 (boost::bind(&FragmentController::requestIds, 326 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport), 327 boost::bind(&std::vector<std::string>::size, boost::cref(CI.jobfiles)))) 328 (boost::bind(&AddJobs, boost::ref(controller), boost::cref(CI))) 316 329 )); 317 330 registrator(new ControllerCommand("createjobs", … … 320 333 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport), 1)) 321 334 (boost::bind(&createJobs, boost::ref(controller), boost::cref(CI))) 335 )); 336 registrator(new ControllerCommand("receiveresults", 337 boost::assign::list_of< ControllerCommand::commands_t > 338 (boost::bind(&FragmentController::receiveResults, 339 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport))) 340 (boost::bind(&printReceivedResults, 341 boost::bind(&FragmentController::getReceivedResults, boost::ref(controller)))) 322 342 )); 323 343 registrator(new ControllerCommand("receivempqc", … … 329 349 boost::cref(CI.fragmentpath), 330 350 boost::bind(&getNoAtomsFromAdjacencyFile, boost::cref(CI.fragmentpath)))) 331 )); 332 registrator(new ControllerCommand("receiveresults", 333 boost::assign::list_of< ControllerCommand::commands_t > 334 (boost::bind(&FragmentController::receiveResults, 335 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport))) 336 (boost::bind(&printReceivedResults, 337 boost::bind(&FragmentController::getReceivedResults, boost::ref(controller)))) 338 )); 339 } 340 341 void addSpecificOptions( 351 )); 352 } 353 354 void controller_MPQCCommandJob::addSpecificOptions( 342 355 boost::program_options::options_description_easy_init option) 343 356 { 344 357 option 345 ("executable", boost::program_options::value< std::string >(), "executable for commands 'addjobs' and 'createjobs'")346 358 ("jobcommand", boost::program_options::value< std::string >(), "command argument for executable for 'createjobs'") 359 ("executable", boost::program_options::value< std::string >(), "executable for commands 'createjobs'") 347 360 ("fragment-path", boost::program_options::value< std::string >(), "path to fragment files for 'receivempqc'") 348 ("jobfiles", boost::program_options::value< std::vector< std::string > >()->multitoken(), "list of files as single argument to 361 ("jobfiles", boost::program_options::value< std::vector< std::string > >()->multitoken(), "list of files as single argument toexecutable for 'addjobs'") 349 362 ; 350 363 } 351 364 352 int addOtherParsings(365 int controller_MPQCCommandJob::addOtherParsings( 353 366 ControllerOptions &ControllerInfo, 354 boost::program_options::variables_map &vm, 355 const ControllerCommandRegistry &ControllerCommands) 367 boost::program_options::variables_map &vm) 356 368 { 357 369 ControllerOptions_MPQCCommandJob &CI = 358 370 reinterpret_cast<ControllerOptions_MPQCCommandJob &>(ControllerInfo); 359 360 371 int status = 0; 361 372 status = CI.parseExecutable(vm); -
src/controller_MPQCCommandJob.hpp
rcbcbbd r014bc4 2 2 * controller_MPQCCommandJob.hpp 3 3 * 4 * Created on: Jun 6,20124 * Created on: 01.06.2012 5 5 * Author: heber 6 6 */ … … 9 9 #define CONTROLLER_MPQCCOMMANDJOB_HPP_ 10 10 11 12 11 // include config.h 13 12 #ifdef HAVE_CONFIG_H … … 15 14 #endif 16 15 17 18 16 #include <boost/function.hpp> 19 17 #include <boost/program_options.hpp> 18 19 #include "controller_AddOn.hpp" 20 20 21 21 class ControllerCommand; … … 25 25 class FragmentController; 26 26 27 ControllerOptions *allocateControllerInfo(); 27 struct controller_MPQCCommandJob : public controller_AddOn 28 { 29 ControllerOptions *allocateControllerInfo(); 28 30 29 void addSpecificCommands( 30 boost::function<void (ControllerCommand *)> ®istrator, 31 FragmentController &controller, 32 ControllerOptions &ControllerInfo, 33 boost::program_options::variables_map &vm); 31 void addSpecificCommands( 32 boost::function<void (ControllerCommand *)> ®istrator, 33 FragmentController &controller, 34 ControllerOptions &ControllerInfo); 34 35 35 void addSpecificOptions(36 boost::program_options::options_description_easy_init option);36 void addSpecificOptions( 37 boost::program_options::options_description_easy_init option); 37 38 38 int addOtherParsings( 39 ControllerOptions &ControllerInfo, 40 boost::program_options::variables_map &vm, 41 const ControllerCommandRegistry &ControllerCommands); 42 39 int addOtherParsings( 40 ControllerOptions &ControllerInfo, 41 boost::program_options::variables_map &vm); 42 }; 43 43 44 44 #endif /* CONTROLLER_MPQCCOMMANDJOB_HPP_ */ -
src/controller_SystemCommandJob.cpp
rcbcbbd r014bc4 64 64 } 65 65 66 ControllerOptions *allocateControllerInfo() 66 inline std::vector<std::string> getListOfCommands(const ControllerCommandRegistry &ControllerCommands) 67 { 68 std::vector<std::string> Commands; 69 for (ControllerCommandRegistry::const_iterator iter = ControllerCommands.getBeginIter(); 70 iter != ControllerCommands.getEndIter(); ++iter) 71 Commands.push_back(iter->first); 72 73 return Commands; 74 } 75 76 ControllerOptions *controller_SystemCommandJob::allocateControllerInfo() 67 77 { 68 78 return new ControllerOptions_SystemCommandJob(); 69 79 } 70 80 71 void addSpecificCommands(81 void controller_SystemCommandJob::addSpecificCommands( 72 82 boost::function<void (ControllerCommand *)> ®istrator, 73 83 FragmentController &controller, 74 ControllerOptions &ControllerInfo, 75 boost::program_options::variables_map &vm) 84 ControllerOptions &ControllerInfo) 76 85 { 77 86 ControllerOptions_SystemCommandJob &CI = … … 92 101 } 93 102 94 void addSpecificOptions(103 void controller_SystemCommandJob::addSpecificOption( 95 104 boost::program_options::options_description_easy_init option) 96 105 { … … 101 110 } 102 111 103 int addOtherParsings(112 int controller_SystemCommandJob::addOtherParsings( 104 113 ControllerOptions &ControllerInfo, 105 boost::program_options::variables_map &vm, 106 const ControllerCommandRegistry &ControllerCommands) 114 boost::program_options::variables_map &vm) 107 115 { 108 116 ControllerOptions_SystemCommandJob &CI = -
src/controller_SystemCommandJob.hpp
rcbcbbd r014bc4 17 17 #include <boost/program_options.hpp> 18 18 19 #include "controller_AddOn.hpp" 20 19 21 class ControllerCommand; 20 22 class ControllerCommandRegistry; … … 23 25 class FragmentController; 24 26 25 ControllerOptions *allocateControllerInfo(); 27 struct controller_SystemCommandJob : public controller_AddOn 28 { 29 ControllerOptions *allocateControllerInfo(); 26 30 27 void addSpecificCommands( 28 boost::function<void (ControllerCommand *)> ®istrator, 29 FragmentController &controller, 30 ControllerOptions &ControllerInfo, 31 boost::program_options::variables_map &vm); 31 void addSpecificCommands( 32 boost::function<void (ControllerCommand *)> ®istrator, 33 FragmentController &controller, 34 ControllerOptions &ControllerInfo); 32 35 33 void addSpecificOptions(34 boost::program_options::options_description_easy_init option);36 void addSpecificOptions( 37 boost::program_options::options_description_easy_init option); 35 38 36 int addOtherParsings(37 ControllerOptions &ControllerInfo,38 boost::program_options::variables_map &vm,39 const ControllerCommandRegistry &ControllerCommands);39 int addOtherParsings( 40 ControllerOptions &ControllerInfo, 41 boost::program_options::variables_map &vm); 42 }; 40 43 41 44 #endif /* CONTROLLER_SYSTEMCOMMANDJOB_HPP_ */
Note:
See TracChangeset
for help on using the changeset viewer.