PolyFEM
Loading...
Searching...
No Matches
polyfem::solver::PerBody2PerElem Class Reference

Map per body to per element in dim major layout (x1 x2 ... y1 y1 ... z1 z2 ...) More...

#include <Parametrizations.hpp>

Inheritance diagram for polyfem::solver::PerBody2PerElem:
[legend]
Collaboration diagram for polyfem::solver::PerBody2PerElem:
[legend]

Public Member Functions

 PerBody2PerElem (const mesh::Mesh &mesh)
 
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::Meshmesh_
 
int full_size_
 
int reduced_size_
 Element num.
 
Eigen::VectorXi compacted_body_elem_num_
 Body num.
 
Eigen::VectorXi elem_id_to_compacted_body_id_
 Number if elements of a body.
 

Detailed Description

Map per body to per element in dim major layout (x1 x2 ... y1 y1 ... z1 z2 ...)

Definition at line 105 of file Parametrizations.hpp.

Constructor & Destructor Documentation

◆ PerBody2PerElem()

polyfem::solver::PerBody2PerElem::PerBody2PerElem ( const mesh::Mesh mesh)

Definition at line 383 of file Parametrizations.cpp.

References compacted_body_elem_num_, elem_id_to_compacted_body_id_, full_size_, polyfem::mesh::Mesh::get_body_id(), polyfem::logger(), mesh_, polyfem::mesh::Mesh::n_elements(), and reduced_size_.

Here is the call graph for this function:

Member Function Documentation

◆ apply_jacobian()

Eigen::VectorXd polyfem::solver::PerBody2PerElem::apply_jacobian ( const Eigen::VectorXd &  grad_full,
const Eigen::VectorXd &  x 
) const
overridevirtual

Apply jacobian for chain rule.

Let g(y) = g(f(x)). Given ∂g/∂y, compute ∂g/∂x = ∂g/∂y * ∂y/∂x.

Parameters
[in]grad_full∂g/∂y.
[in]xWhere ∂g/∂x is evaluated.
Returns
∂g/∂x.

Implements polyfem::solver::Parametrization.

Definition at line 461 of file Parametrizations.cpp.

References elem_id_to_compacted_body_id_, full_size_, mesh_, polyfem::mesh::Mesh::n_elements(), reduced_size_, size(), and x.

Here is the call graph for this function:

◆ eval()

Eigen::VectorXd polyfem::solver::PerBody2PerElem::eval ( const Eigen::VectorXd &  x) const
overridevirtual

Eval y = f(x).

Parameters
[in]xx.
Returns
y.

Implements polyfem::solver::Parametrization.

Definition at line 441 of file Parametrizations.cpp.

References elem_id_to_compacted_body_id_, full_size_, mesh_, polyfem::mesh::Mesh::n_elements(), reduced_size_, size(), x, and y.

Here is the call graph for this function:

◆ inverse_eval()

Eigen::VectorXd polyfem::solver::PerBody2PerElem::inverse_eval ( const Eigen::VectorXd &  y) const
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.

Parameters
[in]yy.
Returns
x.
Exceptions
std::runtime_errorThrow if inverse not implemented or is impossible.

Implements polyfem::solver::Parametrization.

Definition at line 420 of file Parametrizations.cpp.

References compacted_body_elem_num_, elem_id_to_compacted_body_id_, full_size_, inverse_size(), mesh_, polyfem::mesh::Mesh::n_elements(), reduced_size_, x, and y.

Here is the call graph for this function:

◆ inverse_size()

int polyfem::solver::PerBody2PerElem::inverse_size ( int  y_size) const
overridevirtual

Compute DOF of x given DOF of y.

Parameters
[in]y_sizeDOF of y.
Returns
DOF of x.
Exceptions
std::runtime_errorThrow if inverse not impossible or y_size is invalid.

Implements polyfem::solver::Parametrization.

Definition at line 409 of file Parametrizations.cpp.

References full_size_, polyfem::log_and_throw_adjoint_error(), and reduced_size_.

Referenced by inverse_eval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

int polyfem::solver::PerBody2PerElem::size ( const int  x_size) const
overridevirtual

Compute DOF of y given DOF of x.

Parameters
[in]x_sizeThe DOF of x.
Returns
DOF of y.

Implements polyfem::solver::Parametrization.

Definition at line 455 of file Parametrizations.cpp.

References full_size_, and reduced_size_.

Referenced by apply_jacobian(), and eval().

Here is the caller graph for this function:

Member Data Documentation

◆ compacted_body_elem_num_

Eigen::VectorXi polyfem::solver::PerBody2PerElem::compacted_body_elem_num_
private

Body num.

Definition at line 120 of file Parametrizations.hpp.

Referenced by inverse_eval(), and PerBody2PerElem().

◆ elem_id_to_compacted_body_id_

Eigen::VectorXi polyfem::solver::PerBody2PerElem::elem_id_to_compacted_body_id_
private

Number if elements of a body.

Definition at line 121 of file Parametrizations.hpp.

Referenced by apply_jacobian(), eval(), inverse_eval(), and PerBody2PerElem().

◆ full_size_

int polyfem::solver::PerBody2PerElem::full_size_
private

◆ mesh_

const mesh::Mesh& polyfem::solver::PerBody2PerElem::mesh_
private

Definition at line 117 of file Parametrizations.hpp.

Referenced by apply_jacobian(), eval(), inverse_eval(), and PerBody2PerElem().

◆ reduced_size_

int polyfem::solver::PerBody2PerElem::reduced_size_
private

Element num.

Definition at line 119 of file Parametrizations.hpp.

Referenced by apply_jacobian(), eval(), inverse_eval(), inverse_size(), PerBody2PerElem(), and size().


The documentation for this class was generated from the following files: