PolyFEM
Loading...
Searching...
No Matches
ALSolver.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <polysolve/nonlinear/Solver.hpp>
6#include <polyfem/Common.hpp>
7
8#include <Eigen/Core>
9
10#include <functional>
11#include <vector>
12
13namespace polyfem::solver
14{
16 {
17 using NLSolver = polysolve::nonlinear::Solver;
18
19 public:
21 const std::vector<std::shared_ptr<AugmentedLagrangianForm>> &alagr_form,
22 const double initial_al_weight,
23 const double scaling,
24 const double max_al_weight,
25 const double eta_tol,
26 const std::function<void(const Eigen::VectorXd &)> &update_barrier_stiffness);
27 virtual ~ALSolver() = default;
28
29 void solve_al(std::shared_ptr<NLSolver> nl_solver, NLProblem &nl_problem, Eigen::MatrixXd &sol);
30 void solve_reduced(std::shared_ptr<NLSolver> nl_solver, NLProblem &nl_problem, Eigen::MatrixXd &sol);
31
32 std::function<void(const double)> post_subsolve = [](const double) {};
33
34 protected:
35 void set_al_weight(NLProblem &nl_problem, const Eigen::VectorXd &x, const double weight);
36
37 std::vector<std::shared_ptr<AugmentedLagrangianForm>> alagr_forms;
38 const double initial_al_weight;
39 const double scaling;
40 const double max_al_weight;
41 const double eta_tol;
42
43 // TODO: replace this with a member function
44 std::function<void(const Eigen::VectorXd &)> update_barrier_stiffness;
45 };
46} // namespace polyfem::solver
int x
const double max_al_weight
Definition ALSolver.hpp:40
std::vector< std::shared_ptr< AugmentedLagrangianForm > > alagr_forms
Definition ALSolver.hpp:37
polysolve::nonlinear::Solver NLSolver
Definition ALSolver.hpp:17
void set_al_weight(NLProblem &nl_problem, const Eigen::VectorXd &x, const double weight)
Definition ALSolver.cpp:134
std::function< void(const Eigen::VectorXd &)> update_barrier_stiffness
Definition ALSolver.hpp:44
std::function< void(const double)> post_subsolve
Definition ALSolver.hpp:32
const double initial_al_weight
Definition ALSolver.hpp:38
void solve_reduced(std::shared_ptr< NLSolver > nl_solver, NLProblem &nl_problem, Eigen::MatrixXd &sol)
Definition ALSolver.cpp:101
void solve_al(std::shared_ptr< NLSolver > nl_solver, NLProblem &nl_problem, Eigen::MatrixXd &sol)
Definition ALSolver.cpp:23
virtual ~ALSolver()=default