Changeset 0477b0 for src/Atom


Ignore:
Timestamp:
Apr 10, 2018, 6:43:11 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
8ddd07
Parents:
56b4c6
git-author:
Frederik Heber <frederik.heber@…> (06/24/17 11:22:59)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:11)
Message:

Added sortByIds() to AtomSetMixin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Atom/AtomSet.hpp

    r56b4c6 r0477b0  
    1616
    1717
     18#include <algorithm>
    1819#include <functional>
     20#include <limits>
    1921#include <numeric>
    20 #include <algorithm>
     22
     23#include <boost/bind.hpp>
    2124#include <boost/foreach.hpp>
    22 #include <limits>
    2325
    2426/**
     
    7981  size_t getMaxTrajectorySize() const;
    8082
     83  void sortByIds();
     84
    8185private:
    8286  template<class Function>
     
    201205}
    202206
     207template <class container_type,
     208          class iterator_type,
     209          class const_iterator_type>
     210inline void AtomSetMixin<container_type,iterator_type,const_iterator_type>::sortByIds(){
     211  std::sort(this->begin(), this->end(),
     212      boost::bind(std::less<atomId_t>(),
     213          boost::bind(&atom::getId, _1),
     214          boost::bind(&atom::getId, _2)));
     215}
     216
    203217// allows simpler definition of AtomSets
    204218#define ATOMSET(container_type) AtomSetMixin<container_type<atom*> >
Note: See TracChangeset for help on using the changeset viewer.