MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
quadinterpolator_face.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_QUADINTERPOLATOR_FACE
13#define MFEM_QUADINTERPOLATOR_FACE
14
15#include "fespace.hpp"
16
17namespace mfem
18{
19
20/** @brief A class that performs interpolation from a face E-vector to
21 quadrature point values and/or derivatives (Q-vectors) on the faces. */
22/** A face E-vector represents the face-wise discontinuous version of the trace
23 FE space and can be obtained, for example, from a GridFunction using the
24 Operator returned by FiniteElementSpace::GetFaceRestriction(). */
26{
27private:
28 FaceType type;
29 int nf;
30 Array<bool> signs;
31protected:
32 friend class FiniteElementSpace; // Needs access to qspace and IntRule
33
34 const FiniteElementSpace *fespace; ///< Not owned
35 const IntegrationRule *IntRule; ///< Not owned
36 mutable QVectorLayout q_layout; ///< Output Q-vector layout
37
38 mutable bool use_tensor_products;
39
40 static const int MAX_NQ1D = 10;
41 static const int MAX_ND1D = 10;
42 static const int MAX_VDIM1D = 1;
43
44 static const int MAX_NQ2D = 100;
45 static const int MAX_ND2D = 100;
46 static const int MAX_VDIM2D = 2;
47
48 static const int MAX_NQ3D = 1000;
49 static const int MAX_ND3D = 1000;
50 static const int MAX_VDIM3D = 3;
51
52public:
54 {
55 VALUES = 1 << 0, ///< Evaluate the values at quadrature points
56 DERIVATIVES = 1 << 1, ///< Evaluate the derivatives at quadrature points
57 /** @brief Assuming the derivative at quadrature points form a matrix,
58 this flag can be used to compute and store their determinants. This
59 flag can only be used in Mult(). */
60 DETERMINANTS = 1 << 2,
61 NORMALS = 1 << 3
62 };
63
65 const IntegrationRule &ir, FaceType type);
66
67 /// @brief Returns true if the given finite element space is supported by
68 /// FaceQuadratureInterpolator.
69 static bool SupportsFESpace(const FiniteElementSpace &fes);
70
71 /** @brief Disable the use of tensor product evaluations, for tensor-product
72 elements, e.g. quads and hexes. */
73 /** Currently, tensor product evaluations are not implemented and this method
74 has no effect. */
75 void DisableTensorProducts(bool disable = true) const
76 { use_tensor_products = !disable; }
77
78 /** @brief Query the current output Q-vector layout. The default value is
79 QVectorLayout::byNODES. */
80 /** @sa SetOutputLayout(). */
82
83 /** @brief Set the desired output Q-vector layout. The default value is
84 QVectorLayout::byNODES. */
85 /** @sa GetOutputLayout(). */
86 void SetOutputLayout(QVectorLayout layout) const { q_layout = layout; }
87
88 /// Interpolate the E-vector @a e_vec to quadrature points.
89 /** The @a eval_flags are a bitwise mask of constants from the FaceEvalFlags
90 enumeration. When the VALUES flag is set, the values at quadrature points
91 are computed and stored in the Vector @a q_val. Similarly, when the flag
92 DERIVATIVES is set, the derivatives are computed and stored in @a q_der.
93 When the DETERMINANTS flags is set, it is assumed that the derivatives
94 form a matrix at each quadrature point (i.e. the associated
95 FiniteElementSpace is a vector space) and their determinants are computed
96 and stored in @a q_det. */
97 void Mult(const Vector &e_vec, unsigned eval_flags,
98 Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor) const;
99
100 /// Interpolate the values of the E-vector @a e_vec at quadrature points.
101 void Values(const Vector &e_vec, Vector &q_val) const;
102
103 // Compute kernels follow (cannot be private or protected with nvcc)
104
105 /// Template compute kernel for 2D.
106 template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
107 static void Eval2D(const int NF,
108 const int vdim,
110 const DofToQuad &maps,
111 const Array<bool> &signs,
112 const Vector &e_vec,
113 Vector &q_val,
114 Vector &q_der,
115 Vector &q_det,
116 Vector &q_nor,
117 const int eval_flags);
118
119 /// Template compute kernel for 3D.
120 template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
121 static void Eval3D(const int NF,
122 const int vdim,
124 const DofToQuad &maps,
125 const Array<bool> &signs,
126 const Vector &e_vec,
127 Vector &q_val,
128 Vector &q_der,
129 Vector &q_det,
130 Vector &q_nor,
131 const int eval_flags);
132
133 template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
134 static void SmemEval3D(const int NF,
135 const int vdim,
137 const DofToQuad &maps,
138 const Array<bool> &signs,
139 const Vector &e_vec,
140 Vector &q_val,
141 Vector &q_der,
142 Vector &q_det,
143 Vector &q_nor,
144 const int eval_flags);
145};
146
147} // mfem namespace
148
149#endif // MFEM_QUADINTERPOLATOR_FACE
Structure representing the matrices/tensors needed to evaluate (in reference space) the values,...
Definition fe_base.hpp:141
A class that performs interpolation from a face E-vector to quadrature point values and/or derivative...
@ DERIVATIVES
Evaluate the derivatives at quadrature points.
@ DETERMINANTS
Assuming the derivative at quadrature points form a matrix, this flag can be used to compute and stor...
@ VALUES
Evaluate the values at quadrature points.
void Values(const Vector &e_vec, Vector &q_val) const
Interpolate the values of the E-vector e_vec at quadrature points.
const FiniteElementSpace * fespace
Not owned.
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes.
static void Eval3D(const int NF, const int vdim, const QVectorLayout q_layout, const DofToQuad &maps, const Array< bool > &signs, const Vector &e_vec, Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor, const int eval_flags)
Template compute kernel for 3D.
FaceQuadratureInterpolator(const FiniteElementSpace &fes, const IntegrationRule &ir, FaceType type)
QVectorLayout q_layout
Output Q-vector layout.
void SetOutputLayout(QVectorLayout layout) const
Set the desired output Q-vector layout. The default value is QVectorLayout::byNODES.
void Mult(const Vector &e_vec, unsigned eval_flags, Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor) const
Interpolate the E-vector e_vec to quadrature points.
QVectorLayout GetOutputLayout() const
Query the current output Q-vector layout. The default value is QVectorLayout::byNODES.
const IntegrationRule * IntRule
Not owned.
static bool SupportsFESpace(const FiniteElementSpace &fes)
Returns true if the given finite element space is supported by FaceQuadratureInterpolator.
static void SmemEval3D(const int NF, const int vdim, const QVectorLayout q_layout, const DofToQuad &maps, const Array< bool > &signs, const Vector &e_vec, Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor, const int eval_flags)
static void Eval2D(const int NF, const int vdim, const QVectorLayout q_layout, const DofToQuad &maps, const Array< bool > &signs, const Vector &e_vec, Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor, const int eval_flags)
Template compute kernel for 2D.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:208
Class for an integration rule - an Array of IntegrationPoint.
Definition intrules.hpp:100
Vector data type.
Definition vector.hpp:82
QVectorLayout
Type describing possible layouts for Q-vectors.
Definition fespace.hpp:31
FaceType
Definition mesh.hpp:49