DOLFINx
0.11.0.0
DOLFINx C++
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfinx
fem
kernel.h
1
// Copyright (C) 2025 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 <dolfinx/common/defines.h>
10
#include <dolfinx/common/types.h>
11
#include <ufcx.h>
12
13
namespace
dolfinx::fem::impl
14
{
18
template
<dolfinx::scalar T, std::
float
ing_po
int
U = scalar_value_t<T>>
19
using
kernelptr_t = void (*)(T*,
const
T*,
const
T*,
const
U*,
const
int
*,
20
const
std::uint8_t*,
void
*);
21
25
template
<dolfinx::scalar T, std::
float
ing_po
int
U = scalar_value_t<T>>
26
using
kernel_t = std::function<void(T*,
const
T*,
const
T*,
const
U*,
27
const
int
*,
const
std::uint8_t*,
void
*)>;
28
34
template
<dolfinx::scalar T, std::
float
ing_po
int
U = scalar_value_t<T>>
35
constexpr
kernel_t<T, U> extract_kernel(
const
ufcx_integral* integral)
36
{
37
if
constexpr
(std::is_same_v<T, float>)
38
return
integral->tabulate_tensor_float32;
39
else
if
constexpr
(std::is_same_v<T, double>)
40
return
integral->tabulate_tensor_float64;
41
#ifndef DOLFINX_NO_STDC_COMPLEX_KERNELS
42
else
if
constexpr
(std::is_same_v<T, std::complex<float>>
43
&&
has_complex_ufcx_kernels
())
44
{
45
return
reinterpret_cast<
kernelptr_t<T, U>
>
(
46
integral->tabulate_tensor_complex64);
47
}
48
else
if
constexpr
(std::is_same_v<T, std::complex<double>>
49
&&
has_complex_ufcx_kernels
())
50
{
51
return
reinterpret_cast<
kernelptr_t<T, U>
>
(
52
integral->tabulate_tensor_complex128);
53
}
54
#endif
55
else
56
throw
std::runtime_error(
"Could not extract kernel from ufcx integral."
);
57
}
58
59
}
// namespace dolfinx::fem::impl
dolfinx::has_complex_ufcx_kernels
consteval bool has_complex_ufcx_kernels()
Definition
defines.h:109
Generated by
1.17.0