Loading [MathJax]/extensions/tex2jax.js
PolyFEM
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QuadraticPenaltyForm.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Form.hpp"
4
6
7namespace polyfem::solver
8{
11 {
12 public:
18 const Eigen::MatrixXd &b,
19 const double weight);
20
21 std::string name() const override { return "quadratic-penalty"; }
22
23 double weight() const override { return weight_ * penalty_weight_; }
24
28 double value_unweighted(const Eigen::VectorXd &x) const override;
29
33 void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
34
38 void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override;
39
40 private:
42 Eigen::MatrixXd b_;
43
45 Eigen::VectorXd Atb_;
46
47 const double penalty_weight_;
48 };
49} // namespace polyfem::solver
int x
double weight_
weight of the form (e.g., AL penalty weight or Δt²)
Definition Form.hpp:149
Form for quadratic soft constraints.
void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Compute the first derivative of the value wrt x.
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
Eigen::MatrixXd b_
Constraints value.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
StiffnessMatrix A_
Constraints matrix.
double weight() const override
Get the form's multiplicative constant weight.
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22