MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
quadinterpolator_face.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2021, 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 
37  mutable bool use_tensor_products;
38 
39  static const int MAX_NQ1D = 10;
40  static const int MAX_ND1D = 10;
41  static const int MAX_VDIM1D = 1;
42 
43  static const int MAX_NQ2D = 100;
44  static const int MAX_ND2D = 100;
45  static const int MAX_VDIM2D = 2;
46 
47  static const int MAX_NQ3D = 1000;
48  static const int MAX_ND3D = 1000;
49  static const int MAX_VDIM3D = 3;
50 
51 public:
53  {
54  VALUES = 1 << 0, ///< Evaluate the values at quadrature points
55  DERIVATIVES = 1 << 1, ///< Evaluate the derivatives at quadrature points
56  /** @brief Assuming the derivative at quadrature points form a matrix,
57  this flag can be used to compute and store their determinants. This
58  flag can only be used in Mult(). */
59  DETERMINANTS = 1 << 2,
60  NORMALS = 1 << 3
61  };
62 
64  const IntegrationRule &ir, FaceType type);
65 
66  /** @brief Disable the use of tensor product evaluations, for tensor-product
67  elements, e.g. quads and hexes. */
68  /** Currently, tensor product evaluations are not implemented and this method
69  has no effect. */
70  void DisableTensorProducts(bool disable = true) const
71  { use_tensor_products = !disable; }
72 
73  /// Interpolate the E-vector @a e_vec to quadrature points.
74  /** The @a eval_flags are a bitwise mask of constants from the FaceEvalFlags
75  enumeration. When the VALUES flag is set, the values at quadrature points
76  are computed and stored in the Vector @a q_val. Similarly, when the flag
77  DERIVATIVES is set, the derivatives are computed and stored in @a q_der.
78  When the DETERMINANTS flags is set, it is assumed that the derivatives
79  form a matrix at each quadrature point (i.e. the associated
80  FiniteElementSpace is a vector space) and their determinants are computed
81  and stored in @a q_det. */
82  void Mult(const Vector &e_vec, unsigned eval_flags,
83  Vector &q_val, Vector &q_der, Vector &q_det, Vector &q_nor) const;
84 
85  /// Interpolate the values of the E-vector @a e_vec at quadrature points.
86  void Values(const Vector &e_vec, Vector &q_val) const;
87 
88  // Compute kernels follow (cannot be private or protected with nvcc)
89 
90  /// Template compute kernel for 2D.
91  template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
92  static void Eval2D(const int NF,
93  const int vdim,
94  const DofToQuad &maps,
95  const Array<bool> &signs,
96  const Vector &e_vec,
97  Vector &q_val,
98  Vector &q_der,
99  Vector &q_det,
100  Vector &q_nor,
101  const int eval_flags);
102 
103  /// Template compute kernel for 3D.
104  template<const int T_VDIM = 0, const int T_ND = 0, const int T_NQ = 0>
105  static void Eval3D(const int NF,
106  const int vdim,
107  const DofToQuad &maps,
108  const Array<bool> &signs,
109  const Vector &e_vec,
110  Vector &q_val,
111  Vector &q_der,
112  Vector &q_det,
113  Vector &q_nor,
114  const int eval_flags);
115 };
116 
117 } // mfem namespace
118 
119 #endif // MFEM_QUADINTERPOLATOR_FACE
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
static void Eval3D(const int NF, const int vdim, 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)
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...
void Values(const Vector &e_vec, Vector &q_val) const
Interpolate the values of the E-vector e_vec at quadrature points.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
Definition: fe.hpp:139
Evaluate the values at quadrature points.
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes...
static void Eval2D(const int NF, const int vdim, 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.
Evaluate the derivatives at quadrature points.
Vector data type.
Definition: vector.hpp:60
Assuming the derivative at quadrature points form a matrix, this flag can be used to compute and stor...
const FiniteElementSpace * fespace
Not owned.