MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
grad_by_vdim.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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 "dispatch.hpp"
13 #include "grad.hpp"
14 
15 namespace mfem
16 {
17 
18 namespace internal
19 {
20 
21 namespace quadrature_interpolator
22 {
23 
24 // Tensor-product evaluation of quadrature point derivatives: dispatch function.
25 // Instantiation for the case QVectorLayout::byVDIM.
26 template<>
27 void TensorDerivatives<QVectorLayout::byVDIM>(const int NE,
28  const int vdim,
29  const DofToQuad &maps,
30  const Vector &e_vec,
31  Vector &q_der)
32 {
33  if (NE == 0) { return; }
34  const int dim = maps.FE->GetDim();
35  const int D1D = maps.ndof;
36  const int Q1D = maps.nqpt;
37  const double *B = maps.B.Read();
38  const double *G = maps.G.Read();
39  const double *J = nullptr; // not used in DERIVATIVES (non-GRAD_PHYS) mode
40  const double *X = e_vec.Read();
41  double *Y = q_der.Write();
42 
44  constexpr bool P = false; // GRAD_PHYS
45 
46  const int id = (vdim<<8) | (D1D<<4) | Q1D;
47 
48  if (dim == 2)
49  {
50  switch (id)
51  {
52  case 0x134: return Derivatives2D<L,P,1,3,4,8>(NE,B,G,J,X,Y);
53  case 0x146: return Derivatives2D<L,P,1,4,6,4>(NE,B,G,J,X,Y);
54  case 0x158: return Derivatives2D<L,P,1,5,8,2>(NE,B,G,J,X,Y);
55 
56  case 0x234: return Derivatives2D<L,P,2,3,4,8>(NE,B,G,J,X,Y);
57  case 0x246: return Derivatives2D<L,P,2,4,6,4>(NE,B,G,J,X,Y);
58  case 0x258: return Derivatives2D<L,P,2,5,8,2>(NE,B,G,J,X,Y);
59  default:
60  {
61  constexpr int MD = MAX_D1D;
62  constexpr int MQ = MAX_Q1D;
63  MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
64  << " are not supported!");
65  MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
66  << MQ << " 1D points are not supported!");
67  Derivatives2D<L,P,0,0,0,0,MD,MQ>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
68  return;
69  }
70  }
71  }
72  if (dim == 3)
73  {
74  switch (id)
75  {
76  case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
77  case 0x146: return Derivatives3D<L,P,1,4,6>(NE,B,G,J,X,Y);
78  case 0x158: return Derivatives3D<L,P,1,5,8>(NE,B,G,J,X,Y);
79 
80  case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
81  case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
82  case 0x358: return Derivatives3D<L,P,3,5,8>(NE,B,G,J,X,Y);
83  default:
84  {
85  constexpr int MD = 8;
86  constexpr int MQ = 8;
87  MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
88  << " are not supported!");
89  MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
90  << MQ << " 1D points are not supported!");
91  Derivatives3D<L,P,0,0,0,MD,MQ>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
92  return;
93  }
94  }
95  }
96  mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
97  MFEM_ABORT("Kernel not supported yet");
98 }
99 
100 } // namespace quadrature_interpolator
101 
102 } // namespace internal
103 
104 } // namespace mfem
const int MAX_Q1D
Definition: forall.hpp:29
QVectorLayout
Type describing possible layouts for Q-vectors.
Definition: fespace.hpp:52
int dim
Definition: ex24.cpp:53
const int MAX_D1D
Definition: forall.hpp:28
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Definition: globals.hpp:66
VDIM x NQPT x NE (values) / VDIM x DIM x NQPT x NE (grads)