MFEM  v4.6.0
Finite element discretization library
quadinterpolator_face.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, 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 
17 namespace 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 {
27 private:
28  FaceType type;
29  int nf;
30  Array<bool> signs;
31 protected:
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 
52 public:
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 Disable the use of tensor product evaluations, for tensor-product
68  elements, e.g. quads and hexes. */
69  /** Currently, tensor product evaluations are not implemented and this method
70  has no effect. */
71  void DisableTensorProducts(bool disable = true) const
72  { use_tensor_products = !disable; }
73 
74  /** @brief Query the current output Q-vector layout. The default value is
75  QVectorLayout::byNODES. */
76  /** @sa SetOutputLayout(). */
78 
79  /** @brief Set the desired output Q-vector layout. The default value is
80  QVectorLayout::byNODES. */
81  /** @sa GetOutputLayout(). */
82  void SetOutputLayout(QVectorLayout layout) const { q_layout = layout; }
83 
84  /// Interpolate the E-vector @a e_vec to quadrature points.
85  /** The @a eval_flags are a bitwise mask of constants from the FaceEvalFlags
86  enumeration. When the VALUES flag is set, the values at quadrature points
87  are computed and stored in the Vector @a q_val. Similarly, when the flag
88  DERIVATIVES is set, the derivatives are computed and stored in @a q_der.
89  When the DETERMINANTS flags is set, it is assumed that the derivatives
90  form a matrix at each quadrature point (i.e. the associated
91  FiniteElementSpace is a vector space) and their determinants are computed
92  and stored in @a q_det. */
93  void Mult(const Vector &e_vec, unsigned eval_flags,
94  Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor) const;
95 
96  /// Interpolate the values of the E-vector @a e_vec at quadrature points.
97  void Values(const Vector &e_vec, Vector &q_val) const;
98 
99  // Compute kernels follow (cannot be private or protected with nvcc)
100 
101  /// Template compute kernel for 2D.
102  template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
103  static void Eval2D(const int NF,
104  const int vdim,
105  const QVectorLayout q_layout,
106  const DofToQuad &maps,
107  const Array<bool> &signs,
108  const Vector &e_vec,
109  Vector &q_val,
110  Vector &q_der,
111  Vector &q_det,
112  Vector &q_nor,
113  const int eval_flags);
114 
115  /// Template compute kernel for 3D.
116  template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
117  static void Eval3D(const int NF,
118  const int vdim,
119  const QVectorLayout q_layout,
120  const DofToQuad &maps,
121  const Array<bool> &signs,
122  const Vector &e_vec,
123  Vector &q_val,
124  Vector &q_der,
125  Vector &q_det,
126  Vector &q_nor,
127  const int eval_flags);
128 
129  template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
130  static void SmemEval3D(const int NF,
131  const int vdim,
132  const QVectorLayout q_layout,
133  const DofToQuad &maps,
134  const Array<bool> &signs,
135  const Vector &e_vec,
136  Vector &q_val,
137  Vector &q_der,
138  Vector &q_det,
139  Vector &q_nor,
140  const int eval_flags);
141 };
142 
143 } // mfem namespace
144 
145 #endif // MFEM_QUADINTERPOLATOR_FACE
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 for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:96
QVectorLayout GetOutputLayout() const
Query the current output Q-vector layout. The default value is QVectorLayout::byNODES.
FaceQuadratureInterpolator(const FiniteElementSpace &fes, const IntegrationRule &ir, FaceType type)
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes...
const IntegrationRule * IntRule
Not owned.
FaceType
Definition: mesh.hpp:45
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.
A class that performs interpolation from a face E-vector to quadrature point values and/or derivative...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:219
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)
void Values(const Vector &e_vec, Vector &q_val) const
Interpolate the values of the E-vector e_vec at quadrature points.
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
Definition: fe_base.hpp:136
Evaluate the values at quadrature points.
QVectorLayout
Type describing possible layouts for Q-vectors.
Definition: fespace.hpp:52
void SetOutputLayout(QVectorLayout layout) const
Set the desired output Q-vector layout. The default value is QVectorLayout::byNODES.
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.
Evaluate the derivatives at quadrature points.
Vector data type.
Definition: vector.hpp:58
Assuming the derivative at quadrature points form a matrix, this flag can be used to compute and stor...
const FiniteElementSpace * fespace
Not owned.
QVectorLayout q_layout
Output Q-vector layout.