// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "bbw.h" #include "min_quad_with_fixed.h" #include "harmonic.h" #include "parallel_for.h" #include #include #include #include igl::BBWData::BBWData(): partition_unity(false), W0(), active_set_params(), verbosity(0) { // We know that the Bilaplacian is positive semi-definite active_set_params.Auu_pd = true; } void igl::BBWData::print() { using namespace std; cout<<"partition_unity: "< IGL_INLINE bool igl::bbw( const Eigen::PlainObjectBase & V, const Eigen::PlainObjectBase & Ele, const Eigen::PlainObjectBase & b, const Eigen::PlainObjectBase & bc, igl::BBWData & data, Eigen::PlainObjectBase & W ) { using namespace std; using namespace Eigen; assert(!data.partition_unity && "partition_unity not implemented yet"); // number of domain vertices int n = V.rows(); // number of handles int m = bc.cols(); // Build biharmonic operator Eigen::SparseMatrix Q; harmonic(V,Ele,2,Q); W.derived().resize(n,m); // No linear terms VectorXd c = VectorXd::Zero(n); // No linear constraints SparseMatrix A(0,n),Aeq(0,n),Aieq(0,n); VectorXd Beq(0,1),Bieq(0,1); // Upper and lower box constraints (Constant bounds) VectorXd ux = VectorXd::Ones(n); VectorXd lx = VectorXd::Zero(n); active_set_params eff_params = data.active_set_params; if(data.verbosity >= 1) { cout<<"BBW: max_iter: "<= 1) { cout<<"BBW: Computing initial weights for "< mqwf; min_quad_with_fixed_precompute(Q,b,Aeq,true,mqwf); min_quad_with_fixed_solve(mqwf,c,bc,Beq,W); // decrement eff_params.max_iter--; bool error = false; // Loop over handles std::mutex critical; const auto & optimize_weight = [&](const int i) { // Quicker exit for paralle_for if(error) { return; } if(data.verbosity >= 1) { std::lock_guard lock(critical); cout<<"BBW: Computing weight for handle "<, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, igl::BBWData&, Eigen::PlainObjectBase >&); #endif