11#include "ElementDofLayout.h"
12#include "FiniteElement.h"
13#include "FunctionSpace.h"
17#include <dolfinx/common/IndexMap.h>
18#include <dolfinx/graph/AdjacencyList.h>
19#include <dolfinx/mesh/Mesh.h>
20#include <dolfinx/mesh/Topology.h>
35template <std::
floating_po
int T>
37 const std::vector<int>& parent_map
41 std::vector<int> offsets(1, 0);
42 std::vector<dolfinx::fem::ElementDofLayout> sub_doflayout;
49 std::shared_ptr<const fem::FiniteElement<T>> sub_e
56 std::vector<int> parent_map_sub(sub_e->space_dimension(), offsets.back());
57 for (std::size_t j = 0; j < parent_map_sub.size(); ++j)
58 parent_map_sub[j] += bs * j;
59 offsets.push_back(offsets.back() + (bs > 1 ? 1 : sub_e->space_dimension()));
60 sub_doflayout.push_back(
79 mesh::Topology& topology,
80 const std::function<
void(std::span<std::int32_t>, std::uint32_t)>&
82 const std::function<std::vector<int>(
83 const graph::AdjacencyList<std::int32_t>&)>& reorder_fn);
96 MPI_Comm comm,
const std::vector<ElementDofLayout>& layouts,
97 mesh::Topology& topology,
98 const std::function<
void(std::span<std::int32_t>, std::uint32_t)>&
100 const std::function<std::vector<int>(
101 const graph::AdjacencyList<std::int32_t>&)>& reorder_fn);
104template <std::
floating_po
int T>
109 reorder_fn =
nullptr)
114 assert(
mesh->topology());
115 if (e->cell_type() !=
mesh->topology()->cell_type())
116 throw std::invalid_argument(
"Cell type of element and mesh must match.");
122 std::function<void(std::span<std::int32_t>, std::uint32_t)> permute_inv
123 = e->needs_dof_permutations() ? e->dof_permutation_fn(
true,
true)
126 mesh->comm(), layout, *
mesh->topology(), permute_inv, reorder_fn));
Degree-of-freedom map representations and tools.
Degree-of-freedom map.
Definition DofMap.h:73
Definition ElementDofLayout.h:31
Model of a finite element.
Definition FiniteElement.h:199
const std::vector< std::shared_ptr< const FiniteElement< geometry_type > > > & sub_elements() const noexcept
Get subelements (if any).
Definition FiniteElement.cpp:468
const std::vector< std::vector< std::vector< int > > > & entity_dofs() const noexcept
Local DOFs associated with each sub-entity of the cell.
Definition FiniteElement.cpp:412
int num_sub_elements() const noexcept
Number of sub elements (for a mixed or blocked element).
Definition FiniteElement.cpp:455
const std::vector< std::vector< std::vector< int > > > & entity_closure_dofs() const noexcept
Local DOFs associated with the closure of each sub-entity of the cell.
Definition FiniteElement.cpp:419
int block_size() const noexcept
Block size of the finite element function space.
Definition FiniteElement.cpp:431
This class represents a finite element function space defined by a mesh, a finite element,...
Definition FunctionSpace.h:35
This class provides a static adjacency list data structure.
Definition AdjacencyList.h:41
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition Mesh.h:25
Finite element method functionality.
Definition assemble_expression_impl.h:22
FunctionSpace< T > create_functionspace(std::shared_ptr< mesh::Mesh< T > > mesh, std::shared_ptr< const fem::FiniteElement< T > > e, std::function< std::vector< int >(const graph::AdjacencyList< std::int32_t > &)> reorder_fn=nullptr)
NEW Create a function space from a fem::FiniteElement.
Definition functionspace_factory.h:105
ElementDofLayout create_element_dof_layout(const fem::FiniteElement< T > &element, const std::vector< int > &parent_map={})
Create an ElementDofLayout from a FiniteElement.
Definition functionspace_factory.h:36
DofMap create_dofmap(MPI_Comm comm, const ElementDofLayout &layout, mesh::Topology &topology, const std::function< void(std::span< std::int32_t >, std::uint32_t)> &permute_inv, const std::function< std::vector< int >(const graph::AdjacencyList< std::int32_t > &)> &reorder_fn)
Create a dof map on mesh.
Definition utils.cpp:34
std::vector< DofMap > create_dofmaps(MPI_Comm comm, const std::vector< ElementDofLayout > &layouts, mesh::Topology &topology, const std::function< void(std::span< std::int32_t >, std::uint32_t)> &permute_inv, const std::function< std::vector< int >(const graph::AdjacencyList< std::int32_t > &)> &reorder_fn)
Create a set of dofmaps on a given topology.
Definition utils.cpp:80
FunctionSpace(U mesh, V element, W dofmap) -> FunctionSpace< typename std::remove_cvref< typename U::element_type >::type::geometry_type::value_type >
Type deduction.
Mesh data structures and algorithms on meshes.
Definition DofMap.h:32