PolyFEM
|
#include <AdjointNLProblem.hpp>
Public Member Functions | |
AdjointNLProblem (std::shared_ptr< AdjointForm > form, const VariableToSimulationGroup &variables_to_simulation, const std::vector< std::shared_ptr< State > > &all_states, const json &args) | |
AdjointNLProblem (std::shared_ptr< AdjointForm > form, const std::vector< std::shared_ptr< AdjointForm > > &stopping_conditions, const VariableToSimulationGroup &variables_to_simulation, const std::vector< std::shared_ptr< State > > &all_states, const json &args) | |
virtual | ~AdjointNLProblem ()=default |
double | value (const Eigen::VectorXd &x) override |
void | gradient (const Eigen::VectorXd &x, Eigen::VectorXd &gradv) override |
void | hessian (const Eigen::VectorXd &x, StiffnessMatrix &hessian) override |
void | save_to_file (const int iter_num, const Eigen::VectorXd &x0) |
bool | is_step_valid (const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) override |
bool | is_step_collision_free (const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) override |
double | max_step_size (const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) override |
void | line_search_begin (const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) override |
void | line_search_end () override |
void | post_step (const polysolve::nonlinear::PostStepData &data) override |
bool | stop (const TVector &x) override |
void | solution_changed (const Eigen::VectorXd &new_x) override |
bool | after_line_search_custom_operation (const Eigen::VectorXd &x0, const Eigen::VectorXd &x1) override |
void | solve_pde () |
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 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) |
virtual double | max_step_size (const TVector &x0, const TVector &x1) override |
virtual void | line_search_begin (const TVector &x0, const TVector &x1) override |
virtual void | set_project_to_psd (bool val) override |
virtual void | solution_changed (const TVector &new_x) override |
virtual void | init_lagging (const TVector &x) |
virtual void | update_lagging (const TVector &x, const int iter_num) |
int | max_lagging_iterations () const |
bool | uses_lagging () const |
std::vector< std::shared_ptr< Form > > & | forms () |
Private Attributes | |
std::shared_ptr< AdjointForm > | form_ |
const VariableToSimulationGroup | variables_to_simulation_ |
std::vector< std::shared_ptr< State > > | all_states_ |
std::vector< bool > | active_state_mask |
Eigen::VectorXd | cur_grad |
Eigen::VectorXd | curr_x |
const int | save_freq |
std::ofstream | solution_ostream |
const bool | enable_slim |
const bool | smooth_line_search |
const bool | solve_in_parallel |
std::vector< int > | solve_in_order |
int | save_iter = 0 |
std::vector< std::shared_ptr< AdjointForm > > | stopping_conditions_ |
Additional Inherited Members | |
Protected Attributes inherited from polyfem::solver::FullNLProblem | |
std::vector< std::shared_ptr< Form > > | forms_ |
Definition at line 18 of file AdjointNLProblem.hpp.
polyfem::solver::AdjointNLProblem::AdjointNLProblem | ( | std::shared_ptr< AdjointForm > | form, |
const VariableToSimulationGroup & | variables_to_simulation, | ||
const std::vector< std::shared_ptr< State > > & | all_states, | ||
const json & | args | ||
) |
Definition at line 119 of file AdjointNLProblem.cpp.
polyfem::solver::AdjointNLProblem::AdjointNLProblem | ( | std::shared_ptr< AdjointForm > | form, |
const std::vector< std::shared_ptr< AdjointForm > > & | stopping_conditions, | ||
const VariableToSimulationGroup & | variables_to_simulation, | ||
const std::vector< std::shared_ptr< State > > & | all_states, | ||
const json & | args | ||
) |
Definition at line 174 of file AdjointNLProblem.cpp.
References stopping_conditions_.
|
virtualdefault |
|
override |
Definition at line 379 of file AdjointNLProblem.cpp.
References polyfem::adjoint_logger(), all_states_, polyfem::mesh::apply_slim(), enable_slim, polyfem::F, polyfem::log_and_throw_adjoint_error(), V, and variables_to_simulation_.
|
override |
Definition at line 189 of file AdjointNLProblem.cpp.
References polyfem::adjoint_logger(), all_states_, cur_grad, form_, POLYFEM_SCOPED_TIMER, and x.
|
override |
Definition at line 179 of file AdjointNLProblem.cpp.
References polyfem::log_and_throw_adjoint_error().
|
override |
Definition at line 265 of file AdjointNLProblem.cpp.
References form_.
|
override |
Definition at line 217 of file AdjointNLProblem.cpp.
References polyfem::adjoint_logger(), all_states_, polyfem::mesh::apply_slim(), polyfem::F, form_, polyfem::solver::AdjointTools::is_flipped(), polyfem::solver::PeriodicShape, polyfem::solver::Shape, smooth_line_search, polyfem::utils::unflatten(), polyfem::mesh::V0, polyfem::mesh::V1, and variables_to_simulation_.
|
override |
Definition at line 275 of file AdjointNLProblem.cpp.
References form_.
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 280 of file AdjointNLProblem.cpp.
References form_.
|
override |
Definition at line 270 of file AdjointNLProblem.cpp.
References form_.
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 285 of file AdjointNLProblem.cpp.
References form_, save_iter, and save_to_file().
void polyfem::solver::AdjointNLProblem::save_to_file | ( | const int | iter_num, |
const Eigen::VectorXd & | x0 | ||
) |
Definition at line 292 of file AdjointNLProblem.cpp.
References polyfem::adjoint_logger(), all_states_, polyfem::F, save_freq, solution_ostream, V, polyfem::io::OBJWriter::write(), and polyfem::io::MshWriter::write().
Referenced by post_step().
|
override |
Definition at line 353 of file AdjointNLProblem.cpp.
References all_states_, curr_x, form_, polyfem::solver::PeriodicShape, polyfem::solver::Shape, solve_pde(), and variables_to_simulation_.
void polyfem::solver::AdjointNLProblem::solve_pde | ( | ) |
Definition at line 420 of file AdjointNLProblem.cpp.
References polyfem::adjoint_logger(), all_states_, polyfem::utils::maybe_parallel_for(), and solve_in_parallel.
Referenced by solution_changed().
|
overridevirtual |
Reimplemented from polyfem::solver::FullNLProblem.
Definition at line 461 of file AdjointNLProblem.cpp.
References stopping_conditions_, and x.
|
override |
Definition at line 184 of file AdjointNLProblem.cpp.
|
private |
Definition at line 47 of file AdjointNLProblem.hpp.
|
private |
Definition at line 46 of file AdjointNLProblem.hpp.
Referenced by after_line_search_custom_operation(), gradient(), is_step_valid(), save_to_file(), solution_changed(), and solve_pde().
|
private |
Definition at line 48 of file AdjointNLProblem.hpp.
Referenced by gradient().
|
private |
Definition at line 49 of file AdjointNLProblem.hpp.
Referenced by solution_changed().
|
private |
Definition at line 54 of file AdjointNLProblem.hpp.
Referenced by after_line_search_custom_operation().
|
private |
Definition at line 44 of file AdjointNLProblem.hpp.
Referenced by gradient(), is_step_collision_free(), is_step_valid(), line_search_begin(), line_search_end(), max_step_size(), post_step(), solution_changed(), and value().
|
private |
Definition at line 51 of file AdjointNLProblem.hpp.
Referenced by save_to_file().
|
private |
Definition at line 60 of file AdjointNLProblem.hpp.
Referenced by post_step().
|
private |
Definition at line 55 of file AdjointNLProblem.hpp.
Referenced by is_step_valid().
|
private |
Definition at line 52 of file AdjointNLProblem.hpp.
Referenced by save_to_file().
|
private |
Definition at line 58 of file AdjointNLProblem.hpp.
|
private |
Definition at line 57 of file AdjointNLProblem.hpp.
Referenced by solve_pde().
|
private |
Definition at line 62 of file AdjointNLProblem.hpp.
Referenced by AdjointNLProblem(), and stop().
|
private |
Definition at line 45 of file AdjointNLProblem.hpp.
Referenced by after_line_search_custom_operation(), is_step_valid(), and solution_changed().