DOLFIN
DOLFIN C++ interface
MultiMeshFunctionSpace.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-08-05
19 // Last changed: 2017-09-22
20 
21 #ifndef __MULTI_MESH_FUNCTION_SPACE_H
22 #define __MULTI_MESH_FUNCTION_SPACE_H
23 
24 #include <vector>
25 #include <map>
26 #include <memory>
27 
28 #include <dolfin/common/types.h>
29 #include <dolfin/common/Variable.h>
30 #include <dolfin/mesh/MultiMesh.h>
31 
32 namespace dolfin
33 {
34 
35  // Forward declarations
36  class GenericMatrix;
37  class GenericVector;
38  class FunctionSpace;
39  class MultiMeshDofMap;
40 
46 
48  {
49  public:
50 
52  MultiMeshFunctionSpace(std::shared_ptr<const MultiMesh> multimesh);
53 
56 
62  std::size_t dim() const;
63 
69  std::shared_ptr<const MultiMesh> multimesh() const;
70 
76  std::shared_ptr<const MultiMeshDofMap> dofmap() const;
77 
83  std::size_t num_parts() const;
84 
94  std::shared_ptr<const FunctionSpace> part(std::size_t i) const;
95 
109  std::shared_ptr<const FunctionSpace> view(std::size_t i) const;
110 
116  void add(std::shared_ptr<const FunctionSpace> function_space);
117 
119  void build();
120 
123  void build(const std::vector<dolfin::la_index>& offsets);
124 
127 
128  private:
129 
130  // Friends
131  friend class MultiMeshSubSpace;
132 
133  // List of function spaces
134  std::vector<std::shared_ptr<const FunctionSpace> > _function_spaces;
135 
136  // List of function space views
137  std::vector<std::shared_ptr<const FunctionSpace> > _function_space_views;
138 
139  // Multimesh
140  std::shared_ptr<const MultiMesh> _multimesh;
141 
142  // Multimesh dofmap
143  std::shared_ptr<MultiMeshDofMap> _dofmap;
144 
145  // Quadrature order
146  std::size_t _quadrature_order;
147 
148  // Build multimesh
149  void _build_multimesh();
150 
151  // Build dofmap
152  void _build_dofmap(const std::vector<dolfin::la_index>& offsets);
153 
154  // Build views
155  void _build_views();
156 
157  };
158 
159 }
160 
161 #endif
std::size_t dim() const
Definition: MultiMeshFunctionSpace.cpp:56
Common base class for DOLFIN variables.
Definition: Variable.h:35
std::shared_ptr< const FunctionSpace > part(std::size_t i) const
Definition: MultiMeshFunctionSpace.cpp:80
std::shared_ptr< const MultiMeshDofMap > dofmap() const
Definition: MultiMeshFunctionSpace.cpp:68
Definition: adapt.h:29
std::shared_ptr< const MultiMesh > multimesh() const
Definition: MultiMeshFunctionSpace.cpp:62
std::shared_ptr< const FunctionSpace > view(std::size_t i) const
Definition: MultiMeshFunctionSpace.cpp:87
void build()
Build multimesh function space.
Definition: MultiMeshFunctionSpace.cpp:101
void add(std::shared_ptr< const FunctionSpace > function_space)
Definition: MultiMeshFunctionSpace.cpp:94
MultiMeshFunctionSpace(std::shared_ptr< const MultiMesh > multimesh)
Create multimesh function space on multimesh (shared pointer version)
Definition: MultiMeshFunctionSpace.cpp:38
void lock_inactive_dofs(GenericMatrix &A, GenericVector &b) const
Lock inactive dofs of a system.
Definition: MultiMeshFunctionSpace.cpp:169
This class defines a common interface for matrices.
Definition: GenericMatrix.h:46
std::size_t num_parts() const
Definition: MultiMeshFunctionSpace.cpp:74
Definition: MultiMeshFunctionSpace.h:47
~MultiMeshFunctionSpace()
Destructor.
Definition: MultiMeshFunctionSpace.cpp:51
This class defines a common interface for vectors.
Definition: GenericVector.h:47
Definition: MultiMeshSubSpace.h:42