Changeset fa0b18


Ignore:
Timestamp:
Jul 8, 2010, 12:51:15 PM (14 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:
40f928
Parents:
61ea5b
Message:

Added Observed and Selectiv iterators over internal Structures of the World.

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AtomsCalculation_impl.hpp

    r61ea5b rfa0b18  
    3333  Process::setMaxSteps(steps);
    3434  Process::start();
    35   for(World::AtomIterator iter=world->getAtomIter(descr);iter!=world->atomEnd();++iter){
     35  for(World::internal_AtomIterator
     36      iter=world->getAtomIter_internal(descr);
     37      iter!=world->atomEnd_internal();
     38      ++iter){
     39
    3640    Process::setCurrStep(iter.getCount());
    3741    res->push_back(op(*iter));
  • src/Actions/ManipulateAtomsProcess.cpp

    r61ea5b rfa0b18  
    5353  setMaxSteps(world->numAtoms());
    5454  start();
    55   for(World::AtomIterator iter=world->getAtomIter(descr);iter!=world->atomEnd();++iter){
     55  for(World::internal_AtomIterator
     56      iter=world->getAtomIter_internal(descr);
     57      iter!=world->atomEnd_internal();
     58      ++iter){
     59
    5660    setCurrStep(iter.getCount());
    5761    operation(*iter);
  • src/Descriptors/AtomIdDescriptor.cpp

    r61ea5b rfa0b18  
    1212
    1313#include "atom.hpp"
     14#include "AtomSet_impl.hpp"
    1415
    1516using namespace std;
  • src/World.cpp

    r61ea5b rfa0b18  
    99
    1010#include "World.hpp"
     11#include "AtomSet_impl.hpp"
    1112
    1213#include "atom.hpp"
     
    265266/******************************* Iterators ********************************/
    266267
     268// external parts with observers
     269
     270CONSTRUCT_SELECTIVE_ITERATOR(atom*,World::AtomSet,AtomDescriptor);
     271
     272World::AtomIterator
     273World::getAtomIter(AtomDescriptor descr){
     274    return AtomIterator(descr,atoms);
     275}
     276
     277World::AtomIterator
     278World::getAtomIter(){
     279    return AtomIterator(AllAtoms(),atoms);
     280}
     281
     282World::AtomIterator
     283World::atomEnd(){
     284  return AtomIterator(AllAtoms(),atoms,atoms.end());
     285}
     286
     287// Internal parts, without observers
     288
    267289// Build the AtomIterator from template
    268 CONSTRUCT_SELECTIVE_ITERATOR(atom*,World::AtomSet,AtomDescriptor);
    269 
    270 
    271 World::AtomIterator World::getAtomIter(AtomDescriptor descr){
    272   return AtomIterator(descr,atoms);
    273 }
    274 
    275 World::AtomIterator World::atomEnd(){
    276   return AtomIterator(AllAtoms(),atoms,atoms.end());
     290CONSTRUCT_SELECTIVE_ITERATOR(atom*,World::AtomSet::set_t,AtomDescriptor);
     291
     292
     293World::internal_AtomIterator
     294World::getAtomIter_internal(AtomDescriptor descr){
     295  return internal_AtomIterator(descr,atoms.getContent());
     296}
     297
     298World::internal_AtomIterator
     299World::atomEnd_internal(){
     300  return internal_AtomIterator(AllAtoms(),atoms.getContent(),atoms.end_internal());
    277301}
    278302
     
    296320    Thermostats(new ThermoStatContainer),
    297321    ExitFlag(0),
    298     atoms(),
     322    atoms(this),
    299323    currAtomId(0),
    300324    molecules(),
  • src/World.hpp

    r61ea5b rfa0b18  
    2323#include "Patterns/Cacheable.hpp"
    2424#include "Patterns/Singleton.hpp"
     25#include "AtomSet.hpp"
    2526
    2627// include config.h
     
    4546class ThermoStatContainer;
    4647
     48
    4749/****************************************** forward declarations *****************************/
    4850
     
    6769
    6870  // Types for Atom and Molecule structures
    69   typedef std::map<atomId_t,atom*> AtomSet;
     71  typedef _AtomSet AtomSet;
    7072  typedef std::map<moleculeId_t,molecule*> MoleculeSet;
    7173
     
    216218  ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string);
    217219
     220  /****
     221   * Iterators to use internal data structures
     222   * All these iterators are observed to track changes.
     223   * There is a corresponding protected section with unobserved iterators,
     224   * which ca be used internally when the extra speed is needed
     225   */
     226
     227  typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor>       AtomIterator;
     228
     229  /**
     230   * returns an iterator over all Atoms matching a given descriptor.
     231   * This iterator is observed, so don't keep it around unnecessary to
     232   * avoid unintended blocking.
     233   */
     234  AtomIterator getAtomIter(AtomDescriptor descr);
     235  AtomIterator getAtomIter();
     236
     237  AtomIterator atomEnd();
     238
    218239protected:
    219   /**** Iterators to use internal data structures */
     240  /****
     241   * Iterators to use internal data structures
     242   * All these iterators are unobserved for speed reasons.
     243   * There is a corresponding public section to these methods,
     244   * which produce observed iterators.*/
    220245
    221246  // Atoms
    222   typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor> AtomIterator;
     247  typedef AtomSet::selective_internal_iterator internal_AtomIterator;
    223248
    224249  /**
     
    226251   * used for internal purposes, like AtomProcesses and AtomCalculations.
    227252   */
    228   AtomIterator getAtomIter(AtomDescriptor descr);
     253  internal_AtomIterator getAtomIter_internal(AtomDescriptor descr);
    229254
    230255  /**
     
    234259   * used for internal purposes, like AtomProcesses and AtomCalculations.
    235260   */
    236   AtomIterator atomEnd();
     261  internal_AtomIterator atomEnd_internal();
    237262
    238263  // Molecules
Note: See TracChangeset for help on using the changeset viewer.