Changeset b05673 for src


Ignore:
Timestamp:
May 4, 2012, 2:19:06 PM (13 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:
af81f8
Parents:
b5ebb5
git-author:
Frederik Heber <heber@…> (10/23/11 20:20:19)
git-committer:
Frederik Heber <heber@…> (05/04/12 14:19:06)
Message:

Introduced JobId as an own class that Job and Result inherit.

Location:
src/Fragmentation/Automation
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/FragmentJob.cpp

    rb5ebb5 rb05673  
    2626 */
    2727FragmentJob::FragmentJob() :
    28   outputfile(""),
    29   JobId(-1)
     28  JobId(-1),
     29  outputfile("")
    3030{}
    3131
     
    3636 */
    3737FragmentJob::FragmentJob(const std::string &_outputfile, const JobId_t _JobId) :
    38   outputfile(_outputfile),
    39   JobId(_JobId)
     38  JobId(_JobId),
     39  outputfile(_outputfile)
    4040{}
    4141
     
    5252bool FragmentJob::operator==(const FragmentJob &other) const
    5353{
    54   return (outputfile == other.outputfile) && (JobId == JobId);
     54  return (outputfile == other.outputfile) && (getId() == other.getId());
    5555}
    56 
    57 const JobId_t FragmentJob::getId() const
    58 {
    59   return JobId;
    60 }
  • src/Fragmentation/Automation/FragmentJob.hpp

    rb5ebb5 rb05673  
    1616#include <string>
    1717
    18 #include "boost/serialization/access.hpp"
     18#include "boost/serialization/array.hpp"
    1919
     20#include "JobId.hpp"
    2021#include "types.hpp"
    2122
     
    2829 * transfered to a scheduler (server) and be deserialized by the Worker.
    2930 */
    30 class FragmentJob
     31class FragmentJob : public JobId
    3132{
    3233  friend class FragmentWorker;
     
    4243  }
    4344
    44   const JobId_t getId() const;
     45  //!> string containing the configuration file for the solver
     46  std::string outputfile;
    4547
    4648private:
     
    5052  void serialize(Archive& ar, const unsigned int version)
    5153  {
     54    ar & boost::serialization::base_object<JobId>(*this);
    5255    ar & outputfile;
    53     ar & JobId;
    5456  }
    55 
    56 private:
    57   //!> string containing the configuration file for the solver
    58   std::string outputfile;
    59   //!> unique id of this job (used for the temporary filename) and associating result
    60   JobId_t JobId;
    6157};
    6258
  • src/Fragmentation/Automation/FragmentQueue.cpp

    rb5ebb5 rb05673  
    100100{
    101101  /// check for presence
    102   ResultMap::iterator iter = results.find(jobid);
     102  ResultMap::iterator iter = results.find(result.getId());
    103103  ASSERT(iter != results.end(),
    104       "FragmentQueue::pushResult() - job "+toString(jobid)+" is not known to us.");
     104      "FragmentQueue::pushResult() - job "+toString(result.getId())+" is not known to us.");
    105105  ASSERT(iter->second == NoResult,
    106       "FragmentQueue::pushResult() - is not waiting for the result of job "+toString(jobid)+".");
     106      "FragmentQueue::pushResult() - is not waiting for the result of job "+toString(result.getId())+".");
    107107  /// and overwrite NoResult in found entry
    108108  iter->second = result;
  • src/Fragmentation/Automation/FragmentResult.cpp

    rb5ebb5 rb05673  
    2525/** Constructor of class FragmentResult.
    2626 *
    27  * \param id id of FragmntJob associated to this FragmentResult.
     27 * \param _id id of FragmntJob associated to this FragmentResult.
    2828 */
    2929FragmentResult::FragmentResult(const JobId_t _id) :
    30   id(_id),
     30  JobId(_id),
    3131  result(std::string("Nothing"))
    3232{}
     
    3636 */
    3737FragmentResult::FragmentResult(const FragmentResult &other) :
    38   id(other.id),
     38  JobId(other.getId()),
    3939  result(other.result)
    4040{}
     
    4646{}
    4747
    48 /** Equality operator: Equal if both ids are the same
     48/** Equality operator: Equal if both JobIds are the same
    4949 *
    5050 * \param other instance to check against
    51  * \return true - both ids are the same, false - ids are not the same.
     51 * \return true - both JobIds are the same, false - JobIds are not the same.
    5252 */
    5353bool FragmentResult::operator==(const FragmentResult &other) const
    5454{
    55   return id == other.id;
     55  return getId() == other.getId();
    5656}
    5757
    5858/** Assigment operator.
    5959 *
    60  * \note We can't use default assigment because of const member FragmentResult::id.
     60 * \note We can't use default assigment because of const member FragmentResult::JobId.
    6161 *
    6262 * \param other instance to make equal to
     
    6666  /// check self-assignment
    6767  if (this != &other) {
    68     const_cast<JobId_t &>(id) = other.id;
     68    setId(other.getId());
    6969    result = other.result;
    7070  }
  • src/Fragmentation/Automation/FragmentResult.hpp

    rb5ebb5 rb05673  
    1616
    1717#include <string>
     18
     19#include "boost/serialization/array.hpp"
     20
     21#include "JobId.hpp"
    1822#include "types.hpp"
    1923
     
    2125 *
    2226 */
    23 class FragmentResult
     27class FragmentResult : public JobId
    2428{
    2529public:
     
    3337    { return !(*this == other); }
    3438
    35 
    36   //!> this job's unique id
    37   const JobId_t id;
    3839  //!> result
    3940  std::string result;
     41
     42private:
     43  friend class boost::serialization::access;
     44  // serialization
     45  template <typename Archive>
     46  void serialize(Archive& ar, const unsigned int version)
     47  {
     48    ar & boost::serialization::base_object<JobId>(*this);
     49    ar & result;
     50  }
    4051};
    4152
  • src/Fragmentation/Automation/FragmentWorker.cpp

    rb5ebb5 rb05673  
    8888void FragmentWorker::handle_read(const boost::system::error_code& e)
    8989{
    90     Info info(__FUNCTION__);
     90  Info info(__FUNCTION__);
    9191  if (!e)
    9292  {
     
    9696        std::cout << "Job number " << i << "\n";
    9797        std::cout << "  output: " << jobs_[i].outputfile << "\n";
    98         std::cout << "  id: " << jobs_[i].JobId << "\n";
     98        std::cout << "  id: " << jobs_[i].getId() << "\n";
    9999    }
    100100  }
  • src/Fragmentation/Automation/Makefile.am

    rb5ebb5 rb05673  
    1313AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
    1414
    15 INCLUDES = -I$(top_srcdir)/src/unittests -I$(top_srcdir)/src/Actions -I$(top_srcdir)/src/UIElements -I$(top_srcdir)/LinearAlgebra/src
    16 
    1715bin_PROGRAMS += Server Worker
    1816
    19 Server_SOURCES = \
     17SERVERSOURCE = \
    2018  atexit.cpp \
     19  FragmentJob.cpp \
     20  FragmentScheduler.cpp \
     21  JobId.cpp \
     22  Server.cpp
     23
     24SERVERHEADER = \
    2125  atexit.hpp \
    2226  Connection.hpp \
     27  FragmentJob.hpp \
     28  FragmentScheduler.hpp \
     29  JobId.hpp
     30
     31WORKERSOURCE = \
     32  atexit.cpp \
    2333  FragmentJob.cpp \
     34  FragmentWorker.cpp \
     35  JobId.cpp \
     36  Worker.cpp
     37
     38WORKERHEADER = \
     39  atexit.hpp \
     40  Connection.hpp \
    2441  FragmentJob.hpp \
    25   FragmentScheduler.cpp \
    26   FragmentScheduler.hpp \
    27   Server.cpp
     42  FragmentWorker.hpp \
     43  JobId.hpp
     44
     45Server_SOURCES = $(SERVERSOURCE) $(SERVERHEADER)
    2846Server_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    2947Server_CXXFLAGS = $(AM_CPPFLAGS)
     
    3553  ${CodePatterns_LIBS}
    3654
    37 Worker_SOURCES = \
    38   atexit.cpp \
    39   atexit.hpp \
    40   Connection.hpp \
    41   FragmentJob.cpp \
    42   FragmentJob.hpp \
    43   FragmentWorker.cpp \
    44   FragmentWorker.hpp \
    45   Worker.cpp
     55Worker_SOURCES = $(WORKERSOURCE) $(WORKERHEADER)
    4656Worker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
    4757Worker_CXXFLAGS = $(AM_CPPFLAGS)
  • src/Fragmentation/Automation/unittests/Makefile.am

    rb5ebb5 rb05673  
    1717
    1818FRAGMENTATIONAUTOMATIONLIBS = \
     19  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
    1920  $(BOOST_THREAD_LDFLAGS) $(BOOST_THREAD_LIBS) \
    2021  ${CodePatterns_LIBS}
     
    3031  FragmentQueue.hpp \
    3132  FragmentResult.cpp \
    32   FragmentResult.hpp
     33  FragmentResult.hpp \
     34  JobId.cpp \
     35  JobId.hpp
    3336FragmentQueueUnitTest_LDADD = $(FRAGMENTATIONAUTOMATIONLIBS)
    3437
Note: See TracChangeset for help on using the changeset viewer.