DOLFINx 0.10.0.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
ElementDofLayout.h
1// Copyright (C) 2019 Chris Richardson 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 <array>
10#include <cstdint>
11#include <span>
12#include <vector>
13
14namespace dolfinx::mesh
15{
16enum class CellType : std::int8_t;
17}
18
19namespace dolfinx::fem
20{
21
22// TODO: For this class/concept to be robust, the topology of the
23// reference cell needs to be defined.
24//
25// TODO: Handle block dofmaps properly
26
31{
32public:
43 int block_size,
44 const std::vector<std::vector<std::vector<int>>>& entity_dofs,
45 const std::vector<std::vector<std::vector<int>>>& entity_closure_dofs,
46 const std::vector<int>& parent_map,
47 const std::vector<ElementDofLayout>& sub_layouts);
48
50 ElementDofLayout copy() const;
51
53 ElementDofLayout(const ElementDofLayout& dofmap) = default;
54
57
59 ~ElementDofLayout() = default;
60
62 ElementDofLayout& operator=(const ElementDofLayout& dofmap) = default;
63
66
71 bool operator==(const ElementDofLayout& layout) const;
72
76 int num_dofs() const;
77
81 int num_entity_dofs(int dim) const;
82
87 int num_entity_closure_dofs(int dim) const;
88
93 const std::vector<int>& entity_dofs(int dim, int entity_index) const;
94
99 const std::vector<int>& entity_closure_dofs(int dim, int entity_index) const;
100
102 const std::vector<std::vector<std::vector<int>>>& entity_dofs_all() const;
103
106 const std::vector<std::vector<std::vector<int>>>&
108
110 int num_sub_dofmaps() const;
111
113 const ElementDofLayout& sub_layout(std::span<const int> component) const;
114
118 std::vector<int> sub_view(std::span<const int> component) const;
119
121 int block_size() const;
122
126 bool is_view() const;
127
128private:
129 // Block size
130 int _block_size;
131
132 // Mapping of dofs to this ElementDofLayout's immediate parent
133 std::vector<int> _parent_map;
134
135 // Total number of dofs on this element dofmap
136 int _num_dofs;
137
138 // The number of dofs associated with each entity type
139 std::array<int, 4> _num_entity_dofs;
140
141 // The number of dofs associated with each entity type, including all
142 // connected entities of lower dimension.
143 std::array<int, 4> _num_entity_closure_dofs;
144
145 // List of dofs per entity, ordered by dimension.
146 // dof = _entity_dofs[dim][entity][i]
147 std::vector<std::vector<std::vector<int>>> _entity_dofs;
148
149 // List of dofs with connected entities of lower dimension
150 std::vector<std::vector<std::vector<int>>> _entity_closure_dofs;
151
152 // List of sub dofmaps
153 // std::vector<std::shared_ptr<const ElementDofLayout>> _sub_dofmaps;
154 std::vector<ElementDofLayout> _sub_dofmaps;
155};
156
157} // namespace dolfinx::fem
const std::vector< int > & entity_closure_dofs(int dim, int entity_index) const
Definition ElementDofLayout.cpp:80
ElementDofLayout copy() const
Copy the DOF layout, discarding any parent information.
Definition ElementDofLayout.cpp:45
int num_entity_dofs(int dim) const
Definition ElementDofLayout.cpp:63
const std::vector< int > & entity_dofs(int dim, int entity_index) const
Definition ElementDofLayout.cpp:73
std::vector< int > sub_view(std::span< const int > component) const
Definition ElementDofLayout.cpp:113
const std::vector< std::vector< std::vector< int > > > & entity_closure_dofs_all() const
Definition ElementDofLayout.cpp:92
ElementDofLayout(ElementDofLayout &&dofmap)=default
Move constructor.
bool is_view() const
Definition ElementDofLayout.cpp:140
ElementDofLayout(int block_size, const std::vector< std::vector< std::vector< int > > > &entity_dofs, const std::vector< std::vector< std::vector< int > > > &entity_closure_dofs, const std::vector< int > &parent_map, const std::vector< ElementDofLayout > &sub_layouts)
Definition ElementDofLayout.cpp:18
int num_entity_closure_dofs(int dim) const
Definition ElementDofLayout.cpp:68
~ElementDofLayout()=default
Destructor.
ElementDofLayout & operator=(ElementDofLayout &&dofmap)=default
Move assignment.
int block_size() const
Block size.
Definition ElementDofLayout.cpp:138
ElementDofLayout(const ElementDofLayout &dofmap)=default
Copy constructor.
ElementDofLayout & operator=(const ElementDofLayout &dofmap)=default
Copy assignment.
bool operator==(const ElementDofLayout &layout) const
Definition ElementDofLayout.cpp:52
const ElementDofLayout & sub_layout(std::span< const int > component) const
Get sub-dofmap given by list of components, one for each level.
Definition ElementDofLayout.cpp:100
int num_dofs() const
Definition ElementDofLayout.cpp:61
const std::vector< std::vector< std::vector< int > > > & entity_dofs_all() const
Direct access to all entity dofs (dof = _entity_dofs[dim][entity][i])
Definition ElementDofLayout.cpp:86
int num_sub_dofmaps() const
Get number of sub-dofmaps.
Definition ElementDofLayout.cpp:97
Finite element method functionality.
Definition assemble_expression_impl.h:23
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32
CellType
Cell type identifier.
Definition cell_types.h:22