Changeset 426f2a


Ignore:
Timestamp:
Aug 5, 2010, 2:45:59 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:
00abfc
Parents:
d36ffb
git-author:
Tillmann Crueger <crueger@…> (08/05/10 14:24:41)
git-committer:
Tillmann Crueger <crueger@…> (08/05/10 14:45:59)
Message:

Added a method to enumerate formulas

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Formula.cpp

    rd36ffb r426f2a  
    230230}
    231231
     232enumeration<Formula::key_type> Formula::enumerateElements() const{
     233  enumeration<key_type> res(1);
     234  for(Formula::const_iterator iter=begin();iter!=end();++iter){
     235    res.add(iter->first);
     236  }
     237  return res;
     238}
     239
    232240const unsigned int Formula::operator[](const element *element) const{
    233241  ASSERT(element,"Invalid pointer in access of Formula");
  • src/Formula.hpp

    rd36ffb r426f2a  
    1616
    1717#include "types.hpp"
     18#include "helpers.hpp"
    1819
    1920class element;
     
    2223{
    2324public:
    24   typedef element*                                      key_type;
     25  typedef const element*                                key_type;
    2526  typedef unsigned int                                  mapped_type;
    2627  typedef std::pair<key_type, mapped_type>              value_type;
     
    6566
    6667  unsigned int getElementCount() const;
    67   bool hasElement(const element*)       const;
     68  bool hasElement(key_type)             const;
    6869  bool hasElement(atomicNumber_t)       const;
    6970  bool hasElement(const std::string&)   const;
    7071
    71   void operator+=(const element*);
     72  void operator+=(key_type);
    7273  void operator+=(atomicNumber_t);
    7374  void operator+=(const std::string&);
    7475
    75   void operator-=(const element*);
     76  void operator-=(key_type);
    7677  void operator-=(atomicNumber_t);
    7778  void operator-=(const std::string&);
    7879
    79   void addElements(const element*,unsigned int);
     80  void addElements(key_type,unsigned int);
    8081  void addElements(atomicNumber_t,unsigned int);
    8182  void addElements(const std::string&,unsigned int);
     
    8384  void addFormula(const Formula&,unsigned int);
    8485
     86  enumeration<key_type> enumerateElements() const;
     87
    8588  // only const versions, because someone might try to increment a previously
    8689  // not set element
    87   const unsigned int operator[](const element*) const;
     90  const unsigned int operator[](key_type) const;
    8891  const unsigned int operator[](atomicNumber_t) const;
    8992  const unsigned int operator[](std::string)    const;
Note: See TracChangeset for help on using the changeset viewer.