bbw.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_BBW_H
  9. #define IGL_BBW_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <igl/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. igl::active_set_params active_set_params;
  25. // Verbosity level
  26. // 0: quiet
  27. // 1: loud
  28. // 2: louder
  29. int verbosity;
  30. public:
  31. IGL_INLINE BBWData();
  32. // Print current state of object
  33. IGL_INLINE void print();
  34. };
  35. // Compute Bounded Biharmonic Weights on a given domain (V,Ele) with a given
  36. // set of boundary conditions
  37. //
  38. // Templates
  39. // DerivedV derived type of eigen matrix for V (e.g. MatrixXd)
  40. // DerivedF derived type of eigen matrix for F (e.g. MatrixXi)
  41. // Derivedb derived type of eigen matrix for b (e.g. VectorXi)
  42. // Derivedbc derived type of eigen matrix for bc (e.g. MatrixXd)
  43. // DerivedW derived type of eigen matrix for W (e.g. MatrixXd)
  44. // Inputs:
  45. // V #V by dim vertex positions
  46. // Ele #Elements by simplex-size list of element indices
  47. // b #b boundary indices into V
  48. // bc #b by #W list of boundary values
  49. // data object containing options, initial guess --> solution and results
  50. // Outputs:
  51. // W #V by #W list of *unnormalized* weights to normalize use
  52. // igl::normalize_row_sums(W,W);
  53. // Returns true on success, false on failure
  54. template <
  55. typename DerivedV,
  56. typename DerivedEle,
  57. typename Derivedb,
  58. typename Derivedbc,
  59. typename DerivedW>
  60. IGL_INLINE bool bbw(
  61. const Eigen::PlainObjectBase<DerivedV> & V,
  62. const Eigen::PlainObjectBase<DerivedEle> & Ele,
  63. const Eigen::PlainObjectBase<Derivedb> & b,
  64. const Eigen::PlainObjectBase<Derivedbc> & bc,
  65. BBWData & data,
  66. Eigen::PlainObjectBase<DerivedW> & W);
  67. }
  68. #ifndef IGL_STATIC_LIBRARY
  69. # include "bbw.cpp"
  70. #endif
  71. #endif