Changeset 02ee15 for src/World.hpp
- Timestamp:
- Feb 24, 2010, 4:44:58 PM (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:
- f16a4b
- Parents:
- 46d958
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/World.hpp
r46d958 r02ee15 46 46 /***** getter and setter *****/ 47 47 // reference to pointer is used for legacy reason... reference will be removed latter to keep encapsulation of World object 48 /** 49 * returns the periodentafel for the world. 50 */ 48 51 periodentafel *&getPeriode(); 52 53 /** 54 * returns the first atom that matches a given descriptor. 55 * Do not rely on ordering for descriptors that match more than one atom. 56 */ 49 57 atom* getAtom(AtomDescriptor descriptor); 58 59 /** 60 * returns a vector containing all atoms that match a given descriptor 61 */ 50 62 std::vector<atom*> getAllAtoms(AtomDescriptor descriptor); 51 63 64 /** 65 * returns a calculation that calls a given function on all atoms matching a descriptor. 66 * the calculation is not called at this point and can be used as an action, i.e. be stored in 67 * menus, be kept around for later use etc. 68 */ 52 69 template<typename T> 53 70 AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string,AtomDescriptor); 54 71 72 /** 73 * get the number of atoms in the World 74 */ 55 75 int numAtoms(); 76 77 /** 78 * get the number of molecules in the World 79 */ 56 80 int numMolecules(); 57 81 58 82 /***** Methods to work with the World *****/ 83 84 /** 85 * create a new molecule. This method should be used whenever any kind of molecule is needed. Assigns a unique 86 * ID to the molecule and stores it in the World for later retrieval. Do not create molecules directly. 87 */ 59 88 molecule *createMolecule(); 89 90 /** 91 * Create a new atom. This method should be used whenever any atom is needed. Assigns a unique ID and stores 92 * the atom in the World. If the atom is not destroyed it will automatically be destroyed when the world ends. 93 */ 60 94 atom *createAtom(); 95 96 /** 97 * Registers a Atom unknown to world. Needed in some rare cases, e.g. when cloning atoms, or in some unittests. 98 * Do not re-register Atoms already known to the world since this will cause double-frees. 99 */ 61 100 int registerAtom(atom*); 101 102 /** 103 * Delete some atom and erase it from the world. Use this whenever you need to destroy any atom. Do not call delete on 104 * atom directly since this will leave the pointer inside the world. 105 */ 62 106 void destroyAtom(atom*); 107 108 /** 109 * Delete some atom and erase it from the world. Use this whenever you need to destroy any atom. Do not call delete on 110 * atom directly since this will leave the pointer inside the world. 111 */ 63 112 void destroyAtom(int); 64 113 114 /** 115 * Produces a process that calls a function on all Atoms matching a given descriptor. The process is not 116 * called at this time, so it can be passed around, stored inside menuItems etc. 117 */ 65 118 ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string,AtomDescriptor); 66 119 … … 90 143 }; 91 144 145 /** 146 * returns an iterator over all Atoms matching a given descriptor. 147 * used for internal purposes, like AtomProcesses and AtomCalculations. 148 */ 92 149 AtomIterator getAtomIter(AtomDescriptor descr); 150 151 /** 152 * returns an iterator to the end of the AtomList. Due to overloading this iterator 153 * can be compared to iterators produced by getAtomIter (see the mis-matching types). 154 * Thus it can be used to detect when such an iterator is at the end of the list. 155 * used for internal purposes, like AtomProcesses and AtomCalculations. 156 */ 93 157 AtomList::iterator atomEnd(); 94 158 … … 105 169 /***** singleton Stuff *****/ 106 170 public: 171 172 /** 173 * get the currently active instance of the World. 174 */ 107 175 static World* get(); 176 177 /** 178 * destroy the currently active instance of the World. 179 */ 108 180 static void destroy(); 181 182 /** 183 * destroy the currently active instance of the World and immidiately 184 * create a new one. Use this to reset while somebody is still Observing 185 * the world and should reset the observed instance. All observers will be 186 * sent the subjectKille() message from the old world. 187 */ 109 188 static World* reset(); 110 189 111 190 private: 191 /** 192 * private constructor to ensure creation of the world using 193 * the singleton pattern. 194 */ 112 195 World(); 196 197 /** 198 * private destructor to ensure destruction of the world using the 199 * singleton pattern. 200 */ 113 201 virtual ~World(); 114 202
Note:
See TracChangeset
for help on using the changeset viewer.