DOLFIN
DOLFIN C++ interface
LinearVariationalProblem.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#ifndef __LINEAR_VARIATIONAL_PROBLEM_H
19#define __LINEAR_VARIATIONAL_PROBLEM_H
20
21#include <memory>
22#include <vector>
23#include <dolfin/common/Hierarchical.h>
24
25namespace dolfin
26{
27
28 // Forward declarations
29 class DirichletBC;
30 class Form;
31 class Function;
32 class FunctionSpace;
33
41
42 class LinearVariationalProblem : public Hierarchical<LinearVariationalProblem>
43 {
44 public:
45
48 LinearVariationalProblem(std::shared_ptr<const Form> a,
49 std::shared_ptr<const Form> L,
50 std::shared_ptr<Function> u,
51 std::vector<std::shared_ptr<const DirichletBC>> bcs);
52
54 std::shared_ptr<const Form> bilinear_form() const;
55
57 std::shared_ptr<const Form> linear_form() const;
58
60 std::shared_ptr<Function> solution();
61
63 std::shared_ptr<const Function> solution() const;
64
66 std::vector<std::shared_ptr<const DirichletBC>> bcs() const;
67
69 std::shared_ptr<const FunctionSpace> trial_space() const;
70
72 std::shared_ptr<const FunctionSpace> test_space() const;
73
74 private:
75
76 // Check forms
77 void check_forms() const;
78
79 // The bilinear form
80 std::shared_ptr<const Form> _a;
81
82 // The linear form
83 std::shared_ptr<const Form> _l;
84
85 // The solution
86 std::shared_ptr<Function> _u;
87
88 // The Dirichlet boundary conditions
89 std::vector<std::shared_ptr<const DirichletBC>> _bcs;
90
91 };
92
93}
94
95#endif
Definition: Hierarchical.h:44
Definition: LinearVariationalProblem.h:43
std::shared_ptr< const Form > bilinear_form() const
Return bilinear form.
Definition: LinearVariationalProblem.cpp:39
LinearVariationalProblem(std::shared_ptr< const Form > a, std::shared_ptr< const Form > L, std::shared_ptr< Function > u, std::vector< std::shared_ptr< const DirichletBC > > bcs)
Definition: LinearVariationalProblem.cpp:27
std::vector< std::shared_ptr< const DirichletBC > > bcs() const
Return boundary conditions.
Definition: LinearVariationalProblem.cpp:60
std::shared_ptr< const FunctionSpace > test_space() const
Return test space.
Definition: LinearVariationalProblem.cpp:73
std::shared_ptr< Function > solution()
Return solution variable.
Definition: LinearVariationalProblem.cpp:49
std::shared_ptr< const Form > linear_form() const
Return linear form.
Definition: LinearVariationalProblem.cpp:44
std::shared_ptr< const FunctionSpace > trial_space() const
Return trial space.
Definition: LinearVariationalProblem.cpp:66
Definition: adapt.h:30