Changeset 7b22e9 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:
a1b77d
Parents:
c7deca
git-author:
Frederik Heber <heber@…> (11/24/11 20:21:20)
git-committer:
Frederik Heber <heber@…> (05/04/12 14:19:06)
Message:

FragmentJob now contains Work() function.

  • also unit tests are now linked only against boost libs they really need.
Location:
src/Fragmentation/Automation
Files:
1 added
6 edited

Legend:

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

    rc7deca r7b22e9  
    1818#endif
    1919
     20// boost asio needs specific operator new
     21#include <boost/asio.hpp>
     22#include <boost/date_time/posix_time/posix_time.hpp>
     23
    2024#include "CodePatterns/MemDebug.hpp"
    2125
     26#include "CodePatterns/Info.hpp"
     27#include "CodePatterns/Log.hpp"
     28#include "CodePatterns/toString.hpp"
    2229#include "FragmentJob.hpp"
     30#include "FragmentResult.hpp"
    2331
    2432/** Constructor for class FragmentJob.
     
    4654{}
    4755
     56/** Work routine of this FragmentJob.
     57 *
     58 * This function encapsulates all the work that has to be done to generate
     59 * a FragmentResult. Hence, the FragmentWorker does not need to know anything
     60 * about the operation: it just receives it and executes this function.
     61 *
     62 * \return result of this job
     63 */
     64FragmentResult FragmentJob::Work()
     65{
     66  Info info((std::string(__FUNCTION__)+std::string(", id #")+toString(getId())).c_str());
     67  FragmentResult s(getId());
     68
     69  boost::asio::io_service io;
     70  boost::asio::deadline_timer t(io, boost::posix_time::seconds(1));
     71  LOG(1, "INFO: Deadline timer will now wait for 1 seconds.");
     72  t.wait();
     73  LOG(1, "INFO: Deadline timer is done.");
     74
     75  return s;
     76}
     77
    4878/** Comparator for class FragmentJob.
    4979 * \param other instance to compare to
  • src/Fragmentation/Automation/FragmentJob.hpp

    rc7deca r7b22e9  
    1818#include "boost/serialization/array.hpp"
    1919
     20#include "FragmentResult.hpp"
    2021#include "JobId.hpp"
    2122#include "types.hpp"
     
    4243  ~FragmentJob();
    4344
     45  FragmentResult Work();
     46
    4447  bool operator==(const FragmentJob &other) const;
    4548
  • src/Fragmentation/Automation/Makefile.am

    rc7deca r7b22e9  
    3636  atexit.cpp \
    3737  FragmentJob.cpp \
     38  FragmentResult.cpp \
    3839  FragmentWorker.cpp \
    3940  JobId.cpp \
     
    4445  Connection.hpp \
    4546  FragmentJob.hpp \
     47  FragmentResult.hpp \
    4648  FragmentWorker.hpp \
    4749  JobId.hpp
  • src/Fragmentation/Automation/unittests/FragmentJobUnitTest.cpp

    rc7deca r7b22e9  
    2929
    3030#include "FragmentJob.hpp"
     31#include "FragmentResult.hpp"
     32#include "JobId.hpp"
    3133
    3234#include "CodePatterns/Assert.hpp"
     
    7274}
    7375
     76/** UnitTest for Work()
     77 */
     78void FragmentJobTest::WorkTest()
     79{
     80  FragmentJob testJob(command, 1);
     81  FragmentJob othertestJob(command, 2);
     82
     83  FragmentResult testResult(testJob.Work());
     84  FragmentResult othertestResult(othertestJob.Work());
     85
     86  CPPUNIT_ASSERT_EQUAL( (JobId_t)1, testResult.getId() );
     87  CPPUNIT_ASSERT_EQUAL( (JobId_t)2, othertestResult.getId() );
     88}
     89
    7490/** UnitTest for serialization
    7591 */
  • src/Fragmentation/Automation/unittests/FragmentJobUnitTest.hpp

    rc7deca r7b22e9  
    2525    CPPUNIT_TEST ( equalityTest );
    2626    CPPUNIT_TEST ( serializationTest );
     27    CPPUNIT_TEST ( WorkTest );
    2728    CPPUNIT_TEST_SUITE_END();
    2829
     
    3233      void equalityTest();
    3334      void serializationTest();
     35      void WorkTest();
    3436
    3537private:
  • src/Fragmentation/Automation/unittests/Makefile.am

    rc7deca r7b22e9  
    2525  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
    2626  $(BOOST_THREAD_LDFLAGS) $(BOOST_THREAD_LIBS) \
     27  $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) \
    2728  ${CodePatterns_LIBS}
    2829
     
    3435  FragmentJob.cpp \
    3536  FragmentJob.hpp \
     37  unittests/stubs/FragmentResultStub.cpp \
     38  FragmentResult.hpp \
    3639  JobId.cpp \
    3740  JobId.hpp
    3841FragmentJobUnitTest_LDADD = \
    39   ${FRAGMENTATIONLIBS} \
    40   $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS)
     42  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
     43  $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) \
     44  ${CodePatterns_LIBS}
    4145
    4246FragmentQueueUnitTest_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     
    5357  JobId.cpp \
    5458  JobId.hpp
    55 FragmentQueueUnitTest_LDADD = $(FRAGMENTATIONAUTOMATIONLIBS)
     59FragmentQueueUnitTest_LDADD = \
     60  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
     61  $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) \
     62  ${CodePatterns_LIBS}
    5663
    5764FragmentResultUnitTest_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
     
    6572  JobId.hpp
    6673FragmentResultUnitTest_LDADD = \
    67   ${FRAGMENTATIONLIBS} \
    68   $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS)
     74  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
     75  $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) \
     76  ${CodePatterns_LIBS}
    6977
    7078
Note: See TracChangeset for help on using the changeset viewer.