source: src/Fragmentation/Automation/FragmentJobQueue.hpp@ bae7bc

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

Outsourced parsing of fragment files into ParseFragmentJobsAction from FragmentationAutomationAction.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * FragmentJobQueue.hpp
3 *
4 * Created on: Mar 4, 2013
5 * Author: heber
6 */
7
8#ifndef FRAGMENTJOBQUEUE_HPP_
9#define FRAGMENTJOBQUEUE_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <boost/filesystem/path.hpp>
17#include <string>
18#include <vector>
19
20#include "CodePatterns/Singleton.hpp"
21
22#include "Fragmentation/KeySetsContainer.hpp"
23#include "Fragmentation/Automation/parseKeySetFile.hpp"
24#include "Jobs/MPQCJob.hpp"
25
26/** FragmentJobQueue is a static instance to contain all present fragment
27 * as FragmentJob's and to allow their transfer from FragmentationAction
28 * to FragmentationAutomationAction.
29 *
30 * \note All contained jobs do not have yet a valid id!
31 */
32class FragmentJobQueue : public Singleton<FragmentJobQueue>
33{
34 friend class Singleton<FragmentJobQueue>;
35private:
36 /** Private default constructor for class FragmentJobQueue.
37 */
38 FragmentJobQueue()
39 {}
40
41 /** Private destructor for class FragmentJobQueue.
42 */
43 ~FragmentJobQueue()
44 {}
45
46public:
47
48 /** Pushes a vector of jobs into the queue.
49 *
50 * \param _jobs new jobs to push
51 * \param KeySet KeySet of all (non-hydrogen) atoms
52 * \param FullKeySet KeySet of all atoms except saturation hydrogens
53 */
54 void addJobs(
55 std::vector<FragmentJob::ptr> &_jobs,
56 const KeySetsContainer &_KeySets,
57 const KeySetsContainer &_FullKeySets);
58
59 /** Returns ref to jobs.
60 *
61 * \param vector with all jobs
62 */
63 const std::vector<FragmentJob::ptr>& getJobs() const { return jobs; }
64
65 /** Getter for the number of jobs contained.
66 *
67 * \return number of jobs in queue
68 */
69 size_t size() const { return jobs.size(); }
70
71 /** Parses multiple files.
72 *
73 * \param jobfiles vector of filenames to parse
74 * \param level level for density sampling grid
75 */
76 bool addJobsFromFiles(
77 const std::vector< boost::filesystem::path > &jobfiles,
78 const unsigned int level);
79
80 /** Adds keysets after fragments have been added by file.
81 *
82 */
83 bool addKeySetsFromFiles(
84 const boost::filesystem::path &path,
85 const size_t FragmentCounter,
86 const enum KeySetFileType keysettype
87 );
88
89 /** Adds keysets after fragments have been added by file.
90 *
91 */
92 bool addFullKeySetsFromFiles(
93 const boost::filesystem::path &path,
94 const size_t FragmentCounter,
95 const enum KeySetFileType keysettype
96 );
97
98 /** Getter for the container of all KeySets to the jobs.
99 *
100 * \return const ref to container
101 */
102 const KeySetsContainer& getKeySets() const { return KeySets; }
103
104 /** Getter for the container of all FullKeySets to the jobs.
105 *
106 * \return const ref to container
107 */
108 const KeySetsContainer& getFullKeySets() const { return FullKeySets; }
109
110 /* Empties contained jobs and all KeySets.
111 *
112 */
113 void clear();
114
115private:
116 /** Creates a MPQCJob with argument \a filename.
117 *
118 * \note job is created with invalid id.
119 *
120 * @param filename filename being argument to job
121 * @param level level for density sampling grid
122 */
123 void parsejob(const std::string &filename, const unsigned int level);
124
125private:
126 //!> container for all present jobs
127 std::vector<FragmentJob::ptr> jobs;
128 //!> container for all KeySet's without hydrogens to the jobs
129 KeySetsContainer KeySets;
130 //!> container for all KeySet's with all except saturation hydrogen to the jobs
131 KeySetsContainer FullKeySets;
132};
133
134inline
135void FragmentJobQueue::addJobs(
136 std::vector<FragmentJob::ptr> &_jobs,
137 const KeySetsContainer &_KeySets,
138 const KeySetsContainer &_FullKeySets)
139{
140 jobs.insert(jobs.end(), _jobs.begin(), _jobs.end());
141 KeySets.insert(_KeySets);
142 FullKeySets.insert(_FullKeySets);
143}
144
145#endif /* FRAGMENTJOBQUEUE_HPP_ */
Note: See TracBrowser for help on using the repository browser.