bbw.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_BBW_H
  9. #define IGL_BBW_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include "active_set.h"
  13. namespace igl
  14. {
  15. /// Container for BBW computation related data and flags
  16. class BBWData
  17. {
  18. public:
  19. /// Enforce partition of unity during optimization (optimize all weight
  20. /// simultaneously)
  21. bool partition_unity;
  22. /// Initial guess
  23. Eigen::MatrixXd W0;
  24. /// Parameters for active set solver \see active_set
  25. igl::active_set_params active_set_params;
  26. /// Verbosity level
  27. /// 0: quiet
  28. /// 1: loud
  29. /// 2: louder
  30. int verbosity;
  31. public:
  32. /// @private
  33. IGL_INLINE BBWData();
  34. /// Print current state of object
  35. IGL_INLINE void print();
  36. };
  37. /// Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
  38. /// set of boundary conditions
  39. ///
  40. /// @tparam DerivedV derived type of eigen matrix for V (e.g. Eigen::MatrixXd)
  41. /// @tparam DerivedF derived type of eigen matrix for F (e.g. Eigen::MatrixXi)
  42. /// @tparam Derivedb derived type of eigen matrix for b (e.g. Eigen::VectorXi)
  43. /// @tparam Derivedbc derived type of eigen matrix for bc (e.g. Eigen::MatrixXd)
  44. /// @tparam DerivedW derived type of eigen matrix for W (e.g. Eigen::MatrixXd)
  45. /// @param[in] V #V by dim vertex positions
  46. /// @param[in] Ele #Elements by simplex-size list of element indices
  47. /// @param[in] b #b boundary indices into V
  48. /// @param[in] bc #b by #W list of boundary values
  49. /// @param[in,out] data object containing options, initial guess --> solution and results
  50. /// @param[out] W #V by #W list of *unnormalized* weights to normalize use
  51. /// igl::normalize_row_sums(W,W);
  52. /// @return true on success, false on failure
  53. template <
  54. typename DerivedV,
  55. typename DerivedEle,
  56. typename Derivedb,
  57. typename Derivedbc,
  58. typename DerivedW>
  59. IGL_INLINE bool bbw(
  60. const Eigen::MatrixBase<DerivedV> & V,
  61. const Eigen::MatrixBase<DerivedEle> & Ele,
  62. const Eigen::MatrixBase<Derivedb> & b,
  63. const Eigen::MatrixBase<Derivedbc> & bc,
  64. BBWData & data,
  65. Eigen::PlainObjectBase<DerivedW> & W);
  66. }
  67. #ifndef IGL_STATIC_LIBRARY
  68. # include "bbw.cpp"
  69. #endif
  70. #endif