Pārlūkot izejas kodu

Compatibility with Eigen 3.3

Former-commit-id: 15e0c066e06609ffb325f195953de79d0df279f2
Jérémie Dumas 7 gadi atpakaļ
vecāks
revīzija
c173e452df
2 mainītis faili ar 14 papildinājumiem un 14 dzēšanām
  1. 6 6
      include/igl/hessian.cpp
  2. 8 8
      include/igl/hessian_energy.cpp

+ 6 - 6
include/igl/hessian.cpp

@@ -27,15 +27,15 @@ IGL_INLINE void igl::hessian(
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::DiagonalMatrix
     typedef typename Eigen::DiagonalMatrix
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
-    
+
     int dim = V.cols();
     int dim = V.cols();
     assert((dim==2 || dim==3) &&
     assert((dim==2 || dim==3) &&
            "The dimension of the vertices should be 2 or 3");
            "The dimension of the vertices should be 2 or 3");
-    
+
     //Construct the combined gradient matric
     //Construct the combined gradient matric
     SparseMat G;
     SparseMat G;
-    igl::grad(Eigen::PlainObjectBase<DerivedV>(V),
-              Eigen::PlainObjectBase<DerivedF>(F),
+    igl::grad(DerivedV(V),
+              DerivedF(F),
               G, false);
               G, false);
     SparseMat GG(F.rows(), dim*V.rows());
     SparseMat GG(F.rows(), dim*V.rows());
     GG.reserve(G.nonZeros());
     GG.reserve(G.nonZeros());
@@ -43,12 +43,12 @@ IGL_INLINE void igl::hessian(
         GG.middleCols(i*G.cols(),G.cols()) = G.middleRows(i*F.rows(),F.rows());
         GG.middleCols(i*G.cols(),G.cols()) = G.middleRows(i*F.rows(),F.rows());
     SparseMat D;
     SparseMat D;
     igl::repdiag(GG,dim,D);
     igl::repdiag(GG,dim,D);
-    
+
     //Compute area matrix
     //Compute area matrix
     VecXd areas;
     VecXd areas;
     igl::doublearea(V, F, areas);
     igl::doublearea(V, F, areas);
     DiagMat A = (0.5*areas).replicate(dim,1).asDiagonal();
     DiagMat A = (0.5*areas).replicate(dim,1).asDiagonal();
-    
+
     //Compute FEM Hessian
     //Compute FEM Hessian
     H = D.transpose()*A*G;
     H = D.transpose()*A*G;
 }
 }

+ 8 - 8
include/igl/hessian_energy.cpp

@@ -25,35 +25,35 @@ IGL_INLINE void igl::hessian_energy(
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::SparseMatrix<Scalar> SparseMat;
     typedef typename Eigen::DiagonalMatrix
     typedef typename Eigen::DiagonalMatrix
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
                        <Scalar, Eigen::Dynamic, Eigen::Dynamic> DiagMat;
-    
+
     int dim = V.cols();
     int dim = V.cols();
     assert((dim==2 || dim==3) &&
     assert((dim==2 || dim==3) &&
            "The dimension of the vertices should be 2 or 3");
            "The dimension of the vertices should be 2 or 3");
-    
+
     SparseMat M;
     SparseMat M;
     igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_VORONOI,M);
     igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_VORONOI,M);
-    
+
     //Kill non-interior DOFs
     //Kill non-interior DOFs
     VecXd Mint = M.diagonal();
     VecXd Mint = M.diagonal();
     std::vector<std::vector<int> > bdryLoop;
     std::vector<std::vector<int> > bdryLoop;
-    igl::boundary_loop(Eigen::PlainObjectBase<DerivedF>(F),bdryLoop);
+    igl::boundary_loop(DerivedF(F),bdryLoop);
     for(const std::vector<int>& loop : bdryLoop)
     for(const std::vector<int>& loop : bdryLoop)
         for(const int& bdryVert : loop)
         for(const int& bdryVert : loop)
             Mint(bdryVert) = 0.;
             Mint(bdryVert) = 0.;
-    
+
     //Invert Mint
     //Invert Mint
     for(int i=0; i<Mint.rows(); ++i)
     for(int i=0; i<Mint.rows(); ++i)
         if(Mint(i) > 0)
         if(Mint(i) > 0)
             Mint(i) = 1./Mint(i);
             Mint(i) = 1./Mint(i);
-    
+
     //Repeat Mint to form diaginal matrix
     //Repeat Mint to form diaginal matrix
     DiagMat stackedMinv = Mint.replicate(dim*dim,1).asDiagonal();
     DiagMat stackedMinv = Mint.replicate(dim*dim,1).asDiagonal();
-    
+
     //Compute squared Hessian
     //Compute squared Hessian
     SparseMat H;
     SparseMat H;
     igl::hessian(V,F,H);
     igl::hessian(V,F,H);
     Q = H.transpose()*stackedMinv*H;
     Q = H.transpose()*stackedMinv*H;
-    
+
 }
 }