17 #include "geometry.hpp"
54 template <mfem::Geometry::Type g,
int q>
82 using type =
tensor<double, 3, 3, (q * (q + 1) * (q + 2)) / 6>;
92 template <mfem::Geometry::Type g,
int q>
140 template <mfem::Geometry::Type g>
143 if (g == mfem::Geometry::CUBE) {
156 if (g == mfem::Geometry::SQUARE) {
195 template <
int p,
int c = 1>
207 template <
int p,
int c = 1>
219 template <
int p,
int c = 1>
246 template <Family f,
typename T,
int q,
int dim>
249 [[maybe_unused]] constexpr
int VALUE = 0;
250 [[maybe_unused]] constexpr
int DERIVATIVE = 1;
252 for (
int k = 0; k < q; k++) {
254 for (
int row = 0; row < dim; row++) {
255 for (
int col = 0; col < dim; col++) {
256 J[row][col] = jacobians(col, row, k);
260 if constexpr (f == Family::H1 || f == Family::L2) {
262 get<DERIVATIVE>(qf_input[k]) =
dot(get<DERIVATIVE>(qf_input[k]),
inv(J));
265 if constexpr (f == Family::HCURL) {
266 get<VALUE>(qf_input[k]) =
dot(get<VALUE>(qf_input[k]),
inv(J));
267 get<DERIVATIVE>(qf_input[k]) = get<DERIVATIVE>(qf_input[k]) /
det(J);
268 if constexpr (dim == 3) {
269 get<DERIVATIVE>(qf_input[k]) =
dot(get<DERIVATIVE>(qf_input[k]),
transpose(J));
287 template <Family f,
typename T,
int q,
int dim>
290 [[maybe_unused]] constexpr
int SOURCE = 0;
291 [[maybe_unused]] constexpr
int FLUX = 1;
293 for (
int k = 0; k < q; k++) {
295 for (
int row = 0; row < dim; row++) {
296 for (
int col = 0; col < dim; col++) {
297 J_T[row][col] = jacobians(row, col, k);
303 if constexpr (f == Family::H1 || f == Family::L2) {
304 get<SOURCE>(qf_output[k]) = get<SOURCE>(qf_output[k]) * dv;
305 get<FLUX>(qf_output[k]) =
dot(get<FLUX>(qf_output[k]),
inv(J_T)) * dv;
311 if constexpr (f == Family::HCURL) {
312 get<SOURCE>(qf_output[k]) =
dot(get<SOURCE>(qf_output[k]),
inv(J_T)) * dv;
313 if constexpr (dim == 3) {
314 get<FLUX>(qf_output[k]) =
dot(get<FLUX>(qf_output[k]),
transpose(J_T));
318 if constexpr (f == Family::QOI) {
319 qf_output[k] = qf_output[k] * dv;
349 template <mfem::Geometry::Type g,
typename family>
#define SERAC_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc and does nothing on a host compi...
Specialization of finite_element for H1 on hexahedron geometry.
Specialization of finite_element for Hcurl on hexahedron geometry.
Specialization of finite_element for L2 on hexahedron geometry.
Accelerator functionality.
constexpr SERAC_HOST_DEVICE auto dot(const isotropic_tensor< S, m, m > &I, const tensor< T, m, n... > &A)
dot product between an isotropic and (nonisotropic) tensor
constexpr SERAC_HOST_DEVICE int elements_per_block(int q)
this function returns information about how many elements should be processed by a single thread bloc...
SERAC_HOST_DEVICE void physical_to_parent(tensor< T, q > &qf_output, const tensor< double, dim, dim, q > &jacobians)
transform information in the physical space (i.e. sources and fluxes w.r.t {x, y, z}) back to the par...
constexpr SERAC_HOST_DEVICE auto det(const isotropic_tensor< T, m, m > &I)
compute the determinant of an isotropic tensor
constexpr SERAC_HOST_DEVICE auto inv(const isotropic_tensor< T, m, m > &I)
return the inverse of an isotropic tensor
constexpr SERAC_HOST_DEVICE auto transpose(const isotropic_tensor< T, m, m > &I)
return the transpose of an isotropic tensor
Family
Element conformity.
SERAC_HOST_DEVICE void parent_to_physical(tensor< T, q > &qf_input, const tensor< double, dim, dim, q > &jacobians)
transform information in the parent space (i.e. values and derivatives w.r.t {xi, eta,...
Definitions of 1D quadrature weights and node locations and polynomial basis functions.
Specialization of finite_element for expressing quantities of interest on any geometry.
Specialization of finite_element for H1 on quadrilateral geometry.
Specialization of finite_element for Hcurl on quadrilateral geometry.
Specialization of finite_element for L2 on quadrilateral geometry.
Specialization of finite_element for H1 on segment geometry.
Specialization of finite_element for Hcurl on segment geometry.
Specialization of finite_element for L2 on segment geometry.
static constexpr int order
the polynomial order of the elements
static constexpr Family family
the family of the basis functions
static constexpr int components
the number of components at each node
H(curl) elements of order p.
static constexpr int components
the number of components at each node
static constexpr int order
the polynomial order of the elements
static constexpr Family family
the family of the basis functions
Discontinuous elements of order p.
static constexpr int components
the number of components at each node
static constexpr int order
the polynomial order of the elements
static constexpr Family family
the family of the basis functions
"Quantity of Interest" elements (i.e. elements with a single shape function, 1)
static constexpr int order
the polynomial order of the elements
static constexpr Family family
the family of the basis functions
static constexpr int components
the number of components at each node
a convenience class for generating information about tensor product integration rules from the underl...
SERAC_HOST_DEVICE double weight(int ix, int iy) const
return the quadrature weight for a quadrilateral
SERAC_HOST_DEVICE double weight(int ix, int iy, int iz) const
return the quadrature weight for a hexahedron
tensor< double, q > points1D
the abscissae of the underlying 1D quadrature rule
tensor< double, q > weights1D
the weights of the underlying 1D quadrature rule
this struct is used to look up mfem's memory layout of the quadrature point jacobian matrices
this struct is used to look up mfem's memory layout of the quadrature point position vectors
Template prototype for finite element implementations.
Implementation of the tensor class used by Functional.
Specialization of finite_element for H1 on tetrahedron geometry.
Specialization of finite_element for L2 on tetrahedron geometry.
Specialization of finite_element for H1 on triangle geometry.
Specialization of finite_element for L2 on triangle geometry.
Implements a std::tuple-like object that works in CUDA kernels.