/* * BondVectors_impl.hpp * * Created on: Jun 13, 2017 * Author: heber */ #ifndef DYNAMICS_BONDVECTORS_IMPL_HPP_ #define DYNAMICS_BONDVECTORS_IMPL_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "BondVectors.hpp" #include #include "Atom/atom.hpp" BondVectors::BondVectors() : map_is_dirty(false), current_step_for_map((size_t)-1) {} template void BondVectors::setFromAtomRange( typename T::iterator _start, typename T::iterator _end, const size_t &_step) { container.clear(); for (typename T::iterator iter = _start; iter != _end; ++iter) { const atom &walker = **iter; const BondList &ListOfBonds = walker.getListOfBondsAtStep(_step); container.insert(container.end(), ListOfBonds.begin(), ListOfBonds.end()); } // sort and make unique std::sort(container.begin(), container.end()); container.erase(std::unique(container.begin(), container.end()), container.end()); map_is_dirty = true; } const BondVectors::mapped_t& BondVectors::getBondVectorsAtStep(const size_t &_step) const { if (map_is_dirty || (current_step_for_map != _step)) recalculateBondVectorsAtStep(_step); return current_mapped_vectors; } const BondVectors::container_t& BondVectors::getSorted() const { ASSERT( !container.empty(), "BondVectors::getSorted() - empty internal container, not set properly?"); return container; } #endif /* DYNAMICS_BONDVECTORS_IMPL_HPP_ */