cr_vector_mass.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Oded Stein <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_CR_VECTOR_MASS
  9. #define IGL_CR_VECTOR_MASS
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. /// Computes the CR vector mass matrix, using an arrangement of all parallel
  16. /// degrees of freedom first, and all perpendicular degrees of freedom next.
  17. /// See Oded Stein, Max Wardetzky, Alec Jacobson, Eitan Grinspun, 2020.
  18. /// "A Simple Discretization of the Vector Dirichlet Energy"
  19. ///
  20. /// @param[in] V #V by 3 list of mesh vertex positions
  21. /// @param[in] F #F by 3 list of mesh face indices into rows of V
  22. /// @param[in] E #F by 3 a mapping from each halfedge to each edge
  23. /// @param[out] L 2*|HE| by 2*|HE| computed Mass matrix
  24. template <typename DerivedV, typename DerivedF, typename DerivedE,
  25. typename ScalarM>
  26. IGL_INLINE void
  27. cr_vector_mass(
  28. const Eigen::MatrixBase<DerivedV>& V,
  29. const Eigen::MatrixBase<DerivedF>& F,
  30. const Eigen::MatrixBase<DerivedE>& E,
  31. Eigen::SparseMatrix<ScalarM>& M);
  32. /// \overload
  33. ///
  34. /// \brief `E` are (possibly?) computed and output.
  35. template <typename DerivedV, typename DerivedF, typename DerivedE,
  36. typename ScalarM>
  37. IGL_INLINE void
  38. cr_vector_mass(
  39. const Eigen::MatrixBase<DerivedV>& V,
  40. const Eigen::MatrixBase<DerivedF>& F,
  41. Eigen::PlainObjectBase<DerivedE>& E,
  42. Eigen::SparseMatrix<ScalarM>& M);
  43. /// \overload
  44. /// \brief intrinsic version.
  45. ///
  46. /// @param[in] dA #F list of double areas
  47. ///
  48. /// \fileinfo
  49. template <typename DerivedF, typename DeriveddA,
  50. typename DerivedE, typename ScalarM>
  51. IGL_INLINE void
  52. cr_vector_mass_intrinsic(
  53. const Eigen::MatrixBase<DerivedF>& F,
  54. const Eigen::MatrixBase<DeriveddA>& dA,
  55. const Eigen::MatrixBase<DerivedE>& E,
  56. Eigen::SparseMatrix<ScalarM>& M);
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. # include "cr_vector_mass.cpp"
  60. #endif
  61. #endif