Changeset 7c4e29
- Timestamp:
- Feb 19, 2010, 11:49:42 AM (15 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:
- afb47f
- Parents:
- b2cfdb
- git-author:
- Tillmann Crueger <crueger@…> (02/19/10 11:31:39)
- git-committer:
- Tillmann Crueger <crueger@…> (02/19/10 11:49:42)
- Location:
- src
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Process.cpp
rb2cfdb r7c4e29 38 38 39 39 int Process::getCurrStep(){ 40 OBSERVE; 40 41 return currStep; 42 } 43 44 void Process::setCurrStep(int _currStep){ 45 currStep = _currStep; 41 46 } 42 47 … … 47 52 return 0; 48 53 } 54 49 55 int Process::getMaxSteps(){ 50 56 return maxSteps; 51 57 } 52 58 59 void Process::setMaxSteps(int _maxSteps){ 60 maxSteps = _maxSteps; 61 } 53 62 54 63 void Process::start(){ … … 69 78 starts = false; 70 79 } 80 71 81 void Process::step(){ 72 82 OBSERVE; 73 83 currStep++; 74 84 } 85 75 86 void Process::stop(){ 76 87 stops = true; -
src/Actions/Process.hpp
rb2cfdb r7c4e29 29 29 bool doesStop(); 30 30 int getCurrStep(); 31 void setCurrStep(int _currStep); 31 32 float getDoneRatio(); 32 33 int getMaxSteps(); 34 void setMaxSteps(int _maxSteps); 33 35 34 36 protected: -
src/Makefile.am
rb2cfdb r7c4e29 8 8 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 9 9 10 ACTIONSSOURCE = Actions/Action.cpp Actions/Process.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/small_actions.cpp Actions/ ActionRegistry.cpp11 ACTIONSHEADER = Actions/Action.hpp Actions/Process.hpp Actions/ MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/small_actions.hpp Actions/ActionRegistry.hpp10 ACTIONSSOURCE = Actions/Action.cpp Actions/Process.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp Actions/small_actions.cpp Actions/ManipulateAtomsProcess.cpp Actions/ActionRegistry.cpp 11 ACTIONSHEADER = Actions/Action.hpp Actions/Process.hpp Actions/Calculation.hpp Actions/Calculation_impl.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp Actions/small_actions.hpp Actions/ManipulateAtomsProcess.hpp Actions/ActionRegistry.hpp 12 12 13 13 PATTERNSOURCE = Patterns/Observer.cpp -
src/World.cpp
rb2cfdb r7c4e29 13 13 #include "Descriptors/AtomDescriptor.hpp" 14 14 #include "Descriptors/AtomDescriptor_impl.hpp" 15 #include "Actions/ManipulateAtomsProcess.hpp" 15 16 16 17 using namespace std; … … 47 48 } 48 49 50 51 ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name,AtomDescriptor descr){ 52 return new ManipulateAtomsProcess(op, descr,name,true); 53 } 54 49 55 /******************************* Iterators ********************************/ 56 57 World::AtomIterator::AtomIterator(){ 58 state = World::get()->atomEnd(); 59 } 50 60 51 61 World::AtomIterator::AtomIterator(AtomDescriptor _descr, World* _world) : 52 62 descr(_descr.get_impl()), 53 world(_world) 63 world(_world), 64 index(0) 54 65 { 55 66 state = world->atoms.begin(); … … 59 70 World::AtomIterator::AtomIterator(const AtomIterator& rhs) : 60 71 state(rhs.state), 61 descr(rhs.descr) 72 descr(rhs.descr), 73 index(rhs.index), 74 world(rhs.world) 62 75 {} 63 76 77 World::AtomIterator& World::AtomIterator::operator=(const AtomIterator& rhs) 78 { 79 if(&rhs!=this){ 80 state=rhs.state; 81 descr=rhs.descr; 82 index=rhs.index; 83 world=rhs.world; 84 } 85 return *this; 86 } 87 64 88 World::AtomIterator& World::AtomIterator::operator++(){ 89 ++state; 90 ++index; 65 91 advanceState(); 92 return *this; 93 } 94 95 World::AtomIterator World::AtomIterator::operator++(int){ 96 AtomIterator res(*this); 97 ++(*this); 98 return res; 66 99 } 67 100 … … 70 103 } 71 104 105 bool World::AtomIterator::operator==(const World::AtomList::iterator& rhs){ 106 return state==rhs; 107 } 108 72 109 bool World::AtomIterator::operator!=(const AtomIterator& rhs){ 73 110 return state!=rhs.state; 74 111 } 75 112 113 bool World::AtomIterator::operator!=(const World::AtomList::iterator& rhs){ 114 return state!=rhs; 115 } 116 76 117 atom* World::AtomIterator::operator*(){ 77 118 return (*state).second; … … 79 120 80 121 void World::AtomIterator::advanceState(){ 81 while(state!=world->atoms.end() && !descr->predicate(*state)) 82 state++; 122 while((state!=world->atoms.end()) && (!descr->predicate(*state))){ 123 ++state; 124 ++index; 125 } 126 } 127 128 int World::AtomIterator::getCount(){ 129 return index; 83 130 } 84 131 85 132 World::AtomIterator World::getAtomIter(AtomDescriptor descr){ 86 133 return AtomIterator(descr,this); 134 } 135 136 World::AtomList::iterator World::atomEnd(){ 137 return atoms.end(); 87 138 } 88 139 … … 98 149 dummyId(0), 99 150 periode(new periodentafel), 100 molecules_deprecated(new MoleculeListClass) 151 molecules_deprecated(new MoleculeListClass), 152 atoms() 101 153 { 102 154 molecules_deprecated->signOn(this); -
src/World.hpp
rb2cfdb r7c4e29 9 9 #define WORLD_HPP_ 10 10 11 #include < boost/thread.hpp>11 #include <string> 12 12 #include <map> 13 13 #include <vector> 14 14 #include <set> 15 #include <boost/thread.hpp> 15 16 #include <boost/shared_ptr.hpp> 17 16 18 17 19 #include "Patterns/Observer.hpp" … … 25 27 class AtomDescriptor; 26 28 class AtomDescriptor_impl; 29 class ManipulateAtomsProcess; 27 30 28 31 class World : public Observable … … 30 33 friend class AtomDescriptor_impl; 31 34 friend class AtomDescriptor; 35 36 friend class ManipulateAtomsProcess; 32 37 33 38 typedef std::map<int,atom*> AtomList; … … 45 50 molecule *createMolecule(); 46 51 52 ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string,AtomDescriptor); 53 47 54 protected: 48 55 /**** Iterators to use internal data structures */ 49 56 class AtomIterator { 50 57 public: 58 AtomIterator(); 51 59 AtomIterator(AtomDescriptor, World*); 52 60 AtomIterator(const AtomIterator&); 53 AtomIterator& operator++(); 61 AtomIterator& operator=(const AtomIterator&); 62 AtomIterator& operator++(); // prefix 63 AtomIterator operator++(int); // postfix with dummy parameter 54 64 bool operator==(const AtomIterator&); 65 bool operator==(const AtomList::iterator&); 55 66 bool operator!=(const AtomIterator&); 67 bool operator!=(const AtomList::iterator&); 56 68 atom* operator*(); 69 70 int getCount(); 57 71 protected: 58 72 void advanceState(); … … 60 74 AtomList::iterator state; 61 75 boost::shared_ptr<AtomDescriptor_impl> descr; 76 int index; 62 77 }; 63 78 64 79 AtomIterator getAtomIter(AtomDescriptor descr); 80 AtomList::iterator atomEnd(); 65 81 66 82 private: -
src/unittests/Makefile.am
rb2cfdb r7c4e29 30 30 CacheableTest \ 31 31 DescriptorUnittest \ 32 manipulateAtomsTest \ 32 33 ${MENUTESTS} 33 34 … … 109 110 110 111 DescriptorUnittest_SOURCES = DescriptorUnittest.cpp DescriptorUnittest.hpp 111 DescriptorUnittest_LDADD = ${ALLLIBS} 112 DescriptorUnittest_LDADD = ${ALLLIBS} 113 114 manipulateAtomsTest_SOURCES = manipulateAtomsTest.cpp manipulateAtomsTest.hpp 115 manipulateAtomsTest_LDADD = ${ALLLIBS} 112 116 113 117 #AUTOMAKE_OPTIONS = parallel-tests
Note:
See TracChangeset
for help on using the changeset viewer.