crouzeix_raviart_cotmatrix.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Alec Jacobson <alecjacobson@gmail.com>
  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. // CROUZEIX_RAVIART_COTMATRIX Compute the Crouzeix-Raviart cotangent
  16. // stiffness matrix.
  17. //
  18. // See for example "Discrete Quadratic Curvature Energies" [Wardetzky, Bergou,
  19. // Harmon, Zorin, Grinspun 2007]
  20. //
  21. // Inputs:
  22. // V #V by dim list of vertex positions
  23. // F #F by 3/4 list of triangle/tetrahedron indices
  24. // Outputs:
  25. // L #E by #E edge/face-based diagonal cotangent matrix
  26. // E #E by 2/3 list of edges/faces
  27. // EMAP #F*3/4 list of indices mapping allE to E
  28. //
  29. // See also: crouzeix_raviart_massmatrix
  30. template <typename DerivedV, typename DerivedF, typename LT, typename DerivedE, typename DerivedEMAP>
  31. void crouzeix_raviart_cotmatrix(
  32. const Eigen::MatrixBase<DerivedV> & V,
  33. const Eigen::MatrixBase<DerivedF> & F,
  34. Eigen::SparseMatrix<LT> & L,
  35. Eigen::PlainObjectBase<DerivedE> & E,
  36. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  37. // wrapper if E and EMAP are already computed (better match!)
  38. template <typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP, typename LT>
  39. void crouzeix_raviart_cotmatrix(
  40. const Eigen::MatrixBase<DerivedV> & V,
  41. const Eigen::MatrixBase<DerivedF> & F,
  42. const Eigen::MatrixBase<DerivedE> & E,
  43. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  44. Eigen::SparseMatrix<LT> & L);
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. # include "crouzeix_raviart_cotmatrix.cpp"
  48. #endif
  49. #endif