9#include <basix/mdspan.hpp>
12#include <dolfinx/common/types.h>
20template <
class U,
class T>
22 = std::is_invocable_v<U, std::span<T>, std::span<const std::uint32_t>,
38 if constexpr (std::is_function_v<F>)
40 else if constexpr (
requires {
static_cast<bool>(fn); })
41 return static_cast<bool>(fn);
50template <
class U,
class T,
class G = dolfinx::scalar_value_t<T>>
51concept FEkernel = std::is_invocable_v<U, T*,
const T*,
const T*,
const G*,
52 const int*,
const std::uint8_t*,
void*>;
57 = std::is_convertible_v<
58 std::remove_cvref_t<T>,
59 md::mdspan<const std::int32_t, md::dextents<std::size_t, 2>>>
60 or std::is_convertible_v<
61 std::remove_cvref_t<T>,
62 md::mdspan<const std::int32_t, md::dextents<std::size_t, 1>>>;
70 and std::same_as<typename std::remove_cvref_t<T>::value_type,
76template <
class T,
class U>
79 and std::same_as<typename std::remove_cvref_t<T>::value_type, U>;
88 = std::ranges::random_access_range<C> and std::ranges::sized_range<C>
89 and std::same_as<std::ranges::range_value_t<C>, std::int32_t>
90 and
requires(
const std::remove_reference_t<C>& cells, std::size_t i) {
91 { cells[i] } -> std::convertible_to<std::int32_t>;
99template <
class D, std::
floating_po
int U>
108 md::mdspan<const U, md::extents<std::size_t, md::dynamic_extent, 3>>
x;
126template <
class D,
class B,
class E>
142concept DofMapPackBase =
requires(
const std::remove_cvref_t<T>& t) {
144 { t.bs } -> std::convertible_to<int>;
155 = DofMapPackBase<T> and
requires(
const std::remove_cvref_t<T>& t) {
156 requires std::ranges::view<std::remove_cvref_t<
decltype(t.entities)>>;
157 requires IndexList<std::remove_cvref_t<
decltype(t.entities)>>;
165 = DofMapPackBase<T> and
requires(
const std::remove_cvref_t<T>& t) {
166 { t.entities(0, 0) } -> std::convertible_to<std::int32_t>;
174 = DofMapPackBase<T> and
requires(
const std::remove_cvref_t<T>& t) {
175 { t.entities(0, 0, 0) } -> std::convertible_to<std::int32_t>;
185template <
class P,
class D,
class B,
class E>
203template <
class A,
class T>
204concept FormArgumentBase =
requires(
const std::remove_cvref_t<A>& a) {
206 { a.cell_info } -> std::convertible_to<std::span<const std::uint32_t>>;
212template <
class A,
class T>
214 = FormArgumentBase<A, T> and
requires(
const std::remove_cvref_t<A>& a) {
220template <
class A,
class T>
222 = FormArgumentBase<A, T> and
requires(
const std::remove_cvref_t<A>& a) {
228template <
class A,
class T>
230 = FormArgumentBase<A, T> and
requires(
const std::remove_cvref_t<A>& a) {
236inline constexpr bool is_scratch_buffer_type =
false;
238template <
class T, std::
size_t N>
239inline constexpr bool is_scratch_buffer_type<std::array<T, N>> =
true;
241template <
class T, std::
size_t N>
242inline constexpr bool is_scratch_buffer_type<std::span<T, N>> =
true;
252template <
class B,
class T>
254 = is_scratch_buffer_type<std::remove_cvref_t<B>>
255 and std::ranges::contiguous_range<B> and std::ranges::output_range<B, T>
256 and std::same_as<std::ranges::range_value_t<B>, T> and
requires(B& b) {
257 { b.data() } -> std::same_as<T*>;
258 { b.size() } -> std::convertible_to<std::size_t>;
264template <
class V,
class T>
266 = std::same_as<typename std::remove_cvref_t<V>::value_type, T>
267 and
requires(std::remove_cvref_t<V>& v, std::int32_t i) {
268 { v[i] } -> std::convertible_to<T&>;
275using mdspan2_t = md::mdspan<const std::int32_t, md::dextents<std::size_t, 2>>;
285inline constexpr std::size_t static_dofs_per_cell
286 = std::remove_cvref_t<D>::static_extent(1);
299template <
class XD, std::
floating_po
int U>
303 const auto x_dofmap =
geometry.dofmap;
304 const std::size_t ndofs_x = x_dofmap.extent(1);
305 const std::int32_t* xdofs
306 = x_dofmap.data_handle() +
static_cast<std::ptrdiff_t
>(
cell) * ndofs_x;
307 const U* x =
geometry.x.data_handle();
308 for (std::size_t i = 0; i < ndofs_x; ++i)
310 const U* src = x +
static_cast<std::ptrdiff_t
>(xdofs[i]) * 3;
311 for (std::size_t k = 0; k < 3; ++k)
312 cdofs[3 * i + k] = src[k];
327void dispatch_bs(
int bs, F&& f)
332 return f(std::integral_constant<int, 1>{});
334 return f(std::integral_constant<int, 3>{});
352void dispatch_bs(
int bs0,
int bs1, F&& f)
359 return f(std::integral_constant<int, 1>{},
360 std::integral_constant<int, 1>{});
362 return f(std::integral_constant<int, 3>{},
363 std::integral_constant<int, 3>{});
mdspan/mdarray namespace
Definition types.h:60
Concept for the container that assembled values are accumulated into, indexed by a process-local degr...
Definition traits.h:266
Concept for the degree-of-freedom map data passed to the cell assembly kernel, whose entities are a l...
Definition traits.h:155
Concept for the degree-of-freedom map data passed to the entity assembly kernel, whose entities are i...
Definition traits.h:165
Concept for the degree-of-freedom map data passed to the interior facet assembly kernel,...
Definition traits.h:174
Finite element cell kernel concept.
Definition traits.h:51
Concept for a randomly-indexable list of process-local indices, as used for the cell lists passed to ...
Definition traits.h:88
Concept for a rank-2 mdspan of a floating-point type.
Definition traits.h:78
Concept for a rank-2 mdspan of 32-bit indices.
Definition traits.h:69
Concept for mdspan of rank 1 or 2.
Definition traits.h:57
Concept for the mutable scratch buffers passed to the assembly kernels.
Definition traits.h:254
Finite element method functionality.
Definition assemble_expression_impl.h:22
@ cell
Cell.
Definition Form.h:44
constexpr bool is_transform_set(const F &fn)
Whether a DofTransformKernel fn should be invoked.
Definition traits.h:34
Geometry data structures and algorithms.
Definition BoundingBoxTree.h:24
Degree-of-freedom map data for one form argument, as passed to the assembly kernels.
Definition traits.h:128
B bs
Dofmap block size.
Definition traits.h:133
E entities
Entity indices in this argument's mesh.
Definition traits.h:136
D map
Dofmap, shape (num_cells, num_dofs_per_cell).
Definition traits.h:130
Mesh geometry data passed to the assembly kernels.
Definition traits.h:102
D dofmap
Geometry dofmap, shape (num_cells, num_nodes_per_cell).
Definition traits.h:104
md::mdspan< const U, md::extents< std::size_t, md::dynamic_extent, 3 > > x
Definition traits.h:108