20 const std::vector<mesh::LocalBoundary> &local_pressure_boundary,
21 const std::unordered_map<
int, std::vector<mesh::LocalBoundary>> &local_pressure_cavity,
22 const std::vector<int> &dirichlet_nodes,
23 const int n_boundary_samples,
25 const bool is_time_dependent)
27 local_pressure_boundary_(local_pressure_boundary),
28 local_pressure_cavity_(local_pressure_cavity),
29 dirichlet_nodes_(dirichlet_nodes),
30 n_boundary_samples_(n_boundary_samples),
31 pressure_assembler_(pressure_assembler)
40 return -1 * (pressure_energy + pressure_cavity_energy);
46 Eigen::VectorXd pressure_gradv, pressure_cavity_gradv;
49 gradv = pressure_gradv + pressure_cavity_gradv;
58 hessian = pressure_hessian + pressure_cavity_hessian;
69 Eigen::MatrixXd adjoint_zeroed = adjoint;
75 term = -hessian.transpose() * adjoint_zeroed;
81 const int pressure_boundary_id,
82 const Eigen::MatrixXd &
x,
83 const Eigen::MatrixXd &adjoint)
85 Eigen::MatrixXd adjoint_zeroed = adjoint;
88 Eigen::VectorXd pressure_gradv;
93 term = pressure_gradv.transpose() * adjoint_zeroed;
96 assert(term.size() == 1);
double compute_energy(const Eigen::MatrixXd &displacement, const std::vector< mesh::LocalBoundary > &local_pressure_boundary, const int resolution, const double t) const
void compute_grad_volume_id(const Eigen::MatrixXd &displacement, const int boundary_id, const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< int > &dirichlet_nodes, const int resolution, Eigen::VectorXd &grad, const double t=0, const bool multiply_pressure=false) const
void compute_energy_hess(const Eigen::MatrixXd &displacement, const std::vector< mesh::LocalBoundary > &local_pressure_boundary, const std::vector< int > &dirichlet_nodes, const int resolution, const double t, const bool project_to_psd, StiffnessMatrix &hess) const
void compute_energy_grad(const Eigen::MatrixXd &displacement, const std::vector< mesh::LocalBoundary > &local_pressure_boundary, const std::vector< int > &dirichlet_nodes, const int resolution, const double t, Eigen::VectorXd &grad) const
void compute_force_jacobian(const Eigen::MatrixXd &displacement, const std::vector< mesh::LocalBoundary > &local_pressure_boundary, const std::vector< int > &dirichlet_nodes, const int resolution, const double t, const int n_vertices, StiffnessMatrix &hess) const
void compute_cavity_energy_grad(const Eigen::MatrixXd &displacement, const std::unordered_map< int, std::vector< mesh::LocalBoundary > > &local_pressure_cavity, const std::vector< int > &dirichlet_nodes, const int resolution, const double t, Eigen::VectorXd &grad) const
void compute_cavity_energy_hess(const Eigen::MatrixXd &displacement, const std::unordered_map< int, std::vector< mesh::LocalBoundary > > &local_pressure_cavity, const std::vector< int > &dirichlet_nodes, const int resolution, const double t, const bool project_to_psd, StiffnessMatrix &hess) const
double compute_cavity_energy(const Eigen::MatrixXd &displacement, const std::unordered_map< int, std::vector< mesh::LocalBoundary > > &local_pressure_cavity, const int resolution, const double t) const
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix