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

Map per body to per FE node in node major layout (x1 y1 z1 x2 y2 z2...) More...

#include <Parametrizations.hpp>

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

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::Meshmesh_
 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PerBody2PerNode()

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_.

Here is the call graph for this function:

Member Function Documentation

◆ apply_jacobian()

Eigen::VectorXd polyfem::solver::PerBody2PerNode::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 365 of file Parametrizations.cpp.

References full_size_, node_id_to_compacted_body_, reduced_size_, size(), and x.

Here is the call graph for this function:

◆ eval()

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

Eval y = f(x).

Parameters
[in]xx.
Returns
y.

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.

Here is the call graph for this function:

◆ inverse_eval()

Eigen::VectorXd polyfem::solver::PerBody2PerNode::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 316 of file Parametrizations.cpp.

References compacted_body_node_num_, full_size_, inverse_size(), node_id_to_compacted_body_, reduced_size_, x, and y.

Here is the call graph for this function:

◆ inverse_size()

int polyfem::solver::PerBody2PerNode::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 305 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::PerBody2PerNode::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 359 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

◆ bases_

const std::vector<basis::ElementBases>& polyfem::solver::PerBody2PerNode::bases_
private

Definition at line 97 of file Parametrizations.hpp.

◆ compacted_body_node_num_

Eigen::VectorXi polyfem::solver::PerBody2PerNode::compacted_body_node_num_
private

Body num.

Definition at line 100 of file Parametrizations.hpp.

Referenced by inverse_eval(), and PerBody2PerNode().

◆ full_size_

int polyfem::solver::PerBody2PerNode::full_size_
private

◆ mesh_

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

Definition at line 96 of file Parametrizations.hpp.

Referenced by PerBody2PerNode().

◆ node_id_to_compacted_body_

Eigen::VectorXi polyfem::solver::PerBody2PerNode::node_id_to_compacted_body_
private

Number of nodes of a body.

Definition at line 101 of file Parametrizations.hpp.

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

◆ reduced_size_

int polyfem::solver::PerBody2PerNode::reduced_size_
private

FE node num.

Definition at line 99 of file Parametrizations.hpp.

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


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