PolyFEM
Loading...
Searching...
No Matches
MiscProblem.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <vector>
6#include <Eigen/Dense>
7
8namespace polyfem
9{
10 namespace problem
11 {
13 {
14 public:
15 LinearProblem(const std::string &name);
16
17 VectorNd eval_fun(const VectorNd &pt, const double t) const override;
18 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, const double t) const override;
19 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, const double t) const override;
20
21 bool is_scalar() const override { return true; }
22 };
23
25 {
26 public:
27 QuadraticProblem(const std::string &name);
28
29 VectorNd eval_fun(const VectorNd &pt, const double t) const override;
30 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, const double t) const override;
31 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, const double t) const override;
32
33 bool is_scalar() const override { return true; }
34 };
35
37 {
38 public:
39 CubicProblem(const std::string &name);
40
41 VectorNd eval_fun(const VectorNd &pt, const double t) const override;
42 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, const double t) const override;
43 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, const double t) const override;
44
45 bool is_scalar() const override { return true; }
46 };
47
49 {
50 public:
51 SineProblem(const std::string &name);
52
53 VectorNd eval_fun(const VectorNd &pt, const double t) const override;
54 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, const double t) const override;
55 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, const double t) const override;
56
57 bool is_scalar() const override { return true; }
58 };
59
61 {
62 public:
63 ZeroBCProblem(const std::string &name);
64
65 VectorNd eval_fun(const VectorNd &pt, const double t) const override;
66 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, const double t) const override;
67 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, const double t) const override;
68
69 bool is_scalar() const override { return true; }
70 };
71
73 {
74 public:
75 MinSurfProblem(const std::string &name);
76
77 void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override;
78 bool is_rhs_zero() const override { return false; }
79
80 void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override;
81
82 bool is_scalar() const override { return true; }
83 bool has_exact_sol() const override { return false; }
84 };
85
87 {
88 public:
89 TimeDependentProblem(const std::string &name);
90
91 void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override;
92 bool is_rhs_zero() const override { return false; }
93
94 void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override;
95 void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override;
96
97 bool has_exact_sol() const override { return false; }
98 bool is_scalar() const override { return true; }
99 bool is_time_dependent() const override { return true; }
100 };
101
103 {
104 public:
105 GenericScalarProblemExact(const std::string &name);
106
107 bool is_scalar() const override { return true; }
108 bool is_time_dependent() const override { return func_ <= 1; }
109 bool is_constant_in_time() const override { return false; }
110
111 void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override;
112
113 void set_parameters(const json &params) override;
114
115 VectorNd eval_fun(const VectorNd &pt, double t) const override;
116 AutodiffGradPt eval_fun(const AutodiffGradPt &pt, double t) const override;
117 AutodiffHessianPt eval_fun(const AutodiffHessianPt &pt, double t) const override;
118
119 void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override;
120
121 private:
122 int func_;
123 };
124 } // namespace problem
125} // namespace polyfem
double val
Definition Assembler.cpp:86
const std::string & name() const
Definition Problem.hpp:23
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:39
bool is_scalar() const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
VectorNd eval_fun(const VectorNd &pt, double t) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
bool is_scalar() const override
bool has_exact_sol() const override
bool is_scalar() const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
bool is_rhs_zero() const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
bool is_scalar() const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
bool is_scalar() const override
bool is_time_dependent() const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
bool is_scalar() const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
Eigen::Matrix< AutodiffScalarHessian, Eigen::Dynamic, 1, 0, 3, 1 > AutodiffHessianPt
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 3, 1 > VectorNd
Definition Types.hpp:11
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< AutodiffScalarGrad, Eigen::Dynamic, 1, 0, 3, 1 > AutodiffGradPt