// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 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 "assign.h" #include "../../parallel_for.h" #include "assign_scalar.h" #include namespace igl { namespace copyleft { namespace cgal { // Would be simpler with C++17 `if constexpr` template struct assign_Helper { }; template <> struct assign_Helper { template static void run( const Eigen::MatrixBase & C, const bool slow_and_more_precise, Eigen::PlainObjectBase & D) { D.resizeLike(C); igl::parallel_for(C.size(),[&](Eigen::Index k) { const Eigen::Index i = k%C.rows(); const Eigen::Index j = k/C.rows(); assign_scalar(C(i,j),slow_and_more_precise,D(i,j)); },1000); } }; template <> struct assign_Helper { template static void run( const Eigen::MatrixBase & C, const bool /*slow_and_more_precise*/, Eigen::PlainObjectBase & D) { D = C.template cast(); } }; } } } template IGL_INLINE void igl::copyleft::cgal::assign( const Eigen::MatrixBase & C, const bool slow_and_more_precise, Eigen::PlainObjectBase & D) { using CScalar = typename DerivedC::Scalar; using DScalar = typename DerivedD::Scalar; constexpr bool simple = std::is_assignable::value; assign_Helper::run(C,slow_and_more_precise,D); } template IGL_INLINE void igl::copyleft::cgal::assign( const Eigen::MatrixBase & C, Eigen::PlainObjectBase & D) { const bool slow_and_more_precise = false; return assign(C,slow_and_more_precise,D); } template IGL_INLINE Eigen::Matrix< ReturnScalar, DerivedC::RowsAtCompileTime, DerivedC::ColsAtCompileTime, 1, DerivedC::MaxRowsAtCompileTime, DerivedC::MaxColsAtCompileTime> igl::copyleft::cgal::assign( const Eigen::MatrixBase & C) { Eigen::Matrix< ReturnScalar, DerivedC::RowsAtCompileTime, DerivedC::ColsAtCompileTime, 1, DerivedC::MaxRowsAtCompileTime, DerivedC::MaxColsAtCompileTime> D; assign(C,D); return D; } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, bool, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::copyleft::cgal::assign, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); #endif