DOLFIN
DOLFIN C++ interface
MultiMeshDofMap.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-19
19 // Last changed: 2016-03-02
20 
21 #ifndef __MULTI_MESH_DOF_MAP_H
22 #define __MULTI_MESH_DOF_MAP_H
23 
24 #include "GenericDofMap.h"
25 #include <dolfin/mesh/MultiMesh.h>
26 
27 namespace dolfin
28 {
29 
30  // Forward declarations
31  class MultiMeshFunctionSpace;
32  class MultiMesh;
33 
36 
38  {
39  public:
40 
43 
45  MultiMeshDofMap(const MultiMeshDofMap& dofmap);
46 
49 
55  std::size_t num_parts() const;
56 
62  std::shared_ptr<const GenericDofMap> part(std::size_t i) const;
63 
69  void add(std::shared_ptr<const GenericDofMap> dofmap);
70 
72  void build(const MultiMeshFunctionSpace& function_space,
73  const std::vector<dolfin::la_index>& offsets);
74 
76  void clear();
77 
80  std::size_t global_dimension() const;
81 
84  std::pair<std::size_t, std::size_t> ownership_range() const;
85 
88  const std::vector<int>& off_process_owner() const;
89 
91  std::shared_ptr<IndexMap> index_map() const;
92 
94  std::string str(bool verbose) const;
95 
97  std::vector<dolfin::la_index> inactive_dofs(const MultiMesh &multimesh,
98  std::size_t part_id) const;
99 
100  private:
101 
102  // Index Map containing total global dimension (sum of parts)
103  // FIXME: make it work in parallel
104  std::shared_ptr<IndexMap> _index_map;
105 
106  // List of original dofmaps
107  std::vector<std::shared_ptr<const GenericDofMap>> _original_dofmaps;
108 
109  // List of modified dofmaps
110  std::vector<std::shared_ptr<GenericDofMap>> _new_dofmaps;
111 
112  };
113 
114 }
115 
116 #endif
std::shared_ptr< IndexMap > index_map() const
Return the map.
Definition: MultiMeshDofMap.cpp:144
~MultiMeshDofMap()
Destructor.
Definition: MultiMeshDofMap.cpp:45
Definition: adapt.h:29
std::shared_ptr< const GenericDofMap > part(std::size_t i) const
Definition: MultiMeshDofMap.cpp:55
Definition: MultiMesh.h:50
void clear()
Clear MultiMesh dofmap.
Definition: MultiMeshDofMap.cpp:119
std::string str(bool verbose) const
Return informal string representation (pretty-print)
Definition: MultiMeshDofMap.cpp:150
MultiMeshDofMap()
Constructor.
Definition: MultiMeshDofMap.cpp:33
std::size_t num_parts() const
Definition: MultiMeshDofMap.cpp:50
const std::vector< int > & off_process_owner() const
Definition: MultiMeshDofMap.cpp:138
std::vector< dolfin::la_index > inactive_dofs(const MultiMesh &multimesh, std::size_t part_id) const
Return inactive dofs.
Definition: MultiMeshDofMap.cpp:163
void build(const MultiMeshFunctionSpace &function_space, const std::vector< dolfin::la_index > &offsets)
Build MultiMesh dofmap.
Definition: MultiMeshDofMap.cpp:68
Definition: MultiMeshDofMap.h:37
std::pair< std::size_t, std::size_t > ownership_range() const
Definition: MultiMeshDofMap.cpp:131
void add(std::shared_ptr< const GenericDofMap > dofmap)
Definition: MultiMeshDofMap.cpp:61
Definition: MultiMeshFunctionSpace.h:47
std::size_t global_dimension() const
Definition: MultiMeshDofMap.cpp:126