PolyFEM
Loading...
Searching...
No Matches
InertiaForm.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Form.hpp"
4
7
8#include <Eigen/Core>
9
10#include <functional>
11
12namespace polyfem::solver
13{
15 class InertiaForm : public Form
16 {
18
19 public:
23 InertiaForm(const StiffnessMatrix &mass,
24 const time_integrator::ImplicitTimeIntegrator &time_integrator);
25
26 std::string name() const override { return "inertia"; }
27
28 using XTildeUpdater = std::function<void(const double, const Eigen::VectorXd &, Eigen::VectorXd &)>;
29 // Optional hook for fields whose time-dependent essential boundary values require a
30 // lifted time-integrator prediction before applying the mass term.
32
33 void update_quantities(const double t, const Eigen::VectorXd &x) override;
34
35 protected:
39 double value_unweighted(const Eigen::VectorXd &x) const override;
40
44 void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
45
49 void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override;
50
51 private:
52 Eigen::VectorXd x_tilde() const;
53
54 // TODO mass might be time dependent
58 Eigen::VectorXd x_tilde_;
59 };
60} // namespace polyfem::solver
int x
Form of the inertia.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
void set_x_tilde_updater(XTildeUpdater updater)
void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Compute the first derivative of the value wrt x.
std::string name() const override
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
void update_quantities(const double t, const Eigen::VectorXd &x) override
Update time-dependent fields.
Eigen::VectorXd x_tilde() const
const time_integrator::ImplicitTimeIntegrator & time_integrator_
Time integrator.
const StiffnessMatrix & mass_
Mass matrix.
std::function< void(const double, const Eigen::VectorXd &, Eigen::VectorXd &)> XTildeUpdater
Implicit time integrator of a second order ODE (equivently a system of coupled first order ODEs).
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:24