DOLFIN
DOLFIN C++ interface
MixedLinearVariationalProblem.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 Cecile Daversin-Catty, 2017.
19 //
20 // First added: 2017-07-21
21 // Last changed: 2017-07-21
22 
23 #ifndef __MIXED_LINEAR_VARIATIONAL_PROBLEM_H
24 #define __MIXED_LINEAR_VARIATIONAL_PROBLEM_H
25 
26 #include <memory>
27 #include <vector>
28 #include <dolfin/common/Hierarchical.h>
29 
30 namespace dolfin
31 {
32 
33  // Forward declarations
34  class DirichletBC;
35  class Form;
36  class Function;
37  class FunctionSpace;
38 
46 
47  class MixedLinearVariationalProblem : public Hierarchical<MixedLinearVariationalProblem>
48  {
49  public:
52  typedef std::vector<std::vector<std::shared_ptr<const Form>>> form_list_type;
55  std::vector<std::shared_ptr<Function>> u,
56  std::vector<std::shared_ptr<const DirichletBC>> bcs);
57 
60  std::shared_ptr<const Form> bilinear_form(int i, int j=0) const;
61 
64  std::shared_ptr<const Form> linear_form(int i, int j=0) const;
65 
67  std::vector<std::shared_ptr<Function>> solution();
68  std::shared_ptr<Function> solution(int i);
69 
71  std::vector<std::vector<std::shared_ptr<const DirichletBC>>> bcs() const;
72  std::vector<std::shared_ptr<const DirichletBC>> bcs(int i) const;
73 
75  std::vector<std::shared_ptr<const FunctionSpace>> trial_space() const;
76  std::shared_ptr<const FunctionSpace> trial_space(int i) const;
77 
79  std::vector<std::shared_ptr<const FunctionSpace>> test_space() const;
80  std::shared_ptr<const FunctionSpace> test_space(int i) const;
81 
82  private:
83 
84  // Check forms
85  void check_forms() const;
86 
87  // Build the necessary mappings between submeshes
88  void build_mappings();
89 
90  // The bilinear forms
91  form_list_type _a;
92 
93  // The linear forms
94  form_list_type _l;
95 
96  // The solution
97  std::vector<std::shared_ptr<Function>> _u;
98 
99  // The Dirichlet boundary conditions
100  std::vector<std::vector<std::shared_ptr<const DirichletBC>>> _bcs;
101 
102  };
103 
104 }
105 
106 #endif
dolfin::MixedLinearVariationalProblem::bilinear_form
form_list_type bilinear_form() const
Return bilinear form.
Definition: MixedLinearVariationalProblem.cpp:68
dolfin::MixedLinearVariationalProblem::linear_form
form_list_type linear_form() const
Return linear form.
Definition: MixedLinearVariationalProblem.cpp:80
dolfin::MixedLinearVariationalProblem::form_list_type
std::vector< std::vector< std::shared_ptr< const Form > > > form_list_type
Definition: MixedLinearVariationalProblem.h:52
dolfin::Hierarchical
Definition: Hierarchical.h:43
dolfin::MixedLinearVariationalProblem
Definition: MixedLinearVariationalProblem.h:47
dolfin::MixedLinearVariationalProblem::bcs
std::vector< std::vector< std::shared_ptr< const DirichletBC > > > bcs() const
Return boundary conditions.
Definition: MixedLinearVariationalProblem.cpp:104
dolfin::MixedLinearVariationalProblem::test_space
std::vector< std::shared_ptr< const FunctionSpace > > test_space() const
Return test space.
Definition: MixedLinearVariationalProblem.cpp:128
dolfin::MixedLinearVariationalProblem::solution
std::vector< std::shared_ptr< Function > > solution()
Return solution variable.
Definition: MixedLinearVariationalProblem.cpp:92
dolfin::MixedLinearVariationalProblem::trial_space
std::vector< std::shared_ptr< const FunctionSpace > > trial_space() const
Return trial space.
Definition: MixedLinearVariationalProblem.cpp:116
dolfin
Definition: adapt.h:29