PolyFEM
Loading...
Searching...
No Matches
FullNLProblem.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <polysolve/nonlinear/Problem.hpp>
5
6#include <memory>
7#include <vector>
8
9namespace polyfem::solver
10{
11 class FullNLProblem : public polysolve::nonlinear::Problem
12 {
13 public:
14 FullNLProblem(const std::vector<std::shared_ptr<Form>> &forms);
15 virtual ~FullNLProblem() = default;
16 virtual void init(const TVector &x0) override;
17
18 virtual double value(const TVector &x) override;
19 virtual void gradient(const TVector &x, TVector &gradv) override;
20 virtual void hessian(const TVector &x, THessian &hessian) override;
21
22 virtual bool is_step_valid(const TVector &x0, const TVector &x1) override;
23 virtual bool is_step_collision_free(const TVector &x0, const TVector &x1);
24 virtual double max_step_size(const TVector &x0, const TVector &x1) override;
25
26 virtual void line_search_begin(const TVector &x0, const TVector &x1) override;
27 virtual void line_search_end() override;
28 virtual void post_step(const polysolve::nonlinear::PostStepData &data) override;
29
30 virtual void set_project_to_psd(bool val) override;
31
32 virtual void solution_changed(const TVector &new_x) override;
33
34 virtual void init_lagging(const TVector &x);
35 virtual void update_lagging(const TVector &x, const int iter_num);
36 int max_lagging_iterations() const;
37 bool uses_lagging() const;
38
39 std::vector<std::shared_ptr<Form>> &forms() { return forms_; }
40
41 virtual bool stop(const TVector &x) override { return false; }
42
43 void finish()
44 {
45 for (auto &form : forms_)
46 form->finish();
47 }
48
49 protected:
50 std::vector<std::shared_ptr<Form>> forms_;
51 };
52} // namespace polyfem::solver
double val
Definition Assembler.cpp:86
int x
virtual double max_step_size(const TVector &x0, const TVector &x1) override
virtual void init_lagging(const TVector &x)
virtual void set_project_to_psd(bool val) override
virtual void hessian(const TVector &x, THessian &hessian) override
virtual bool stop(const TVector &x) override
virtual bool is_step_collision_free(const TVector &x0, const TVector &x1)
std::vector< std::shared_ptr< Form > > forms_
virtual void post_step(const polysolve::nonlinear::PostStepData &data) override
virtual void update_lagging(const TVector &x, const int iter_num)
std::vector< std::shared_ptr< Form > > & forms()
virtual bool is_step_valid(const TVector &x0, const TVector &x1) override
virtual void line_search_end() override
virtual double value(const TVector &x) override
virtual void init(const TVector &x0) override
virtual void solution_changed(const TVector &new_x) override
virtual void gradient(const TVector &x, TVector &gradv) override
virtual ~FullNLProblem()=default
virtual void line_search_begin(const TVector &x0, const TVector &x1) override