|
PolyFEM
|
Maps to pressure boundary. More...
#include <PressureBoundaryVariableToSimulation.hpp>
Public Types | |
| using | StatePtrs = std::vector< std::shared_ptr< legacy::State > > |
| using | DiffCachePtrs = std::vector< std::shared_ptr< DiffCache > > |
Public Member Functions | |
| PressureBoundaryVariableToSimulation (StatePtrs states, DiffCachePtrs diff_caches, CompositeParametrization parametrizations, Eigen::VectorXi active_boundary_ids, Eigen::VectorXi active_time_slices) | |
| Construct ShapeVariableToSimulation. | |
| std::string | name () const override |
| ParameterType | parameter_type () const override |
| bool | affect_state (const legacy::State &target) const override |
| Return true if current var2sim maps to target state. | |
| void | update (const Eigen::VectorXd &x) override |
| Update forward simulation states from optimization variables. | |
| void | update_state_variables (const Eigen::VectorXd &x, Eigen::VectorXd &state_variables) const override |
| Update state variables from optimization variables. | |
| Eigen::VectorXd | compute_adjoint_term (const Eigen::VectorXd &x) const override |
| Compute adjoint contribution of objective gradient. | |
| int | inverse_dof () const override |
| Compute optimization variables dof. | |
| Eigen::VectorXd | inverse_eval () const override |
| Compute optimization variables from forward simulation legacy::State. | |
| Eigen::VectorXd | apply_parametrization_jacobian (const Eigen::VectorXd &term, const Eigen::VectorXd &x) const override |
| Apply parametrization jacobian to compute the gradient w.r.t. | |
Public Member Functions inherited from polyfem::solver::VariableToSimulation | |
| virtual | ~VariableToSimulation ()=default |
Private Member Functions | |
| int | para_out_dof () const |
Private Attributes | |
| bool | is_transient_ |
| int | time_steps_ |
| StatePtrs | states_ |
| DiffCachePtrs | diff_caches_ |
| CompositeParametrization | parametrization_ |
| Eigen::VectorXi | active_boundary_ids_ |
| Eigen::VectorXi | active_time_slices_ |
Maps to pressure boundary.
Maps one boundary solution to all boundaries in one boundary selection. Basically just the pressure version of dirichet boundary var2sim.
Expect optimiztion variable with layout: [ solution of boundary selection 1 at t0] [solution of boundary selection 2 at t0] ... [ solution of boundary selection 1 at t1] [solution of boundary selection 2 at t1] ...
Definition at line 21 of file PressureBoundaryVariableToSimulation.hpp.
| using polyfem::solver::PressureBoundaryVariableToSimulation::DiffCachePtrs = std::vector<std::shared_ptr<DiffCache> > |
Definition at line 25 of file PressureBoundaryVariableToSimulation.hpp.
| using polyfem::solver::PressureBoundaryVariableToSimulation::StatePtrs = std::vector<std::shared_ptr<legacy::State> > |
Definition at line 24 of file PressureBoundaryVariableToSimulation.hpp.
| polyfem::solver::PressureBoundaryVariableToSimulation::PressureBoundaryVariableToSimulation | ( | StatePtrs | states, |
| DiffCachePtrs | diff_caches, | ||
| CompositeParametrization | parametrizations, | ||
| Eigen::VectorXi | active_boundary_ids, | ||
| Eigen::VectorXi | active_time_slices | ||
| ) |
Construct ShapeVariableToSimulation.
| [in] | states | Shared ptr to all forward sim states. |
| [in] | diff_caches | Shared ptr to all diff caches. |
| [in] | parametrizations | Parametrizations. |
| [in] | active_boundary_ids | Active pressure boundary ids. Empty implies all active. |
| [in] | active_time_slices_ | Active time slices. Empty implies all active. Ignored for static problem. |
| std::runtime_error | Throw if input is invalid. |
Definition at line 23 of file PressureBoundaryVariableToSimulation.cpp.
References active_boundary_ids_, active_time_slices_, diff_caches_, polyfem::solver::is_active_pressure_boundary_ids_valid(), polyfem::solver::is_active_time_slices_valid(), is_transient_, polyfem::utils::json_as_array(), polyfem::log_and_throw_adjoint_error(), states_, and time_steps_.
|
overridevirtual |
Return true if current var2sim maps to target state.
Implements polyfem::solver::VariableToSimulation.
Definition at line 100 of file PressureBoundaryVariableToSimulation.cpp.
References states_.
|
overridevirtual |
Apply parametrization jacobian to compute the gradient w.r.t.
to optimization variables.
| term | Gradient w.r.t. to full inherent dof (Ex. all vertices for shape var2sim) |
| x | Optimization variables. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 263 of file PressureBoundaryVariableToSimulation.cpp.
References polyfem::log_and_throw_adjoint_error(), and name().
|
overridevirtual |
Compute adjoint contribution of objective gradient.
See arXiv:2205.13643.
Let objective function be J and optimization variable be x. This method computes all adjoint related terms in dJ/dx. For static case (E.q. 11), it's the second term. For dynamic case (E.q. 15), it's everything except ∂qJ.
| x[in] | Optimization variables. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 154 of file PressureBoundaryVariableToSimulation.cpp.
References active_boundary_ids_, active_time_slices_, polyfem::solver::CompositeParametrization::apply_jacobian(), diff_caches_, polyfem::solver::AdjointTools::dJ_pressure_static_adjoint_term(), polyfem::solver::AdjointTools::dJ_pressure_transient_adjoint_term(), polyfem::get_adjoint_mat(), is_transient_, para_out_dof(), parametrization_, states_, time_steps_, and x.
|
overridevirtual |
Compute optimization variables dof.
| std::runtime_error | Throw if not implemented. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 197 of file PressureBoundaryVariableToSimulation.cpp.
References polyfem::solver::CompositeParametrization::inverse_size(), para_out_dof(), and parametrization_.
|
overridevirtual |
Compute optimization variables from forward simulation legacy::State.
| std::runtime_error | Throw if not implemented. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 202 of file PressureBoundaryVariableToSimulation.cpp.
References active_boundary_ids_, active_time_slices_, polyfem::solver::CompositeParametrization::inverse_eval(), is_transient_, polyfem::utils::json_as_array(), polyfem::logger(), para_out_dof(), parametrization_, states_, time_steps_, and y.
|
overridevirtual |
Implements polyfem::solver::VariableToSimulation.
Definition at line 90 of file PressureBoundaryVariableToSimulation.cpp.
Referenced by apply_parametrization_jacobian().
|
private |
Definition at line 269 of file PressureBoundaryVariableToSimulation.cpp.
References active_boundary_ids_, active_time_slices_, and is_transient_.
Referenced by compute_adjoint_term(), inverse_dof(), inverse_eval(), update(), and update_state_variables().
|
overridevirtual |
Implements polyfem::solver::VariableToSimulation.
Definition at line 95 of file PressureBoundaryVariableToSimulation.cpp.
References polyfem::solver::PressureBC.
|
overridevirtual |
Update forward simulation states from optimization variables.
| [in] | x | Optimization variables. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 112 of file PressureBoundaryVariableToSimulation.cpp.
References active_boundary_ids_, active_time_slices_, polyfem::solver::CompositeParametrization::eval(), is_transient_, polyfem::log_and_throw_adjoint_error(), para_out_dof(), parametrization_, states_, x, and y.
|
overridevirtual |
Update state variables from optimization variables.
Compared to update() this method update abstract state variables instead of writing directly to state.
| [in] | x | Optimization variables. |
| [out] | state_variables | Abstract state variables update dst. |
Implements polyfem::solver::VariableToSimulation.
Definition at line 148 of file PressureBoundaryVariableToSimulation.cpp.
References polyfem::solver::CompositeParametrization::eval(), para_out_dof(), parametrization_, and x.
|
private |
Definition at line 59 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), inverse_eval(), para_out_dof(), PressureBoundaryVariableToSimulation(), and update().
|
private |
Definition at line 60 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), inverse_eval(), para_out_dof(), PressureBoundaryVariableToSimulation(), and update().
|
private |
Definition at line 56 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), and PressureBoundaryVariableToSimulation().
|
private |
Definition at line 52 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), inverse_eval(), para_out_dof(), PressureBoundaryVariableToSimulation(), and update().
|
private |
Definition at line 57 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), inverse_dof(), inverse_eval(), update(), and update_state_variables().
|
private |
Definition at line 55 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by affect_state(), compute_adjoint_term(), inverse_eval(), PressureBoundaryVariableToSimulation(), and update().
|
private |
Definition at line 53 of file PressureBoundaryVariableToSimulation.hpp.
Referenced by compute_adjoint_term(), inverse_eval(), and PressureBoundaryVariableToSimulation().