PolyFEM
Loading...
Searching...
No Matches
AMIPSForm.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "AdjointForm.hpp"
8
9namespace polyfem
10{
11 class State;
12 namespace assembler
13 {
14 class Assembler;
15 }
16}
17
18namespace polyfem::solver
19{
23 {
24 public:
25 MinJacobianForm(const VariableToSimulationGroup& variable_to_simulation, const State &state)
26 : AdjointForm(variable_to_simulation),
27 state_(state)
28 {
29
30 }
31
32 virtual std::string name() const override { return "min-jacobian"; }
33
34 double value_unweighted(const Eigen::VectorXd &x) const override;
35 void compute_partial_gradient(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
36
37 private:
38 const State &state_;
39 };
40
41 class AMIPSForm : public AdjointForm
42 {
43 public:
44 AMIPSForm(const VariableToSimulationGroup& variable_to_simulation, const State &state);
45
46 virtual std::string name() const override { return "AMIPS"; }
47
48 double value_unweighted(const Eigen::VectorXd &x) const override;
49 void compute_partial_gradient(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
50 bool is_step_valid(const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) const override;
51
52 private:
53 Eigen::VectorXd get_updated_mesh_nodes(const Eigen::VectorXd &x) const
54 {
55 Eigen::VectorXd X = X_rest;
57 return X;
58 }
59
60 const State &state_;
61
62 Eigen::VectorXd X_rest;
63 Eigen::MatrixXi F;
64 std::vector<polyfem::basis::ElementBases> init_geom_bases_;
66 std::shared_ptr<assembler::Assembler> amips_energy_;
67 };
68} // namespace polyfem::solver
int x
main class that contains the polyfem solver and all its state
Definition State.hpp:79
Caches basis evaluation and geometric mapping at every element.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
virtual std::string name() const override
Definition AMIPSForm.hpp:46
bool is_step_valid(const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) const override
Determine if a step from solution x0 to solution x1 is allowed.
Eigen::VectorXd get_updated_mesh_nodes(const Eigen::VectorXd &x) const
Definition AMIPSForm.hpp:53
std::vector< polyfem::basis::ElementBases > init_geom_bases_
Definition AMIPSForm.hpp:64
void compute_partial_gradient(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
std::shared_ptr< assembler::Assembler > amips_energy_
Definition AMIPSForm.hpp:66
assembler::AssemblyValsCache init_ass_vals_cache_
Definition AMIPSForm.hpp:65
const VariableToSimulationGroup variable_to_simulations_
Compute the minimum jacobian of the mesh elements, not differentiable polygon elements not supported!
Definition AMIPSForm.hpp:23
MinJacobianForm(const VariableToSimulationGroup &variable_to_simulation, const State &state)
Definition AMIPSForm.hpp:25
virtual std::string name() const override
Definition AMIPSForm.hpp:32
void compute_partial_gradient(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
A collection of VariableToSimulation.
void compute_state_variable(const ParameterType type, const State *state_ptr, const Eigen::VectorXd &x, Eigen::VectorXd &state_variable) const
Evaluate the variable to simulations and overwrite the state_variable based on x.