MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
eval_hdiv.cpp
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#include "eval_hdiv.hpp"
13
14namespace mfem
15{
16
17namespace internal
18{
19namespace quadrature_interpolator
20{
21
22void InitTensorEvalHDivKernels()
23{
24 using k = QuadratureInterpolator::TensorEvalHDivKernels;
25 constexpr auto LNODES = QVectorLayout::byNODES;
26 constexpr auto LVDIM = QVectorLayout::byVDIM;
29
30 // Do not instantiate FLAGS = QuadratureInterpolator::VALUES, for now.
31
32 // FLAGS = QuadratureInterpolator::PHYSICAL_VALUES:
33
34 // 2D, QVectorLayout::byNODES
35 k::Specialization<2,LNODES,PV,2,2>::Add(); // RT(0), 2^2 qpts
36 // 2D, QVectorLayout::byVDIM
37 k::Specialization<2,LVDIM, PV,2,2>::Add(); // RT(0), 2^2 qpts
38 k::Specialization<2,LVDIM, PV,3,3>::Add(); // RT(1), 3^2 qpts
39 k::Specialization<2,LVDIM, PV,4,4>::Add(); // RT(2), 4^2 qpts
40 k::Specialization<2,LVDIM, PV,5,5>::Add(); // RT(3), 5^2 qpts
41
42 // 3D, QVectorLayout::byNODES
43 k::Specialization<3,LNODES,PV,2,3>::Add(); // RT(0), 3^3 qpts
44 // 3D, QVectorLayout::byVDIM
45 k::Specialization<3,LVDIM, PV,2,3>::Add(); // RT(0), 3^3 qpts
46 k::Specialization<3,LVDIM, PV,3,4>::Add(); // RT(1), 4^3 qpts
47 k::Specialization<3,LVDIM, PV,4,5>::Add(); // RT(2), 5^3 qpts
48 k::Specialization<3,LVDIM, PV,5,6>::Add(); // RT(3), 6^3 qpts
49
50 // FLAGS = QuadratureInterpolator::PHYSICAL_MAGNITUDES:
51
52 // For vdim = 1: QVectorLayout::byNODES = QVectorLayout::byVDIM, so
53 // we use just QVectorLayout::byNODES:
54 // 2D
55 k::Specialization<2,LNODES,PM,2,2>::Add(); // RT(0), 2^2 qpts
56 k::Specialization<2,LNODES,PM,3,3>::Add(); // RT(1), 3^2 qpts
57 k::Specialization<2,LNODES,PM,4,4>::Add(); // RT(2), 4^2 qpts
58 k::Specialization<2,LNODES,PM,5,5>::Add(); // RT(3), 5^2 qpts
59
60 // 3D
61 k::Specialization<3,LNODES,PM,2,3>::Add(); // RT(0), 3^3 qpts
62 k::Specialization<3,LNODES,PM,3,4>::Add(); // RT(1), 4^3 qpts
63 k::Specialization<3,LNODES,PM,4,5>::Add(); // RT(2), 5^3 qpts
64 k::Specialization<3,LNODES,PM,5,6>::Add(); // RT(3), 6^3 qpts
65}
66
67} // namespace quadrature_interpolator
68} // namespace internal
69
70/// @cond Suppress_Doxygen_warnings
71
73QuadratureInterpolator::TensorEvalHDivKernels::Fallback(
74 int DIM, QVectorLayout Q_LAYOUT, unsigned FLAGS, int D1D, int Q1D)
75{
76 using namespace internal::quadrature_interpolator;
77 MFEM_CONTRACT_VAR(D1D);
78 MFEM_CONTRACT_VAR(Q1D);
79 constexpr auto RV = QuadratureInterpolator::VALUES;
82 if (DIM == 2)
83 {
84 if (FLAGS & RV)
85 {
86 return (Q_LAYOUT == QVectorLayout::byNODES) ?
87 EvalHDiv2D<QVectorLayout::byNODES,RV> :
88 EvalHDiv2D<QVectorLayout::byVDIM,RV>;
89 }
90 else if (FLAGS & PV)
91 {
92 return (Q_LAYOUT == QVectorLayout::byNODES) ?
93 EvalHDiv2D<QVectorLayout::byNODES,PV> :
94 EvalHDiv2D<QVectorLayout::byVDIM,PV>;
95 }
96 else
97 {
98 return EvalHDiv2D<QVectorLayout::byNODES,PM>;
99 }
100 }
101 else if (DIM == 3)
102 {
103 if (FLAGS & RV)
104 {
105 return (Q_LAYOUT == QVectorLayout::byNODES) ?
106 EvalHDiv3D<QVectorLayout::byNODES,RV> :
107 EvalHDiv3D<QVectorLayout::byVDIM,RV>;
108 }
109 else if (FLAGS & PV)
110 {
111 return (Q_LAYOUT == QVectorLayout::byNODES) ?
112 EvalHDiv3D<QVectorLayout::byNODES,PV> :
113 EvalHDiv3D<QVectorLayout::byVDIM,PV>;
114 }
115 else
116 {
117 return EvalHDiv3D<QVectorLayout::byNODES,PM>;
118 }
119 }
120 MFEM_ABORT("DIM = " << DIM << " is not implemented!");
121}
122
123/// @endcond
124
125} // namespace mfem
@ VALUES
Evaluate the values at quadrature points.
void(*)(const int, const real_t *, const real_t *, const real_t *, const real_t *, real_t *, const int, const int) TensorEvalHDivKernelType
constexpr int DIM
QVectorLayout
Type describing possible layouts for Q-vectors.
Definition fespace.hpp:53