DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
NonlinearVariationalProblem.h
1// Copyright (C) 2011 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// Modified by Corrado Maurini, 2013.
19
20#ifndef __NONLINEAR_VARIATIONAL_PROBLEM_H
21#define __NONLINEAR_VARIATIONAL_PROBLEM_H
22
23#include <memory>
24#include <vector>
25#include <dolfin/common/Hierarchical.h>
26
27namespace dolfin
28{
29
30 // Forward declarations
31 class Form;
32 class Function;
33 class FunctionSpace;
34 class DirichletBC;
35 class GenericVector;
36
44
46 : public Hierarchical<NonlinearVariationalProblem>
47 {
48 public:
49
54 NonlinearVariationalProblem(std::shared_ptr<const Form> F,
55 std::shared_ptr<Function> u,
56 std::vector<std::shared_ptr<const DirichletBC>> bcs,
57 std::shared_ptr<const Form> J=nullptr);
58
60 void set_bounds(const Function& lb_func, const Function& ub_func);
61
63 void set_bounds(std::shared_ptr<const GenericVector> lb,
64 std::shared_ptr<const GenericVector> ub);
65
67 std::shared_ptr<const Form> residual_form() const;
68
70 std::shared_ptr<const Form> jacobian_form() const;
71
73 std::shared_ptr<Function> solution();
74
76 std::shared_ptr<const Function> solution() const;
77
79 std::vector<std::shared_ptr<const DirichletBC>> bcs() const;
80
82 std::shared_ptr<const FunctionSpace> trial_space() const;
83
85 std::shared_ptr<const FunctionSpace> test_space() const;
86
88 std::shared_ptr<const GenericVector> lower_bound() const;
89
91 std::shared_ptr<const GenericVector> upper_bound() const;
92
94 bool has_jacobian() const;
95
97 bool has_lower_bound() const;
98
100 bool has_upper_bound() const;
101
102 private:
103
104 // Check forms
105 void check_forms() const;
106
107 // The residual form
108 std::shared_ptr<const Form> _residual;
109
110 // The Jacobian form (pointer may be null if not provided)
111 std::shared_ptr<const Form> _jacobian;
112
113 // The solution
114 std::shared_ptr<Function> _u;
115
116 // The boundary conditions
117 std::vector<std::shared_ptr<const DirichletBC>> _bcs;
118
119 // The lower and upper bounds (pointers may be null if not
120 // provided)
121 std::shared_ptr<const GenericVector> _lb;
122 std::shared_ptr<const GenericVector> _ub;
123 };
124
125}
126
127#endif
Definition Function.h:66
Definition Hierarchical.h:44
Definition NonlinearVariationalProblem.h:47
std::shared_ptr< const FunctionSpace > test_space() const
Return test space.
Definition NonlinearVariationalProblem.cpp:92
std::shared_ptr< const Form > jacobian_form() const
Return Jacobian form.
Definition NonlinearVariationalProblem.cpp:63
bool has_lower_bound() const
Check whether lower bound has been defined.
Definition NonlinearVariationalProblem.cpp:117
std::shared_ptr< const GenericVector > lower_bound() const
Return lower bound.
Definition NonlinearVariationalProblem.cpp:99
std::vector< std::shared_ptr< const DirichletBC > > bcs() const
Return boundary conditions.
Definition NonlinearVariationalProblem.cpp:79
std::shared_ptr< const Form > residual_form() const
Return residual form.
Definition NonlinearVariationalProblem.cpp:58
std::shared_ptr< const GenericVector > upper_bound() const
Return upper bound.
Definition NonlinearVariationalProblem.cpp:106
std::shared_ptr< const FunctionSpace > trial_space() const
Return trial space.
Definition NonlinearVariationalProblem.cpp:85
std::shared_ptr< Function > solution()
Return solution variable.
Definition NonlinearVariationalProblem.cpp:68
bool has_jacobian() const
Check whether Jacobian has been defined.
Definition NonlinearVariationalProblem.cpp:112
NonlinearVariationalProblem(std::shared_ptr< const Form > F, std::shared_ptr< Function > u, std::vector< std::shared_ptr< const DirichletBC > > bcs, std::shared_ptr< const Form > J=nullptr)
Definition NonlinearVariationalProblem.cpp:30
bool has_upper_bound() const
Check whether upper bound have has defined.
Definition NonlinearVariationalProblem.cpp:122
void set_bounds(const Function &lb_func, const Function &ub_func)
Set the bounds for bound constrained solver.
Definition NonlinearVariationalProblem.cpp:42
Definition adapt.h:30