|
PolyFEM
|
Map per body to per FE node in node major layout (x1 y1 z1 x2 y2 z2...) More...
#include <Parametrizations.hpp>
Public Member Functions | |
| PerBody2PerNode (const mesh::Mesh &mesh, const std::vector< basis::ElementBases > &bases, const int n_bases) | |
| int | size (const int x_size) const override |
| Compute DOF of y given DOF of x. | |
| int | inverse_size (int y_size) const override |
| Compute DOF of x given DOF of y. | |
| Eigen::VectorXd | inverse_eval (const Eigen::VectorXd &y) const override |
| Eval x = f^-1 (y). | |
| Eigen::VectorXd | eval (const Eigen::VectorXd &x) const override |
| Eval y = f(x). | |
| Eigen::VectorXd | apply_jacobian (const Eigen::VectorXd &grad, const Eigen::VectorXd &x) const override |
| Apply jacobian for chain rule. | |
Public Member Functions inherited from polyfem::solver::Parametrization | |
| virtual | ~Parametrization ()=default |
Private Attributes | |
| const mesh::Mesh & | mesh_ |
| const std::vector< basis::ElementBases > & | bases_ |
| int | full_size_ |
| int | reduced_size_ |
| FE node num. | |
| Eigen::VectorXi | compacted_body_node_num_ |
| Body num. | |
| Eigen::VectorXi | node_id_to_compacted_body_ |
| Number of nodes of a body. | |
Map per body to per FE node in node major layout (x1 y1 z1 x2 y2 z2...)
The order of the input body is pseudo randomly determined by the element order of input mesh, Which is different from body id.
Definition at line 84 of file Parametrizations.hpp.
| polyfem::solver::PerBody2PerNode::PerBody2PerNode | ( | const mesh::Mesh & | mesh, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const int | n_bases | ||
| ) |
Definition at line 266 of file Parametrizations.cpp.
References compacted_body_node_num_, full_size_, polyfem::mesh::Mesh::get_body_id(), polyfem::log_and_throw_adjoint_error(), polyfem::logger(), mesh_, polyfem::mesh::Mesh::n_elements(), node_id_to_compacted_body_, and reduced_size_.
|
overridevirtual |
Apply jacobian for chain rule.
Let g(y) = g(f(x)). Given ∂g/∂y, compute ∂g/∂x = ∂g/∂y * ∂y/∂x.
| [in] | grad_full | ∂g/∂y. |
| [in] | x | Where ∂g/∂x is evaluated. |
Implements polyfem::solver::Parametrization.
Definition at line 365 of file Parametrizations.cpp.
References full_size_, node_id_to_compacted_body_, reduced_size_, size(), and x.
|
overridevirtual |
Eval y = f(x).
| [in] | x | x. |
Implements polyfem::solver::Parametrization.
Definition at line 342 of file Parametrizations.cpp.
References full_size_, node_id_to_compacted_body_, reduced_size_, size(), x, and y.
|
overridevirtual |
Eval x = f^-1 (y).
This is not a strict inverse in mathematical sense, one may choose "reasonable" x even if f is not one-to-one.
| [in] | y | y. |
| std::runtime_error | Throw if inverse not implemented or is impossible. |
Implements polyfem::solver::Parametrization.
Definition at line 316 of file Parametrizations.cpp.
References compacted_body_node_num_, full_size_, inverse_size(), node_id_to_compacted_body_, reduced_size_, x, and y.
|
overridevirtual |
Compute DOF of x given DOF of y.
| [in] | y_size | DOF of y. |
| std::runtime_error | Throw if inverse not impossible or y_size is invalid. |
Implements polyfem::solver::Parametrization.
Definition at line 305 of file Parametrizations.cpp.
References full_size_, polyfem::log_and_throw_adjoint_error(), and reduced_size_.
Referenced by inverse_eval().
|
overridevirtual |
Compute DOF of y given DOF of x.
| [in] | x_size | The DOF of x. |
Implements polyfem::solver::Parametrization.
Definition at line 359 of file Parametrizations.cpp.
References full_size_, and reduced_size_.
Referenced by apply_jacobian(), and eval().
|
private |
Definition at line 97 of file Parametrizations.hpp.
|
private |
Body num.
Definition at line 100 of file Parametrizations.hpp.
Referenced by inverse_eval(), and PerBody2PerNode().
|
private |
Definition at line 98 of file Parametrizations.hpp.
Referenced by apply_jacobian(), eval(), inverse_eval(), inverse_size(), PerBody2PerNode(), and size().
|
private |
Definition at line 96 of file Parametrizations.hpp.
Referenced by PerBody2PerNode().
|
private |
Number of nodes of a body.
Definition at line 101 of file Parametrizations.hpp.
Referenced by apply_jacobian(), eval(), inverse_eval(), and PerBody2PerNode().
|
private |
FE node num.
Definition at line 99 of file Parametrizations.hpp.
Referenced by apply_jacobian(), eval(), inverse_eval(), inverse_size(), PerBody2PerNode(), and size().