bbw.h 2.3 KB

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