// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "reorder.h" #include "SortableRow.h" #ifndef IGL_NO_EIGEN #include #endif // This implementation is O(n), but also uses O(n) extra memory template< class T > IGL_INLINE void igl::reorder( const std::vector & unordered, std::vector const & index_map, std::vector & ordered) { // copy for the reorder according to index_map, because unsorted may also be // sorted std::vector copy = unordered; ordered.resize(index_map.size()); for(int i = 0; i<(int)index_map.size();i++) { ordered[i] = copy[index_map[i]]; } } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); // generated by autoexplicit.sh template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); # ifndef IGL_NO_EIGEN template void igl::reorder > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); template void igl::reorder > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); # endif template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); #ifdef WIN32 template void igl::reorder(class std::vector > const &,class std::vector > const &,class std::vector > &); template void igl::reorder(class std::vector > const &,class std::vector > const &,class std::vector > &); template void igl::reorder<__int64>(class std::vector<__int64,class std::allocator<__int64> > const &,class std::vector > const &,class std::vector<__int64,class std::allocator<__int64> > &); #endif #endif