bbw.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef BBW_H
  2. #define BBW_H
  3. #include "../igl_inline.h"
  4. #include <Eigen/Dense>
  5. #ifndef IGL_NO_MOSEK
  6. # include <igl/mosek/mosek_quadprog.h>
  7. #endif
  8. #include <igl/active_set.h>
  9. namespace igl
  10. {
  11. enum QPSolver
  12. {
  13. QP_SOLVER_IGL_ACTIVE_SET = 0,
  14. QP_SOLVER_MOSEK = 1,
  15. NUM_QP_SOLVERS = 2
  16. };
  17. const char * const QPSolverNames[NUM_QP_SOLVERS] =
  18. {
  19. "QP_SOLVER_IGL_ACTIVE_SET",
  20. "QP_SOLVER_MOSEK"
  21. };
  22. // Container for BBW computation related data and flags
  23. class BBWData
  24. {
  25. public:
  26. // Enforce partition of unity during optimization (optimize all weight
  27. // simultaneously)
  28. bool partition_unity;
  29. // Initial guess
  30. Eigen::MatrixXd W0;
  31. #ifndef IGL_NO_MOSEK
  32. igl::MosekData mosek_data;
  33. #endif
  34. igl::active_set_params active_set_params;
  35. // Which solver
  36. QPSolver qp_solver;
  37. // Verbosity level
  38. // 0: quiet
  39. // 1: loud
  40. // 2: louder
  41. int verbosity;
  42. public:
  43. BBWData();
  44. // Print current state of object
  45. void print();
  46. };
  47. // Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
  48. // set of boundary conditions
  49. //
  50. // Templates
  51. // DerivedV derived type of eigen matrix for V (e.g. MatrixXd)
  52. // DerivedF derived type of eigen matrix for F (e.g. MatrixXi)
  53. // Derivedb derived type of eigen matrix for b (e.g. VectorXi)
  54. // Derivedbc derived type of eigen matrix for bc (e.g. MatrixXd)
  55. // DerivedW derived type of eigen matrix for W (e.g. MatrixXd)
  56. // Inputs:
  57. // V #V by dim vertex positions
  58. // Ele #Elements by simplex-size list of element indices
  59. // b #b boundary indices into V
  60. // bc #b by #W list of boundary values
  61. // data object containing options, intial guess --> solution and results
  62. // Outputs:
  63. // W #V by #W list of *unnormalized* weights to normalize use
  64. // igl::normalize_row_sums(W,W);
  65. // Returns true on success, false on failure
  66. template <
  67. typename DerivedV,
  68. typename DerivedEle,
  69. typename Derivedb,
  70. typename Derivedbc,
  71. typename DerivedW>
  72. IGL_INLINE bool bbw(
  73. const Eigen::PlainObjectBase<DerivedV> & V,
  74. const Eigen::PlainObjectBase<DerivedEle> & Ele,
  75. const Eigen::PlainObjectBase<Derivedb> & b,
  76. const Eigen::PlainObjectBase<Derivedbc> & bc,
  77. BBWData & data,
  78. Eigen::PlainObjectBase<DerivedW> & W);
  79. }
  80. #ifdef IGL_HEADER_ONLY
  81. # include "bbw.cpp"
  82. #endif
  83. #endif