massmatrix.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef IGL_MASSMATRIX_H
  2. #define IGL_MASSMATRIX_H
  3. #include "igl_inline.h"
  4. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  5. #include <Eigen/Dense>
  6. #include <Eigen/Sparse>
  7. namespace igl
  8. {
  9. enum MassMatrixType
  10. {
  11. MASSMATRIX_BARYCENTRIC,
  12. MASSMATRIX_VORONOI,
  13. MASSMATRIX_FULL
  14. };
  15. #define NUM_MASSMATRIXTYPE 3
  16. // Constructs the mass (area) matrix for a given mesh (V,F).
  17. //
  18. // Templates:
  19. // DerivedV derived type of eigen matrix for V (e.g. derived from
  20. // MatrixXd)
  21. // DerivedF derived type of eigen matrix for F (e.g. derived from
  22. // MatrixXi)
  23. // Scalar scalar type for eigen sparse matrix (e.g. double)
  24. // Inputs:
  25. // V #V by dim list of mesh vertex positions
  26. // F #F by simplex_size list of mesh faces (must be triangles)
  27. // type one of the following ints:
  28. // IGL_MASSMATRIX_BARYCENTRIC barycentric
  29. // IGL_MASSMATRIX_VORONOI voronoi-hybrid {default}
  30. // IGL_MASSMATRIX_FULL full {not implemented}
  31. // Outputs:
  32. // M #V by #V mass matrix
  33. //
  34. // See also: adjacency_matrix
  35. //
  36. template <typename DerivedV, typename DerivedF, typename Scalar>
  37. IGL_INLINE void massmatrix(
  38. const Eigen::MatrixBase<DerivedV> & V,
  39. const Eigen::MatrixBase<DerivedF> & F,
  40. const MassMatrixType type,
  41. Eigen::SparseMatrix<Scalar>& M);
  42. }
  43. #ifdef IGL_HEADER_ONLY
  44. # include "massmatrix.cpp"
  45. #endif
  46. #endif