Alec Jacobson 5 years ago
parent
commit
78a212d4ca
2 changed files with 10 additions and 15 deletions
  1. 8 9
      include/igl/facet_adjacency_matrix.cpp
  2. 2 6
      include/igl/unique_edge_map.cpp

+ 8 - 9
include/igl/facet_adjacency_matrix.cpp

@@ -10,8 +10,7 @@
 
 template <typename DerivedF, typename Atype>
 IGL_INLINE void igl::facet_adjacency_matrix(
-  const Eigen::MatrixBase<DerivedF> & F,
-  Eigen::SparseMatrix<Atype> & A)
+  const Eigen::MatrixBase<DerivedF> & F, Eigen::SparseMatrix<Atype> & A)
 {
   using namespace Eigen;
   typedef typename DerivedF::Scalar Index;
@@ -21,18 +20,18 @@ IGL_INLINE void igl::facet_adjacency_matrix(
   igl::unique_edge_map(F,E,uE,EMAP,uEC,uEE);
   std::vector<Eigen::Triplet<Index> > AIJV;
   AIJV.reserve(2*uE.rows());
-  const int nu = uE.rows();
-  for(int ue = 0;ue<nu;ue++)
+  const Eigen::Index nu = uE.rows();
+  for(Eigen::Index ue = 0;ue<nu;ue++)
   {
     // number of faces incident on this unique edge
-    const int mue = uEC(ue+1)-uEC(ue);
+    const Eigen::Index mue = uEC(ue+1)-uEC(ue);
     // base offset in uEE
-    const int uECue = uEC(ue);
+    const Eigen::Index uECue = uEC(ue);
     assert(uECue < uEE.rows());
-    for(int i = 0;i<mue;i++)
+    for(Eigen::Index i = 0;i<mue;i++)
     {
       const auto ii = uEE(uECue+i)%m;
-      for(int j = 0;j<mue;j++)
+      for(Eigen::Index j = 0;j<mue;j++)
       {
         const auto jj = uEE(uECue+j)%m;
         if(ii != jj){ AIJV.emplace_back(ii,jj,1);}
@@ -43,7 +42,7 @@ IGL_INLINE void igl::facet_adjacency_matrix(
   A.resize(m,m);
   A.setFromTriplets(AIJV.begin(),AIJV.end());
   // Set all non-zerro values to 1
-  for(int g = 0;g<A.outerSize();g++)
+  for(Eigen::Index g = 0;g<A.outerSize();g++)
   {
     for(typename Eigen::SparseMatrix<Atype>::InnerIterator it (A,g); it; ++it)
     {

+ 2 - 6
include/igl/unique_edge_map.cpp

@@ -96,8 +96,8 @@ IGL_INLINE void igl::unique_edge_map(
   uEE.resize(EMAP.rows(),1);
   for(int e = 0;e<EMAP.rows();e++)
   {
-    const int ue = EMAP(e);
-    const int i = uEC(ue)+ uEO(ue);
+    const typename DerivedEMAP::Scalar ue = EMAP(e);
+    const typename DeriveduEC::Scalar i = uEC(ue)+ uEO(ue);
     uEE(i) = e;
     uEO(ue)++;
   }
@@ -106,13 +106,9 @@ IGL_INLINE void igl::unique_edge_map(
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
-// generated by autoexplicit.sh
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
-// generated by autoexplicit.sh
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, 3, 1, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, unsigned long>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 1, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&);
-// generated by autoexplicit.sh
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&);
-// generated by autoexplicit.sh
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > >&);
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long>(Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);
 template void igl::unique_edge_map<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<int, -1, 2, 0, -1, 2>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, long>(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 2, 0, -1, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, std::vector<std::vector<long, std::allocator<long> >, std::allocator<std::vector<long, std::allocator<long> > > >&);