Changeset 040a5c
- Timestamp:
- Feb 22, 2012, 11:28:52 AM (13 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:
- 429069
- Parents:
- 38c5d1
- git-author:
- Frederik Heber <heber@…> (01/05/12 18:26:00)
- git-committer:
- Frederik Heber <heber@…> (02/22/12 11:28:52)
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/SetWorldTimeAction.cpp
r38c5d1 r040a5c 44 44 getParametersfromValueStorage(); 45 45 46 WorldTime:: setTime(params.newtime);46 WorldTime::getInstance().setTime(params.newtime); 47 47 LOG(0, "Current time step is now: " << WorldTime::getTime() << "."); 48 48 return Action::state_ptr(UndoState); … … 52 52 WorldSetWorldTimeState *state = assert_cast<WorldSetWorldTimeState*>(_state.get()); 53 53 54 WorldTime:: setTime(state->oldtime);54 WorldTime::getInstance().setTime(state->oldtime); 55 55 LOG(0, "Current time step is now again: " << WorldTime::getTime() << "."); 56 56 … … 61 61 WorldSetWorldTimeState *state = assert_cast<WorldSetWorldTimeState*>(_state.get()); 62 62 63 WorldTime:: setTime(state->params.newtime);63 WorldTime::getInstance().setTime(state->params.newtime); 64 64 LOG(0, "Current time step is now: " << WorldTime::getTime() << "."); 65 65 -
src/World.cpp
r38c5d1 r040a5c 151 151 if (_step != WorldTime::getTime()) { 152 152 // set new time 153 WorldTime:: setTime(_step);153 WorldTime::getInstance().setTime(_step); 154 154 // TODO: removed when BondGraph creates the adjacency 155 155 // 1. remove all of World's molecules -
src/WorldTime.cpp
r38c5d1 r040a5c 23 23 24 24 #include "CodePatterns/Log.hpp" 25 #include "CodePatterns/Observer/Channels.hpp" 26 #include "CodePatterns/Observer/Notification.hpp" 25 27 #include "CodePatterns/Singleton_impl.hpp" 26 28 … … 28 30 29 31 WorldTime::WorldTime() : 32 Observable("WorldTime"), 30 33 StepWidth(0.) 31 {} 34 { 35 // observable stuff 36 Channels *OurChannel = new Channels; 37 NotificationChannels.insert( std::make_pair(this, OurChannel) ); 38 // add instance for each notification type 39 for (size_t type = 0; type < NotificationType_MAX; ++type) 40 OurChannel->addChannel(type); 41 } 32 42 33 43 WorldTime::~WorldTime() 34 {} 44 { 45 // observable stuff 46 std::map<Observable *, Channels*>::iterator iter = NotificationChannels.find(this); 47 delete iter->second; 48 NotificationChannels.erase(iter); 49 } 35 50 36 51 void WorldTime::setStepWidth(const double _width) … … 45 60 } 46 61 62 void WorldTime::setTime(const unsigned int _time) 63 { 64 OBSERVE; 65 NOTIFY(TimeChanged); 66 WorldTime::CurrentTime = _time; 67 } 68 47 69 CONSTRUCT_SINGLETON(WorldTime) -
src/WorldTime.hpp
r38c5d1 r040a5c 14 14 #endif 15 15 16 #include "CodePatterns/Observer/Observable.hpp" 16 17 #include "CodePatterns/Singleton.hpp" 17 18 … … 22 23 } 23 24 24 class WorldTime : public Singleton<WorldTime> 25 class WorldTime : public Singleton<WorldTime>, public Observable 25 26 { 26 27 //!> own unit test should be friend to access private variables. … … 38 39 friend class MoleCuilder::WorldSetWorldTimeAction; 39 40 public: 41 enum NotificationType { 42 TimeChanged, 43 NotificationType_MAX // denotes the maximum of available notification types 44 }; 40 45 41 46 /** Getter for CurrentTime. … … 65 70 * @param _time value to set CurrentTime to 66 71 */ 67 static void setTime(const unsigned int _time) 68 { WorldTime::CurrentTime = _time; } 72 void setTime(const unsigned int _time); 69 73 70 74 static unsigned int CurrentTime; //!< contains current time step -
src/unittests/ListOfBondsUnitTest.cpp
r38c5d1 r040a5c 52 52 atom *Walker = NULL; 53 53 54 WorldTime:: setTime(0);54 WorldTime::getInstance().setTime(0); 55 55 56 56 // construct element … … 362 362 363 363 // add bond 364 WorldTime:: setTime(0);365 Binder = TestMolecule->AddBond(atom1, atom2, 1); 366 CPPUNIT_ASSERT( Binder != NULL ); 367 WorldTime:: setTime(1);364 WorldTime::getInstance().setTime(0); 365 Binder = TestMolecule->AddBond(atom1, atom2, 1); 366 CPPUNIT_ASSERT( Binder != NULL ); 367 WorldTime::getInstance().setTime(1); 368 368 Binder = TestMolecule->AddBond(atom1, atom2, 1); 369 369 CPPUNIT_ASSERT( Binder != NULL ); … … 371 371 // access test via CurrentTime 372 372 { // time step 0 373 WorldTime:: setTime(0);373 WorldTime::getInstance().setTime(0); 374 374 { 375 375 const BondList& ListOfBonds = atom1->getListOfBonds(); … … 383 383 } 384 384 { // time step 1 385 WorldTime:: setTime(1);385 WorldTime::getInstance().setTime(1); 386 386 { 387 387 const BondList& ListOfBonds = atom1->getListOfBonds(); … … 393 393 } 394 394 CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() ); 395 WorldTime:: setTime(0);395 WorldTime::getInstance().setTime(0); 396 396 } 397 397 … … 423 423 // check bond if removed from other atom for all time steps 424 424 { 425 WorldTime:: setTime(0);425 WorldTime::getInstance().setTime(0); 426 426 const BondList& ListOfBonds = atom1->getListOfBonds(); 427 427 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); … … 429 429 } 430 430 { 431 WorldTime:: setTime(1);431 WorldTime::getInstance().setTime(1); 432 432 const BondList& ListOfBonds = atom1->getListOfBonds(); 433 433 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 434 434 CPPUNIT_ASSERT_EQUAL( false, TestMolecule->hasBondStructure() ); 435 WorldTime:: setTime(0);435 WorldTime::getInstance().setTime(0); 436 436 } 437 437
Note:
See TracChangeset
for help on using the changeset viewer.