Changeset d346b6


Ignore:
Timestamp:
Feb 5, 2010, 3:19:27 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
fc1b24
Parents:
4d9c01
Message:

Made all atoms register themselves with the world upon creation

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r4d9c01 rd346b6  
    2727# deleted once everything is fully refactored
    2828LEGACYSOURCE = Legacy/oldmenu.cpp
    29 LEGACYHEADER = Legacy/oldmenu.hpp Legacy/WorldContent.hpp Legacy/WorldContent_impl.hpp
     29LEGACYHEADER = Legacy/oldmenu.hpp
    3030
    3131SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${UISOURCE} ${LEGACYSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp
  • src/World.cpp

    r4d9c01 rd346b6  
    88#include "World.hpp"
    99
    10 #include <iostream>
     10#include "atom.hpp"
     11
     12using namespace std;
    1113
    1214/******************************* getter and setter ************************/
     
    7375}
    7476
     77// some legacy stuff to let the World know about items created outside
     78void World::registerAtom(atom *theAtom){
     79  OBSERVE;
     80  atoms[theAtom->getId()] = theAtom;
     81}
    7582
    76 // methods for WorldContent CRTP mechanism
    77 void World::registerContent(atom *atom){
    78   std::cout << "############### some kind of Atom created ##################" << std::endl;
     83void World::unregisterAtom(atom *theAtom){
     84  OBSERVE;
     85  atoms.erase(theAtom->getId());
    7986}
  • src/World.hpp

    r4d9c01 rd346b6  
    1010
    1111#include <boost/thread.hpp>
     12#include <map>
    1213
    1314#include "Patterns/Observer.hpp"
     
    2728private:
    2829  periodentafel *periode;
     30  std::map<int,atom*> atoms;
    2931
    3032
     
    5254
    5355  // functions used for the WorldContent template mechanism
    54   void registerContent(atom *theAtom);
     56  void registerAtom(atom *theAtom);
     57  void unregisterAtom(atom *theAtom);
    5558private:
    5659  MoleculeListClass *molecules;
  • src/atom.cpp

    r4d9c01 rd346b6  
    1313#include "parser.hpp"
    1414#include "vector.hpp"
     15#include "World.hpp"
    1516
    1617/************************************* Functions for class atom *************************************/
     
    2122atom::atom() : previous(NULL), next(NULL), father(this), sort(&nr)
    2223{
     24  World::get()->registerAtom(this);
    2325  node = &x;  // TesselPoint::x can only be referenced from here
    2426};
     
    2830atom::atom(atom *pointer) : previous(NULL), next(NULL), father(pointer), sort(&nr)
    2931{
     32  World::get()->registerAtom(this);
    3033  type = pointer->type;  // copy element of atom
    3134  x.CopyVector(&pointer->x); // copy coordination
     
    4043atom::~atom()
    4144{
     45  World::get()->unregisterAtom(this);
    4246  unlink(this);
    4347};
  • src/atom_particleinfo.cpp

    r4d9c01 rd346b6  
    2020};
    2121
     22int ParticleInfo::getId() {
     23  return nr;
     24}
     25
    2226ostream & operator << (ostream &ost, const ParticleInfo &a)
    2327{
  • src/atom_particleinfo.hpp

    r4d9c01 rd346b6  
    3535  ostream & operator << (ostream &ost) const;
    3636
     37  int getId();
     38
    3739private:
    3840};
Note: See TracChangeset for help on using the changeset viewer.