PolyFEM
|
#include <NLHomoProblem.hpp>
Public Member Functions | |
NLHomoProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< mesh::LocalBoundary > &local_boundary, const int n_boundary_samples, const assembler::RhsAssembler &rhs_assembler, const assembler::MacroStrainValue ¯o_strain_constraint, const State &state, const double t, const std::vector< std::shared_ptr< Form > > &forms, const bool solve_symmetric_macro_strain) | |
virtual | ~NLHomoProblem ()=default |
double | value (const TVector &x) override |
void | gradient (const TVector &x, TVector &gradv) override |
void | hessian (const TVector &x, THessian &hessian) override |
void | full_hessian_to_reduced_hessian (const THessian &full, THessian &reduced) const override |
int | macro_reduced_size () const |
TVector | full_to_reduced (const TVector &full, const Eigen::MatrixXd &disp_grad) const |
TVector | full_to_reduced (const TVector &full) const override |
TVector | full_to_reduced_grad (const TVector &full) const override |
TVector | reduced_to_full (const TVector &reduced) const override |
TVector | reduced_to_full_shape_derivative (const Eigen::MatrixXd &disp_grad, const TVector &adjoint_full) const |
TVector | reduced_to_extended (const TVector &reduced, bool homogeneous=false) const |
TVector | extended_to_reduced (const TVector &extended) const |
TVector | extended_to_reduced_grad (const TVector &extended) const |
void | extended_hessian_to_reduced_hessian (const THessian &extended, THessian &reduced) const |
Eigen::MatrixXd | reduced_to_disp_grad (const TVector &reduced, bool homogeneous=false) const |
void | set_fixed_entry (const Eigen::VectorXi &fixed_entry) |
void | init (const TVector &x0) override |
bool | is_step_valid (const TVector &x0, const TVector &x1) override |
bool | is_step_collision_free (const TVector &x0, const TVector &x1) override |
double | max_step_size (const TVector &x0, const TVector &x1) override |
void | line_search_begin (const TVector &x0, const TVector &x1) override |
void | post_step (const polysolve::nonlinear::PostStepData &data) override |
void | solution_changed (const TVector &new_x) override |
void | init_lagging (const TVector &x) override |
void | update_lagging (const TVector &x, const int iter_num) override |
void | update_quantities (const double t, const TVector &x) override |
void | add_form (const std::shared_ptr< Form > &form) |
bool | has_symmetry_constraint () const |
Public Member Functions inherited from polyfem::solver::NLProblem | |
NLProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< mesh::LocalBoundary > &local_boundary, const int n_boundary_samples, const assembler::RhsAssembler &rhs_assembler, const std::shared_ptr< utils::PeriodicBoundary > &periodic_bc, const double t, const std::vector< std::shared_ptr< Form > > &forms) | |
virtual | ~NLProblem ()=default |
void | line_search_begin (const TVector &x0, const TVector &x1) override |
void | solution_changed (const TVector &new_x) override |
void | init_lagging (const TVector &x) override |
void | update_lagging (const TVector &x, const int iter_num) override |
int | full_size () const |
int | reduced_size () const |
void | use_full_size () |
void | use_reduced_size () |
void | set_apply_DBC (const TVector &x, const bool val) |
Public Member Functions inherited from polyfem::solver::FullNLProblem | |
FullNLProblem (const std::vector< std::shared_ptr< Form > > &forms) | |
virtual | ~FullNLProblem ()=default |
virtual void | line_search_end () override |
virtual void | set_project_to_psd (bool val) override |
int | max_lagging_iterations () const |
bool | uses_lagging () const |
std::vector< std::shared_ptr< Form > > & | forms () |
virtual bool | stop (const TVector &x) override |
Protected Member Functions | |
Eigen::MatrixXd | boundary_values () const override |
Protected Member Functions inherited from polyfem::solver::NLProblem | |
NLProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< std::shared_ptr< Form > > &forms) | |
int | current_size () const |
Private Member Functions | |
void | init_projection () |
Eigen::MatrixXd | constraint_grad () const |
TVector | macro_full_to_reduced (const TVector &full) const |
Eigen::MatrixXd | macro_full_to_reduced_grad (const Eigen::MatrixXd &full) const |
TVector | macro_reduced_to_full (const TVector &reduced, bool homogeneous=false) const |
Private Attributes | |
const State & | state_ |
const bool | only_symmetric |
const assembler::MacroStrainValue & | macro_strain_constraint_ |
Eigen::VectorXi | fixed_mask_ |
Eigen::MatrixXd | macro_mid_to_reduced_ |
Eigen::MatrixXd | macro_full_to_mid_ |
Eigen::MatrixXd | macro_mid_to_full_ |
std::vector< std::shared_ptr< Form > > | homo_forms |
Additional Inherited Members | |
Protected Types inherited from polyfem::solver::NLProblem | |
enum class | CurrentSize { FULL_SIZE , REDUCED_SIZE } |
Protected Attributes inherited from polyfem::solver::NLProblem | |
const std::vector< int > | full_boundary_nodes_ |
const std::vector< int > | boundary_nodes_ |
const int | full_size_ |
Size of the full problem. | |
const int | reduced_size_ |
Size of the reduced problem. | |
std::shared_ptr< utils::PeriodicBoundary > | periodic_bc_ |
CurrentSize | current_size_ |
Current size of the problem (either full or reduced size) | |
double | t_ |
Protected Attributes inherited from polyfem::solver::FullNLProblem | |
std::vector< std::shared_ptr< Form > > | forms_ |
Definition at line 15 of file NLHomoProblem.hpp.
polyfem::solver::NLHomoProblem::NLHomoProblem | ( | const int | full_size, |
const std::vector< int > & | boundary_nodes, | ||
const std::vector< mesh::LocalBoundary > & | local_boundary, | ||
const int | n_boundary_samples, | ||
const assembler::RhsAssembler & | rhs_assembler, | ||
const assembler::MacroStrainValue & | macro_strain_constraint, | ||
const State & | state, | ||
const double | t, | ||
const std::vector< std::shared_ptr< Form > > & | forms, | ||
const bool | solve_symmetric_macro_strain | ||
) |
Definition at line 11 of file NLHomoProblem.cpp.
References init_projection().
|
virtualdefault |
|
inline |
Definition at line 71 of file NLHomoProblem.hpp.
References homo_forms.
|
overrideprotectedvirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 407 of file NLHomoProblem.cpp.
References polyfem::solver::NLProblem::full_size().
|
private |
Definition at line 391 of file NLHomoProblem.cpp.
References polyfem::solver::NLProblem::full_size_, polyfem::io::Evaluator::get_bases_position(), macro_full_to_reduced_grad(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, and state_.
Referenced by full_hessian_to_reduced_hessian(), and full_to_reduced_grad().
void polyfem::solver::NLHomoProblem::extended_hessian_to_reduced_hessian | ( | const THessian & | extended, |
THessian & | reduced | ||
) | const |
Definition at line 127 of file NLHomoProblem.cpp.
References entries, polyfem::solver::NLProblem::full_hessian_to_reduced_hessian(), polyfem::solver::NLProblem::full_size_, macro_full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.
Referenced by hessian().
Eigen::VectorXd polyfem::solver::NLHomoProblem::extended_to_reduced | ( | const TVector & | extended | ) | const |
Definition at line 53 of file NLHomoProblem.cpp.
References polyfem::solver::NLProblem::full_to_reduced(), macro_full_to_reduced(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.
Eigen::VectorXd polyfem::solver::NLHomoProblem::extended_to_reduced_grad | ( | const TVector & | extended | ) | const |
Definition at line 81 of file NLHomoProblem.cpp.
References polyfem::solver::NLProblem::full_to_reduced_grad(), macro_full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.
Referenced by gradient().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 215 of file NLHomoProblem.cpp.
References constraint_grad(), entries, polyfem::solver::NLProblem::full_hessian_to_reduced_hessian(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 249 of file NLHomoProblem.cpp.
References polyfem::log_and_throw_error().
NLHomoProblem::TVector polyfem::solver::NLHomoProblem::full_to_reduced | ( | const TVector & | full, |
const Eigen::MatrixXd & | disp_grad | ||
) | const |
Definition at line 255 of file NLHomoProblem.cpp.
References polyfem::utils::flatten(), polyfem::solver::NLProblem::full_to_reduced(), polyfem::io::Evaluator::generate_linear_field(), macro_full_to_reduced(), macro_reduced_size(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, polyfem::solver::NLProblem::reduced_size(), and state_.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 269 of file NLHomoProblem.cpp.
References constraint_grad(), polyfem::solver::NLProblem::full_to_reduced_grad(), macro_reduced_size(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), and state_.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 115 of file NLHomoProblem.cpp.
References extended_to_reduced_grad(), polyfem::solver::NLProblem::gradient(), homo_forms, reduced_to_extended(), and x.
|
inline |
Definition at line 72 of file NLHomoProblem.hpp.
References only_symmetric.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 178 of file NLHomoProblem.cpp.
References extended_hessian_to_reduced_hessian(), hessian(), polyfem::solver::NLProblem::hessian(), homo_forms, reduced_to_extended(), and x.
Referenced by hessian().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 316 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::FullNLProblem::init(), reduced_to_extended(), and reduced_to_full().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 371 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::init_lagging(), reduced_to_extended(), and x.
|
private |
Definition at line 25 of file NLHomoProblem.cpp.
References macro_full_to_mid_, macro_mid_to_full_, macro_mid_to_reduced_, polyfem::State::mesh, only_symmetric, and state_.
Referenced by NLHomoProblem().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 332 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::is_step_collision_free(), and reduced_to_extended().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 323 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::is_step_valid(), and reduced_to_extended().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 350 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::line_search_begin(), and reduced_to_extended().
|
private |
Definition at line 297 of file NLHomoProblem.cpp.
References macro_full_to_mid_, and macro_mid_to_reduced_.
Referenced by extended_to_reduced(), and full_to_reduced().
|
private |
Definition at line 301 of file NLHomoProblem.cpp.
References macro_mid_to_full_, and macro_mid_to_reduced_.
Referenced by constraint_grad(), extended_hessian_to_reduced_hessian(), and extended_to_reduced_grad().
int polyfem::solver::NLHomoProblem::macro_reduced_size | ( | ) | const |
Definition at line 293 of file NLHomoProblem.cpp.
References macro_mid_to_reduced_.
Referenced by extended_hessian_to_reduced_hessian(), extended_to_reduced(), extended_to_reduced_grad(), full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_grad(), reduced_to_disp_grad(), reduced_to_extended(), and reduced_to_full().
|
private |
Definition at line 305 of file NLHomoProblem.cpp.
References polyfem::assembler::MacroStrainValue::eval(), fixed_mask_, polyfem::utils::flatten(), macro_full_to_mid_, macro_mid_to_full_, macro_mid_to_reduced_, macro_strain_constraint_, and polyfem::solver::NLProblem::t_.
Referenced by reduced_to_disp_grad(), reduced_to_extended(), and reduced_to_full().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 341 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::max_step_size(), and reduced_to_extended().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 356 of file NLHomoProblem.cpp.
References homo_forms, polyfem::solver::NLProblem::post_step(), and reduced_to_extended().
Eigen::MatrixXd polyfem::solver::NLHomoProblem::reduced_to_disp_grad | ( | const TVector & | reduced, |
bool | homogeneous = false |
||
) | const |
Definition at line 170 of file NLHomoProblem.cpp.
References macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), state_, and polyfem::utils::unflatten().
Eigen::VectorXd polyfem::solver::NLHomoProblem::reduced_to_extended | ( | const TVector & | reduced, |
bool | homogeneous = false |
||
) | const |
Definition at line 66 of file NLHomoProblem.cpp.
References macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::solver::NLProblem::reduced_size(), polyfem::solver::NLProblem::reduced_to_full(), and state_.
Referenced by gradient(), hessian(), init(), init_lagging(), is_step_collision_free(), is_step_valid(), line_search_begin(), max_step_size(), post_step(), solution_changed(), update_lagging(), update_quantities(), and value().
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 283 of file NLHomoProblem.cpp.
References polyfem::io::Evaluator::generate_linear_field(), macro_reduced_size(), macro_reduced_to_full(), polyfem::State::mesh, polyfem::State::mesh_nodes, polyfem::State::n_bases, polyfem::solver::NLProblem::reduced_size(), polyfem::solver::NLProblem::reduced_to_full(), state_, and polyfem::utils::unflatten().
Referenced by init().
NLHomoProblem::TVector polyfem::solver::NLHomoProblem::reduced_to_full_shape_derivative | ( | const Eigen::MatrixXd & | disp_grad, |
const TVector & | adjoint_full | ||
) | const |
Definition at line 94 of file NLHomoProblem.cpp.
References polyfem::State::basis_nodes_to_gbasis_nodes, polyfem::State::mesh, polyfem::State::n_bases, and state_.
Referenced by polyfem::solver::SpatialIntegralForm::compute_partial_gradient_step().
void polyfem::solver::NLHomoProblem::set_fixed_entry | ( | const Eigen::VectorXi & | fixed_entry | ) |
Definition at line 194 of file NLHomoProblem.cpp.
References fixed_mask_, macro_full_to_mid_, macro_mid_to_reduced_, polyfem::State::mesh, and state_.
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 364 of file NLHomoProblem.cpp.
References homo_forms, reduced_to_extended(), and polyfem::solver::NLProblem::solution_changed().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 377 of file NLHomoProblem.cpp.
References homo_forms, reduced_to_extended(), polyfem::solver::NLProblem::update_lagging(), and x.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 384 of file NLHomoProblem.cpp.
References homo_forms, reduced_to_extended(), polyfem::solver::NLProblem::update_quantities(), and x.
|
overridevirtual |
Reimplemented from polyfem::solver::NLProblem.
Definition at line 106 of file NLHomoProblem.cpp.
References homo_forms, reduced_to_extended(), val, polyfem::solver::NLProblem::value(), and x.
|
private |
Definition at line 89 of file NLHomoProblem.hpp.
Referenced by macro_reduced_to_full(), and set_fixed_entry().
|
private |
Definition at line 93 of file NLHomoProblem.hpp.
Referenced by add_form(), gradient(), hessian(), init(), init_lagging(), is_step_collision_free(), is_step_valid(), line_search_begin(), max_step_size(), post_step(), solution_changed(), update_lagging(), update_quantities(), and value().
|
private |
Definition at line 91 of file NLHomoProblem.hpp.
Referenced by init_projection(), macro_full_to_reduced(), macro_reduced_to_full(), and set_fixed_entry().
|
private |
Definition at line 91 of file NLHomoProblem.hpp.
Referenced by init_projection(), macro_full_to_reduced_grad(), and macro_reduced_to_full().
|
private |
Definition at line 90 of file NLHomoProblem.hpp.
Referenced by init_projection(), macro_full_to_reduced(), macro_full_to_reduced_grad(), macro_reduced_size(), macro_reduced_to_full(), and set_fixed_entry().
|
private |
Definition at line 87 of file NLHomoProblem.hpp.
Referenced by macro_reduced_to_full().
|
private |
Definition at line 86 of file NLHomoProblem.hpp.
Referenced by has_symmetry_constraint(), and init_projection().
|
private |
Definition at line 85 of file NLHomoProblem.hpp.
Referenced by constraint_grad(), extended_hessian_to_reduced_hessian(), extended_to_reduced(), extended_to_reduced_grad(), full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_grad(), init_projection(), reduced_to_disp_grad(), reduced_to_extended(), reduced_to_full(), reduced_to_full_shape_derivative(), and set_fixed_entry().