DOLFIN
DOLFIN C++ interface
MultiMeshForm.h
1 // Copyright (C) 2013-2016 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 // First added: 2013-09-12
19 // Last changed: 2016-03-02
20 
21 #ifndef __MULTI_MESH_FORM_H
22 #define __MULTI_MESH_FORM_H
23 
24 #include <vector>
25 #include <memory>
26 
27 namespace dolfin
28 {
29 
30  // Forward declarations
31  class MultiMeshFunctionSpace;
32  class MultiMeshFunction;
33  class MultiMesh;
34  class Form;
35 
39 
41  {
42  public:
43 
44  // FIXME: Test multimesh functionals. Should likely require a multimesh
45  // when instaniated and this constructor should then be removed.
46  MultiMeshForm() {}
47 
49  MultiMeshForm(std::shared_ptr<const MultiMesh> multimesh);
50 
52  MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space);
53 
55  MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space_0,
56  std::shared_ptr<const MultiMeshFunctionSpace> function_space_1);
57 
60 
66  std::size_t rank() const;
67 
72  std::size_t num_parts() const;
73 
78  std::shared_ptr<const MultiMesh> multimesh() const;
79 
84  std::shared_ptr<const Form> part(std::size_t i) const;
85 
93  std::shared_ptr<const MultiMeshFunctionSpace> function_space(std::size_t i) const;
94 
99  void add(std::shared_ptr<const Form> form);
100 
102  void build();
103 
105  void clear();
106 
108  void set_multimesh_coefficient(std::size_t i,
109  std::shared_ptr<const MultiMeshFunction> coefficient);
110 
112  std::map<std::size_t, std::shared_ptr<const MultiMeshFunction>> multimesh_coefficients() const;
113 
115  std::shared_ptr<const MultiMeshFunction> multimesh_coefficient(std::size_t i) const;
116 
118  std::vector<std::size_t> multimesh_coefficient_keys() const;
119 
120  private:
121 
122  // The rank of the form
123  std::size_t _rank;
124 
125  // Multimesh
126  std::shared_ptr<const MultiMesh> _multimesh;
127 
128  // Function spaces (one for each argument)
129  std::vector<std::shared_ptr<const MultiMeshFunctionSpace>> _function_spaces;
130 
131  // List of forms (one for each part)
132  std::vector<std::shared_ptr<const Form>> _forms;
133 
134  // Map of MultiMesh coefficents
135  std::map<std::size_t, std::shared_ptr<const MultiMeshFunction>> _multimesh_coefficients;
136 
137 
138  };
139 
140 }
141 
142 #endif
void set_multimesh_coefficient(std::size_t i, std::shared_ptr< const MultiMeshFunction > coefficient)
Set MultiMeshCoeeficient.
Definition: MultiMeshForm.cpp:152
std::size_t num_parts() const
Definition: MultiMeshForm.cpp:60
void build()
Build MultiMesh form.
Definition: MultiMeshForm.cpp:123
std::vector< std::size_t > multimesh_coefficient_keys() const
Get multimesh coefficient keys.
Definition: MultiMeshForm.cpp:172
Definition: adapt.h:29
std::shared_ptr< const Form > part(std::size_t i) const
Definition: MultiMeshForm.cpp:103
std::size_t rank() const
Definition: MultiMeshForm.cpp:55
std::map< std::size_t, std::shared_ptr< const MultiMeshFunction > > multimesh_coefficients() const
Get all MultiMesh Coefficients.
Definition: MultiMeshForm.cpp:160
void add(std::shared_ptr< const Form > form)
Definition: MultiMeshForm.cpp:116
std::shared_ptr< const MultiMesh > multimesh() const
Definition: MultiMeshForm.cpp:65
std::shared_ptr< const MultiMeshFunction > multimesh_coefficient(std::size_t i) const
Get one multimesh coefficient.
Definition: MultiMeshForm.cpp:166
std::shared_ptr< const MultiMeshFunctionSpace > function_space(std::size_t i) const
Definition: MultiMeshForm.cpp:110
void clear()
Clear MultiMesh form.
Definition: MultiMeshForm.cpp:144
~MultiMeshForm()
Destructor.
Definition: MultiMeshForm.cpp:50
Definition: MultiMeshForm.h:40