PolyFEM
|
#include <NLProblem.hpp>
Public Member Functions | |
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 |
virtual double | value (const TVector &x) override |
virtual void | gradient (const TVector &x, TVector &gradv) override |
virtual void | hessian (const TVector &x, THessian &hessian) override |
virtual bool | is_step_valid (const TVector &x0, const TVector &x1) override |
virtual bool | is_step_collision_free (const TVector &x0, const TVector &x1) override |
virtual double | max_step_size (const TVector &x0, const TVector &x1) override |
void | line_search_begin (const TVector &x0, const TVector &x1) override |
virtual 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 |
virtual void | update_quantities (const double t, const TVector &x) |
int | full_size () const |
int | reduced_size () const |
void | use_full_size () |
void | use_reduced_size () |
virtual TVector | full_to_reduced (const TVector &full) const |
virtual TVector | full_to_reduced_grad (const TVector &full) const |
virtual void | full_hessian_to_reduced_hessian (const THessian &full, THessian &reduced) const |
virtual TVector | reduced_to_full (const TVector &reduced) const |
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 | init (const TVector &x0) override |
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 Types | |
enum class | CurrentSize { FULL_SIZE , REDUCED_SIZE } |
Protected Member Functions | |
NLProblem (const int full_size, const std::vector< int > &boundary_nodes, const std::vector< std::shared_ptr< Form > > &forms) | |
virtual Eigen::MatrixXd | boundary_values () const |
int | current_size () const |
Protected Attributes | |
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_ |
Private Member Functions | |
template<class FullMat , class ReducedMat > | |
void | full_to_reduced_aux (const std::vector< int > &boundary_nodes, const int full_size, const int reduced_size, const FullMat &full, ReducedMat &reduced) const |
template<class ReducedMat , class FullMat > | |
void | reduced_to_full_aux (const std::vector< int > &boundary_nodes, const int full_size, const int reduced_size, const ReducedMat &reduced, const Eigen::MatrixXd &rhs, FullMat &full) const |
template<class FullMat , class ReducedMat > | |
void | full_to_reduced_aux_grad (const std::vector< int > &boundary_nodes, const int full_size, const int reduced_size, const FullMat &full, ReducedMat &reduced) const |
Private Attributes | |
const assembler::RhsAssembler * | rhs_assembler_ |
const std::vector< mesh::LocalBoundary > * | local_boundary_ |
const int | n_boundary_samples_ |
Definition at line 10 of file NLProblem.hpp.
|
strongprotected |
Enumerator | |
---|---|
FULL_SIZE | |
REDUCED_SIZE |
Definition at line 78 of file NLProblem.hpp.
|
protected |
Definition at line 21 of file NLProblem.cpp.
References use_reduced_size().
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 | ||
) |
Definition at line 37 of file NLProblem.cpp.
References full_size_, and use_reduced_size().
|
virtualdefault |
|
protectedvirtual |
Reimplemented in polyfem::solver::NLHomoProblem, and polyfem::solver::StaticBoundaryNLProblem.
Definition at line 169 of file NLProblem.cpp.
References full_boundary_nodes_, full_size(), local_boundary_, n_boundary_samples_, rhs_assembler_, polyfem::assembler::RhsAssembler::set_bc(), and t_.
Referenced by reduced_to_full().
|
inlineprotected |
Definition at line 84 of file NLProblem.hpp.
References current_size_, full_size(), FULL_SIZE, and reduced_size().
Referenced by full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_grad(), and reduced_to_full().
|
virtual |
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 288 of file NLProblem.cpp.
References boundary_nodes_, current_size(), full_size(), polyfem::utils::full_to_reduced_matrix(), and periodic_bc_.
Referenced by polyfem::solver::NLHomoProblem::extended_hessian_to_reduced_hessian(), polyfem::solver::NLHomoProblem::full_hessian_to_reduced_hessian(), and hessian().
|
inline |
Definition at line 54 of file NLProblem.hpp.
References full_size_.
Referenced by boundary_values(), polyfem::solver::NLHomoProblem::boundary_values(), current_size(), full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_aux(), full_to_reduced_aux_grad(), full_to_reduced_grad(), reduced_to_full(), reduced_to_full_aux(), polyfem::solver::ALSolver::solve_al(), and polyfem::solver::ALSolver::solve_reduced().
|
virtual |
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 148 of file NLProblem.cpp.
References boundary_nodes_, current_size(), full_size(), and full_to_reduced_aux().
Referenced by polyfem::solver::NLHomoProblem::extended_to_reduced(), polyfem::solver::NLHomoProblem::full_to_reduced(), polyfem::solver::ALSolver::solve_al(), polyfem::solver::ALSolver::solve_reduced(), and polyfem::State::solve_tensor_nonlinear().
|
private |
Definition at line 178 of file NLProblem.cpp.
References full_size(), periodic_bc_, and reduced_size().
Referenced by full_to_reduced().
|
private |
Definition at line 253 of file NLProblem.cpp.
References full_size(), periodic_bc_, and reduced_size().
Referenced by full_to_reduced_grad().
|
virtual |
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 155 of file NLProblem.cpp.
References boundary_nodes_, current_size(), full_size(), and full_to_reduced_aux_grad().
Referenced by polyfem::solver::NLHomoProblem::extended_to_reduced_grad(), polyfem::solver::NLHomoProblem::full_to_reduced_grad(), and gradient().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 106 of file NLProblem.cpp.
References full_to_reduced_grad(), polyfem::solver::FullNLProblem::gradient(), reduced_to_full(), and x.
Referenced by polyfem::solver::NLHomoProblem::gradient(), and polyfem::State::solve_tensor_nonlinear().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 113 of file NLProblem.cpp.
References full_hessian_to_reduced_hessian(), polyfem::solver::FullNLProblem::hessian(), hessian(), reduced_to_full(), and x.
Referenced by polyfem::solver::NLHomoProblem::hessian(), and hessian().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 62 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::init_lagging(), reduced_to_full(), and x.
Referenced by polyfem::solver::NLHomoProblem::init_lagging(), and polyfem::State::solve_tensor_nonlinear().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 95 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::is_step_collision_free(), and reduced_to_full().
Referenced by polyfem::solver::NLHomoProblem::is_step_collision_free(), polyfem::solver::ALSolver::solve_al(), and polyfem::solver::ALSolver::solve_reduced().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 90 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::is_step_valid(), and reduced_to_full().
Referenced by polyfem::solver::NLHomoProblem::is_step_valid(), polyfem::solver::ALSolver::solve_al(), and polyfem::solver::ALSolver::solve_reduced().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 80 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::line_search_begin(), and reduced_to_full().
Referenced by polyfem::solver::NLHomoProblem::line_search_begin(), polyfem::solver::ALSolver::solve_al(), and polyfem::solver::ALSolver::solve_reduced().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 85 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::max_step_size(), and reduced_to_full().
Referenced by polyfem::solver::NLHomoProblem::max_step_size().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 126 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::post_step(), and reduced_to_full().
Referenced by polyfem::solver::NLHomoProblem::post_step().
|
inline |
Definition at line 55 of file NLProblem.hpp.
References reduced_size_.
Referenced by current_size(), polyfem::solver::NLHomoProblem::extended_hessian_to_reduced_hessian(), polyfem::solver::NLHomoProblem::extended_to_reduced(), polyfem::solver::NLHomoProblem::extended_to_reduced_grad(), polyfem::solver::NLHomoProblem::full_hessian_to_reduced_hessian(), polyfem::solver::NLHomoProblem::full_to_reduced(), full_to_reduced_aux(), full_to_reduced_aux_grad(), polyfem::solver::NLHomoProblem::full_to_reduced_grad(), polyfem::solver::NLHomoProblem::reduced_to_disp_grad(), polyfem::solver::NLHomoProblem::reduced_to_extended(), polyfem::solver::NLHomoProblem::reduced_to_full(), reduced_to_full_aux(), and polyfem::solver::ALSolver::solve_al().
|
virtual |
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 162 of file NLProblem.cpp.
References boundary_nodes_, boundary_values(), current_size(), full_size(), and reduced_to_full_aux().
Referenced by gradient(), hessian(), init_lagging(), is_step_collision_free(), is_step_valid(), line_search_begin(), max_step_size(), post_step(), polyfem::solver::NLHomoProblem::reduced_to_extended(), polyfem::solver::NLHomoProblem::reduced_to_full(), set_apply_DBC(), solution_changed(), polyfem::solver::ALSolver::solve_reduced(), polyfem::State::solve_tensor_nonlinear(), update_lagging(), update_quantities(), and value().
|
private |
Definition at line 217 of file NLProblem.cpp.
References full_size(), periodic_bc_, and reduced_size().
Referenced by reduced_to_full().
void polyfem::solver::NLProblem::set_apply_DBC | ( | const TVector & | x, |
const bool | val | ||
) |
Definition at line 141 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::forms_, reduced_to_full(), val, and x.
Referenced by polyfem::solver::ALSolver::set_al_weight().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 121 of file NLProblem.cpp.
References reduced_to_full(), and polyfem::solver::FullNLProblem::solution_changed().
Referenced by polyfem::solver::NLHomoProblem::solution_changed().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 67 of file NLProblem.cpp.
References reduced_to_full(), polyfem::solver::FullNLProblem::update_lagging(), and x.
Referenced by polyfem::State::solve_tensor_nonlinear(), and polyfem::solver::NLHomoProblem::update_lagging().
|
virtual |
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 72 of file NLProblem.cpp.
References polyfem::solver::FullNLProblem::forms_, reduced_to_full(), t_, and x.
Referenced by polyfem::solver::NLHomoProblem::update_quantities().
|
inline |
Definition at line 57 of file NLProblem.hpp.
References current_size_, and FULL_SIZE.
Referenced by polyfem::solver::ALSolver::set_al_weight().
|
inline |
Definition at line 58 of file NLProblem.hpp.
References current_size_, and REDUCED_SIZE.
Referenced by NLProblem(), NLProblem(), and polyfem::solver::ALSolver::set_al_weight().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Reimplemented in polyfem::solver::NLHomoProblem.
Definition at line 100 of file NLProblem.cpp.
References reduced_to_full(), polyfem::solver::FullNLProblem::value(), and x.
Referenced by polyfem::solver::ALSolver::solve_al(), polyfem::solver::ALSolver::solve_reduced(), and polyfem::solver::NLHomoProblem::value().
|
protected |
Definition at line 71 of file NLProblem.hpp.
Referenced by full_hessian_to_reduced_hessian(), full_to_reduced(), full_to_reduced_grad(), and reduced_to_full().
|
protected |
Current size of the problem (either full or reduced size)
Definition at line 83 of file NLProblem.hpp.
Referenced by current_size(), use_full_size(), and use_reduced_size().
|
protected |
Definition at line 70 of file NLProblem.hpp.
Referenced by boundary_values().
|
protected |
Size of the full problem.
Definition at line 73 of file NLProblem.hpp.
Referenced by polyfem::solver::NLHomoProblem::constraint_grad(), polyfem::solver::NLHomoProblem::extended_hessian_to_reduced_hessian(), full_size(), and NLProblem().
|
private |
Definition at line 93 of file NLProblem.hpp.
Referenced by boundary_values().
|
private |
Definition at line 94 of file NLProblem.hpp.
Referenced by boundary_values().
|
protected |
Definition at line 76 of file NLProblem.hpp.
Referenced by full_hessian_to_reduced_hessian(), full_to_reduced_aux(), full_to_reduced_aux_grad(), and reduced_to_full_aux().
|
protected |
Size of the reduced problem.
Definition at line 74 of file NLProblem.hpp.
Referenced by reduced_size().
|
private |
Definition at line 92 of file NLProblem.hpp.
Referenced by boundary_values().
|
protected |
Definition at line 89 of file NLProblem.hpp.
Referenced by boundary_values(), polyfem::solver::NLHomoProblem::macro_reduced_to_full(), and update_quantities().