17 #include "geometry.hpp"
53 template <mfem::Geometry::Type g,
int q>
81 using type =
tensor<double, 3, 3, (q * (q + 1) * (q + 2)) / 6>;
91 template <mfem::Geometry::Type g,
int q>
139 template <mfem::Geometry::Type g>
142 if (g == mfem::Geometry::CUBE) {
155 if (g == mfem::Geometry::SQUARE) {
194 template <
int p,
int c = 1>
206 template <
int p,
int c = 1>
218 template <
int p,
int c = 1>
266 template <Family f,
typename T,
int q,
int dim>
269 [[maybe_unused]] constexpr
int VALUE = 0;
270 [[maybe_unused]] constexpr
int DERIVATIVE = 1;
272 for (
int k = 0; k < q; k++) {
274 for (
int row = 0; row < dim; row++) {
275 for (
int col = 0; col < dim; col++) {
276 J[row][col] = jacobians(col, row, k);
280 if constexpr (f == Family::H1 || f == Family::L2) {
282 get<DERIVATIVE>(qf_input[k]) =
dot(get<DERIVATIVE>(qf_input[k]),
inv(J));
285 if constexpr (f == Family::HCURL) {
286 get<VALUE>(qf_input[k]) =
dot(get<VALUE>(qf_input[k]),
inv(J));
287 get<DERIVATIVE>(qf_input[k]) = get<DERIVATIVE>(qf_input[k]) /
det(J);
288 if constexpr (dim == 3) {
289 get<DERIVATIVE>(qf_input[k]) =
dot(get<DERIVATIVE>(qf_input[k]),
transpose(J));
307 template <Family f,
typename T,
int q,
int dim>
310 [[maybe_unused]] constexpr
int SOURCE = 0;
311 [[maybe_unused]] constexpr
int FLUX = 1;
313 for (
int k = 0; k < q; k++) {
315 for (
int row = 0; row < dim; row++) {
316 for (
int col = 0; col < dim; col++) {
317 J_T[row][col] = jacobians(row, col, k);
323 if constexpr (f == Family::H1 || f == Family::L2) {
324 get<SOURCE>(qf_output[k]) = get<SOURCE>(qf_output[k]) * dv;
325 get<FLUX>(qf_output[k]) =
dot(get<FLUX>(qf_output[k]),
inv(J_T)) * dv;
331 if constexpr (f == Family::HCURL) {
332 get<SOURCE>(qf_output[k]) =
dot(get<SOURCE>(qf_output[k]),
inv(J_T)) * dv;
333 if constexpr (dim == 3) {
334 get<FLUX>(qf_output[k]) =
dot(get<FLUX>(qf_output[k]),
transpose(J_T));
338 if constexpr (f == Family::QOI) {
339 qf_output[k] = qf_output[k] * dv;
369 template <mfem::Geometry::Type g,
typename family>
#define SMITH_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 SMITH_HOST_DEVICE int elements_per_block(int q)
this function returns information about how many elements should be processed by a single thread bloc...
SMITH_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,...
Family
Element conformity.
constexpr SMITH_HOST_DEVICE auto inv(const isotropic_tensor< T, m, m > &I)
return the inverse of an isotropic tensor
SMITH_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 SMITH_HOST_DEVICE auto transpose(const isotropic_tensor< T, m, m > &I)
return the transpose of an isotropic tensor
constexpr SMITH_HOST_DEVICE auto det(const isotropic_tensor< T, m, m > &I)
compute the determinant of an isotropic tensor
constexpr SMITH_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
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.
a small POD class for tracking function space metadata
std::tuple< int, int, int > as_tuple() const
return the data contained in this struct as a tuple
Family family
either H1, Hcurl, L2
bool operator<(FunctionSpace other) const
defines an ordering over FunctionSpaces, to enable use in containers like std::map
int order
polynomial order
int components
how many values are stored at each node
static constexpr Family family
the family of the basis functions
static constexpr int order
the polynomial order of the elements
static constexpr int components
the number of components at each node
H(curl) elements of order p.
static constexpr Family family
the family of the basis functions
static constexpr int components
the number of components at each node
static constexpr int order
the polynomial order of the elements
Discontinuous elements of order p.
static constexpr int components
the number of components at each node
static constexpr Family family
the family of the basis functions
static constexpr int order
the polynomial order of the elements
"Quantity of Interest" elements (i.e. elements with a single shape function, 1)
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
a convenience class for generating information about tensor product integration rules from the underl...
tensor< double, q > weights1D
the weights of the underlying 1D quadrature rule
SMITH_HOST_DEVICE double weight(int ix, int iy) const
return the quadrature weight for a quadrilateral
tensor< double, q > points1D
the abscissae of the underlying 1D quadrature rule
SMITH_HOST_DEVICE double weight(int ix, int iy, int iz) const
return the quadrature weight for a hexahedron
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.