MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eval_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 "../quadinterpolator.hpp"
13 #include "dispatch.hpp"
14 #include "eval.hpp"
15 
16 namespace mfem
17 {
18 
19 namespace internal
20 {
21 
22 namespace quadrature_interpolator
23 {
24 
25 // Tensor-product evaluation of quadrature point values: dispatch function.
26 // Instantiation for the case QVectorLayout::byVDIM.
27 template<>
28 void TensorValues<QVectorLayout::byVDIM>(const int NE,
29  const int vdim,
30  const DofToQuad &maps,
31  const Vector &e_vec,
32  Vector &q_val)
33 {
34  if (NE == 0) { return; }
35  const int dim = maps.FE->GetDim();
36  const int D1D = maps.ndof;
37  const int Q1D = maps.nqpt;
38  const double *B = maps.B.Read();
39  const double *X = e_vec.Read();
40  double *Y = q_val.Write();
41 
43 
44  const int id = (vdim<<8) | (D1D<<4) | Q1D;
45 
46  if (dim == 1)
47  {
48  MFEM_VERIFY(D1D <= MAX_D1D, "Orders higher than " << MAX_D1D-1
49  << " are not supported!");
50  MFEM_VERIFY(Q1D <= MAX_Q1D, "Quadrature rules with more than "
51  << MAX_Q1D << " 1D points are not supported!");
52  Values1D<L>(NE, B, X, Y, vdim, D1D, Q1D);
53  return;
54  }
55  if (dim == 2)
56  {
57  switch (id)
58  {
59  case 0x124: return Values2D<L,1,2,4,8>(NE,B,X,Y);
60  case 0x136: return Values2D<L,1,3,6,4>(NE,B,X,Y);
61  case 0x148: return Values2D<L,1,4,8,2>(NE,B,X,Y);
62 
63  case 0x224: return Values2D<L,2,2,4,8>(NE,B,X,Y);
64  case 0x234: return Values2D<L,2,3,4,8>(NE,B,X,Y);
65  case 0x236: return Values2D<L,2,3,6,4>(NE,B,X,Y);
66  case 0x248: return Values2D<L,2,4,8,2>(NE,B,X,Y);
67 
68  default:
69  {
70  constexpr int MD = MAX_D1D;
71  constexpr int MQ = MAX_Q1D;
72  MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
73  << " are not supported!");
74  MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
75  << MQ << " 1D points are not supported!");
76  Values2D<L,0,0,0,0,MD,MQ>(NE,B,X,Y,vdim,D1D,Q1D);
77  return;
78  }
79  }
80  }
81  if (dim == 3)
82  {
83  switch (id)
84  {
85  case 0x124: return Values3D<L,1,2,4>(NE,B,X,Y);
86  case 0x136: return Values3D<L,1,3,6>(NE,B,X,Y);
87  case 0x148: return Values3D<L,1,4,8>(NE,B,X,Y);
88 
89  case 0x324: return Values3D<L,3,2,4>(NE,B,X,Y);
90  case 0x336: return Values3D<L,3,3,6>(NE,B,X,Y);
91  case 0x348: return Values3D<L,3,4,8>(NE,B,X,Y);
92 
93  // Used for LOR batched assembly
94  case 0x322: return Values3D<L,3,2,2>(NE,B,X,Y);
95  case 0x333: return Values3D<L,3,3,3>(NE,B,X,Y);
96  case 0x344: return Values3D<L,3,4,4>(NE,B,X,Y);
97  case 0x355: return Values3D<L,3,5,5>(NE,B,X,Y);
98  case 0x366: return Values3D<L,3,6,6>(NE,B,X,Y);
99  case 0x377: return Values3D<L,3,7,7>(NE,B,X,Y);
100  case 0x388: return Values3D<L,3,8,8>(NE,B,X,Y);
101  case 0x399: return Values3D<L,3,9,9>(NE,B,X,Y);
102 
103  default:
104  {
105  constexpr int MD = 8;
106  constexpr int MQ = 8;
107  MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
108  << " are not supported!");
109  MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
110  << MQ << " 1D points are not supported!");
111  Values3D<L,0,0,0,MD,MQ>(NE,B,X,Y,vdim,D1D,Q1D);
112  return;
113  }
114  }
115  }
116  mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
117  MFEM_ABORT("Kernel not supported yet");
118 }
119 
120 } // namespace quadrature_interpolator
121 
122 } // namespace internal
123 
124 } // 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)