crouzeix_raviart_cotmatrix.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Alec Jacobson <[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_CROUZEIX_RAVIART_COTMATRIX
  9. #define IGL_CROUZEIX_RAVIART_COTMATRIX
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. /// Compute the Crouzeix-Raviart cotangent stiffness matrix.
  16. ///
  17. /// See for example "Discrete Quadratic Curvature Energies" [Wardetzky, Bergou,
  18. /// Harmon, Zorin, Grinspun 2007]
  19. ///
  20. /// @param[in] V #V by dim list of vertex positions
  21. /// @param[in] F #F by 3/4 list of triangle/tetrahedron indices
  22. /// @param[out] L #E by #E edge/face-based diagonal cotangent matrix
  23. /// @param[out] E #E by 2/3 list of edges/faces
  24. /// @param[out] EMAP #F*3/4 list of indices mapping allE to E
  25. ///
  26. /// \see crouzeix_raviart_massmatrix
  27. template <typename DerivedV, typename DerivedF, typename LT, typename DerivedE, typename DerivedEMAP>
  28. void crouzeix_raviart_cotmatrix(
  29. const Eigen::MatrixBase<DerivedV> & V,
  30. const Eigen::MatrixBase<DerivedF> & F,
  31. Eigen::SparseMatrix<LT> & L,
  32. Eigen::PlainObjectBase<DerivedE> & E,
  33. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  34. /// Compute the Crouzeix-Raviart cotangent stiffness matrix.
  35. ///
  36. /// See for example "Discrete Quadratic Curvature Energies" [Wardetzky, Bergou,
  37. /// Harmon, Zorin, Grinspun 2007]
  38. ///
  39. /// @param[in] V #V by dim list of vertex positions
  40. /// @param[in] F #F by 3/4 list of triangle/tetrahedron indices
  41. /// @param[in] E #E by 2/3 list of edges/faces
  42. /// @param[in] EMAP #F*3/4 list of indices mapping allE to E
  43. /// @param[out] L #E by #E edge/face-based diagonal cotangent matrix
  44. ///
  45. /// \see crouzeix_raviart_massmatrix
  46. template <typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP, typename LT>
  47. void crouzeix_raviart_cotmatrix(
  48. const Eigen::MatrixBase<DerivedV> & V,
  49. const Eigen::MatrixBase<DerivedF> & F,
  50. const Eigen::MatrixBase<DerivedE> & E,
  51. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  52. Eigen::SparseMatrix<LT> & L);
  53. }
  54. #ifndef IGL_STATIC_LIBRARY
  55. # include "crouzeix_raviart_cotmatrix.cpp"
  56. #endif
  57. #endif