Changeset 795c0f for src/Descriptors/AtomDescriptor.cpp
- Timestamp:
- Jul 24, 2015, 4:44:34 PM (10 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, Candidate_v1.7.0, 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:
- 63fb7a
- Parents:
- 97445f
- git-author:
- Frederik Heber <heber@…> (06/01/15 08:30:56)
- git-committer:
- Frederik Heber <heber@…> (07/24/15 16:44:34)
- File:
-
- 1 edited
-
src/Descriptors/AtomDescriptor.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Descriptors/AtomDescriptor.cpp
r97445f r795c0f 49 49 50 50 typedef World::AtomSet::internal_iterator atoms_iter_t; 51 typedef World::AtomSet::const_iterator atoms_const_iter_t; 51 52 52 53 /************************ Forwarding object **************************************/ … … 75 76 } 76 77 78 const atom* AtomDescriptor::find() const { 79 return const_cast<const impl_t &>(*impl).find(); 80 } 81 77 82 std::vector<atom*> AtomDescriptor::findAll(){ 78 83 return impl->findAll(); 79 84 } 80 85 86 std::vector<const atom*> AtomDescriptor::findAll() const { 87 return const_cast<const impl_t &>(*impl).findAll(); 88 } 89 81 90 AtomDescriptor::impl_ptr AtomDescriptor::get_impl() const{ 82 91 return impl; … … 98 107 World::AtomSet& AtomDescriptor_impl::getAtoms(){ 99 108 return World::getInstance().atoms; 109 } 110 111 const World::AtomSet& AtomDescriptor_impl::getAtoms() const { 112 return const_cast<const World &>(World::getInstance()).atoms; 100 113 } 101 114 … … 104 117 atoms_iter_t res = find_if(atoms.begin_internal(),atoms.end_internal(),boost::bind(&AtomDescriptor_impl::predicate,this,_1)); 105 118 return (res!=atoms.end_internal())?((*res).second):0; 119 } 120 121 const atom* AtomDescriptor_impl::find() const { 122 const World::AtomSet &atoms = getAtoms(); 123 atoms_const_iter_t res = find_if(atoms.begin(),atoms.end(),boost::bind(&AtomDescriptor_impl::predicate,this,_1)); 124 return (res!=atoms.end())?((*res).second):0; 106 125 } 107 126 … … 111 130 for_each(atoms.begin_internal(), 112 131 atoms.end_internal(), 113 boost::bind(&AtomDescriptor_impl::checkAndAdd, 114 this,&res,_1)); 132 boost::bind(static_cast<void (AtomDescriptor_impl::*)( 133 std::vector<atom*> *, 134 std::pair<atomId_t,atom*>)>(&AtomDescriptor_impl::checkAndAdd), 135 this,boost::cref(&res),_1)); 136 return res; 137 } 138 139 vector<const atom*> AtomDescriptor_impl::findAll() const { 140 vector<const atom*> res; 141 const World::AtomSet &atoms = getAtoms(); 142 for_each(atoms.begin(), 143 atoms.end(), 144 boost::bind(static_cast<void (AtomDescriptor_impl::*)( 145 std::vector<const atom*> *, 146 std::pair<atomId_t,const atom*>) const>(&AtomDescriptor_impl::checkAndAdd), 147 boost::cref(this),&res,_1)); 115 148 return res; 116 149 } … … 122 155 } 123 156 157 void AtomDescriptor_impl::checkAndAdd(std::vector<const atom*> *v,std::pair<atomId_t,const atom*> p) const{ 158 if(predicate(p)){ 159 v->push_back(p.second); 160 } 161 } 162 124 163 /************************** Universe and Emptyset *****************/ 125 164 … … 130 169 {} 131 170 132 bool AtomAllDescriptor_impl::predicate(std::pair<atomId_t, atom*>){171 bool AtomAllDescriptor_impl::predicate(std::pair<atomId_t,const atom*>) const{ 133 172 return true; 134 173 } … … 144 183 {} 145 184 146 bool AtomNoneDescriptor_impl::predicate(std::pair<atomId_t, atom*>){185 bool AtomNoneDescriptor_impl::predicate(std::pair<atomId_t,const atom*>) const{ 147 186 return false; 148 187 } … … 162 201 {} 163 202 164 bool AtomAndDescriptor_impl::predicate(std::pair<atomId_t, atom*> atom){203 bool AtomAndDescriptor_impl::predicate(std::pair<atomId_t,const atom*> atom) const{ 165 204 return lhs->predicate(atom) && rhs->predicate(atom); 166 205 } … … 178 217 } 179 218 180 bool AtomOrDescriptor_impl::predicate(std::pair<atomId_t, atom*> atom){219 bool AtomOrDescriptor_impl::predicate(std::pair<atomId_t,const atom*> atom) const{ 181 220 return lhs->predicate(atom) || rhs->predicate(atom); 182 221 } … … 198 237 } 199 238 200 bool AtomNotDescriptor_impl::predicate(std::pair<atomId_t, atom*> atom){239 bool AtomNotDescriptor_impl::predicate(std::pair<atomId_t,const atom*> atom) const{ 201 240 return !(arg->predicate(atom)); 202 241 }
Note:
See TracChangeset
for help on using the changeset viewer.
