DOLFINx
DOLFINx C++
Loading...
Searching...
No Matches
types.h
1// Copyright (C) 2023-2025 Garth N. Wells and Paul T. Kühner
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 <basix/mdspan.hpp>
10#include <complex>
11#include <concepts>
12#include <type_traits>
13
14namespace dolfinx
15{
19
20template <class T>
21struct is_custom_scalar : std::false_type
22{
23};
24
25template <class T>
26concept scalar = std::floating_point<T>
27 || std::is_same_v<T, std::complex<typename T::value_type>>
28 || is_custom_scalar<T>::value;
29
32template <scalar T, typename = void>
33struct scalar_value
34{
36 typedef T type;
37};
38
40template <scalar T>
41struct scalar_value<T, std::void_t<typename T::value_type>>
42{
43 typedef typename T::value_type type;
44};
45
47template <scalar T>
48using scalar_value_t = typename scalar_value<T>::type;
49
51namespace md = MDSPAN_IMPL_STANDARD_NAMESPACE;
52
53} // namespace dolfinx
Definition types.h:26
Top-level namespace.
Definition defines.h:12