crouzeix_raviart_massmatrix.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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 CROUZEIX_RAVIART_MASSMATRIX_H
  9. #define CROUZEIX_RAVIART_MASSMATRIX_H
  10. #include <Eigen/Dense>
  11. #include <Eigen/Sparse>
  12. namespace igl
  13. {
  14. // CROUZEIX_RAVIART_MASSMATRIX Compute the Crouzeix-Raviart mass matrix where
  15. // M(e,e) is just the sum of the areas of the triangles on either side of an
  16. // edge e.
  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. // M #E by #E edge/face-based diagonal mass 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_cotmatrix
  30. template <typename MT, typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP>
  31. void crouzeix_raviart_massmatrix(
  32. const Eigen::MatrixBase<DerivedV> & V,
  33. const Eigen::MatrixBase<DerivedF> & F,
  34. Eigen::SparseMatrix<MT> & M,
  35. Eigen::PlainObjectBase<DerivedE> & E,
  36. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  37. // wrapper if E and EMAP are already computed (better match!)
  38. template <typename MT, typename DerivedV, typename DerivedF, typename DerivedE, typename DerivedEMAP>
  39. void crouzeix_raviart_massmatrix(
  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<MT> & M);
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. # include "crouzeix_raviart_massmatrix.cpp"
  48. #endif
  49. #endif