12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include "cotmatrix_intrinsic.h"
- #include "cotmatrix_entries.h"
- #include <iostream>
- template <typename Derivedl, typename DerivedF, typename Scalar>
- IGL_INLINE void igl::cotmatrix_intrinsic(
- const Eigen::MatrixBase<Derivedl> & l,
- const Eigen::MatrixBase<DerivedF> & F,
- Eigen::SparseMatrix<Scalar>& L)
- {
- using namespace Eigen;
- using namespace std;
-
- const int nverts = F.maxCoeff()+1;
- L.resize(nverts,nverts);
- Matrix<int,Dynamic,2> edges;
- int simplex_size = F.cols();
-
- assert(simplex_size == 3);
-
-
-
- L.reserve(10*nverts);
- edges.resize(3,2);
- edges <<
- 1,2,
- 2,0,
- 0,1;
-
- Matrix<Scalar,Dynamic,Dynamic> C;
- cotmatrix_entries(l,C);
-
- vector<Triplet<Scalar> > IJV;
- IJV.reserve(F.rows()*edges.rows()*4);
-
- for(int i = 0; i < F.rows(); i++)
- {
-
- for(int e = 0;e<edges.rows();e++)
- {
- int source = F(i,edges(e,0));
- int dest = F(i,edges(e,1));
- IJV.push_back(Triplet<Scalar>(source,dest,C(i,e)));
- IJV.push_back(Triplet<Scalar>(dest,source,C(i,e)));
- IJV.push_back(Triplet<Scalar>(source,source,-C(i,e)));
- IJV.push_back(Triplet<Scalar>(dest,dest,-C(i,e)));
- }
- }
- L.setFromTriplets(IJV.begin(),IJV.end());
- }
- #ifdef IGL_STATIC_LIBRARY
- template void igl::cotmatrix_intrinsic<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
- template void igl::cotmatrix_intrinsic<Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 1, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
- template void igl::cotmatrix_intrinsic<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 4, 0, -1, 4>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 4, 0, -1, 4> > const&, Eigen::SparseMatrix<double, 0, int>&);
- template void igl::cotmatrix_intrinsic<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> > const&, Eigen::SparseMatrix<double, 0, int>&);
- template void igl::cotmatrix_intrinsic<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
- #endif
|