Changeset d8a0ec
- Timestamp:
- Jul 22, 2010, 11:11:40 AM (14 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:
- 3d27e6
- Parents:
- e24c78
- git-author:
- Tillmann Crueger <crueger@…> (07/22/10 09:17:45)
- git-committer:
- Tillmann Crueger <crueger@…> (07/22/10 11:11:40)
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Formula.cpp
re24c78 rd8a0ec 159 159 if(!elementCounts[Z-1]){ 160 160 numElements--; 161 // resize the Array if this was at the last position 162 if(Z==elementCounts.size()){ 163 // find the first element from the back that is not equal to zero 164 set_t::reverse_iterator riter = find_if(elementCounts.rbegin(), 165 elementCounts.rend(), 166 bind1st(not_equal_to<mapped_type>(),0)); 167 // see how many elements are in this range 168 set_t::reverse_iterator::difference_type diff = riter - elementCounts.rbegin(); 169 elementCounts.resize(elementCounts.size()-diff); 170 } 161 171 } 162 172 } … … 210 220 // quick check... number of elements used 211 221 if(numElements != rhs.numElements){ 222 return false; 223 } 224 // second quick check, size of vectors (== last element in formula) 225 if(elementCounts.size()!=rhs.elementCounts.size()){ 212 226 return false; 213 227 } … … 229 243 } 230 244 Formula::const_iterator Formula::begin() const{ 231 return const_iterator(elementCounts,0); 245 // this is the only place where this is needed, so this is better than making it mutable 246 return const_iterator(const_cast<set_t&>(elementCounts),0); 232 247 } 233 248 Formula::iterator Formula::end(){ … … 235 250 } 236 251 Formula::const_iterator Formula::end() const{ 237 return const_iterator(elementCounts); 252 // this is the only place where this is needed, so this is better than making it mutable 253 return const_iterator(const_cast<set_t&>(elementCounts)); 238 254 } 239 255 -
src/Formula.hpp
re24c78 rd8a0ec 98 98 99 99 private: 100 mutable set_t elementCounts; // we might need to resize even at const places 100 // this contains all counts of elements in the formula 101 // the size of the actual structure might be used in comparisons 102 // so be sure not to keep any zero elements at the end 103 // e.g. {5;4;0;0;0;2;1} or {0;1;0;0;2} are ok, but {1;2;3;0;0;0} is bad 104 set_t elementCounts; 101 105 unsigned int numElements; 102 106 };
Note:
See TracChangeset
for help on using the changeset viewer.