DOLFIN-X
DOLFIN-X C++ interface
DofMap.h
1 // Copyright (C) 2007-2020 Anders Logg and Garth N. Wells
2 //
3 // This file is part of DOLFINX (https://www.fenicsproject.org)
4 //
5 // SPDX-License-Identifier: LGPL-3.0-or-later
6 
7 #pragma once
8 
9 #include "ElementDofLayout.h"
10 #include <Eigen/Dense>
11 #include <cstdlib>
12 #include <dolfinx/graph/AdjacencyList.h>
13 #include <memory>
14 #include <utility>
15 #include <vector>
16 
17 namespace dolfinx
18 {
19 
20 namespace common
21 {
22 class IndexMap;
23 }
24 
25 namespace mesh
26 {
27 class Topology;
28 } // namespace mesh
29 
30 namespace fem
31 {
32 
34 
39 
40 class DofMap
41 {
42 public:
46  DofMap(std::shared_ptr<const ElementDofLayout> element_dof_layout,
47  std::shared_ptr<const common::IndexMap> index_map,
49 
50  // Copy constructor
51  DofMap(const DofMap& dofmap) = delete;
52 
54  DofMap(DofMap&& dofmap) = default;
55 
57  virtual ~DofMap() = default;
58 
59  // Copy assignment
60  DofMap& operator=(const DofMap& dofmap) = delete;
61 
63  DofMap& operator=(DofMap&& dofmap) = default;
64 
68  Eigen::Array<std::int32_t, Eigen::Dynamic, 1>::ConstSegmentReturnType
69  cell_dofs(int cell) const
70  {
71  return _dofmap.links(cell);
72  }
73 
77  DofMap extract_sub_dofmap(const std::vector<int>& component) const;
78 
83  std::pair<std::unique_ptr<DofMap>, std::vector<std::int32_t>>
84  collapse(MPI_Comm comm, const mesh::Topology& topology) const;
85 
88  const graph::AdjacencyList<std::int32_t>& list() const { return _dofmap; }
89 
91  std::shared_ptr<const ElementDofLayout> element_dof_layout;
92 
94  std::shared_ptr<const common::IndexMap> index_map;
95 
96 private:
97  // Cell-local-to-dof map (dofs for cell dofmap[i])
99 };
100 } // namespace fem
101 } // namespace dolfinx
dolfinx::fem::DofMap::extract_sub_dofmap
DofMap extract_sub_dofmap(const std::vector< int > &component) const
Extract subdofmap component.
Definition: DofMap.cpp:164
dolfinx::fem::DofMap::collapse
std::pair< std::unique_ptr< DofMap >, std::vector< std::int32_t > > collapse(MPI_Comm comm, const mesh::Topology &topology) const
Create a "collapsed" dofmap (collapses a sub-dofmap)
Definition: DofMap.cpp:194
dolfinx::fem::DofMap::element_dof_layout
std::shared_ptr< const ElementDofLayout > element_dof_layout
Layout of dofs on an element.
Definition: DofMap.h:91
dolfinx::graph::AdjacencyList
This class provides a static adjacency list data structure. It is commonly used to store directed gra...
Definition: assemble_matrix_impl.h:26
dolfinx::fem::DofMap
Degree-of-freedom map.
Definition: DofMap.h:40
dolfinx::fem::DofMap::~DofMap
virtual ~DofMap()=default
Destructor.
dolfinx::fem::DofMap::list
const graph::AdjacencyList< std::int32_t > & list() const
Get dofmap data.
Definition: DofMap.h:88
dolfinx::fem::DofMap::cell_dofs
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >::ConstSegmentReturnType cell_dofs(int cell) const
Local-to-global mapping of dofs on a cell.
Definition: DofMap.h:69
dolfinx::fem::DofMap::DofMap
DofMap(std::shared_ptr< const ElementDofLayout > element_dof_layout, std::shared_ptr< const common::IndexMap > index_map, const graph::AdjacencyList< std::int32_t > &dofmap)
Create a DofMap from the layout of dofs on a reference element, an IndexMap defining the distribution...
Definition: DofMap.cpp:154
dolfinx::fem::DofMap::index_map
std::shared_ptr< const common::IndexMap > index_map
Index map that described the parallel distribution of the dofmap.
Definition: DofMap.h:94
dolfinx::mesh::Topology
Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relat...
Definition: Topology.h:58