MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
grad_phys_by_nodes.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
15namespace mfem
16{
17
18namespace internal
19{
20
21namespace quadrature_interpolator
22{
23
24// Tensor-product evaluation of quadrature point physical derivatives: dispatch
25// function.
26// Instantiation for the case QVectorLayout::byNODES.
27template<>
28void TensorPhysDerivatives<QVectorLayout::byNODES>(const int NE,
29 const int vdim,
30 const DofToQuad &maps,
31 const GeometricFactors &geom,
32 const Vector &e_vec,
33 Vector &q_der)
34{
35 if (NE == 0) { return; }
36 const int dim = maps.FE->GetDim();
37 const int D1D = maps.ndof;
38 const int Q1D = maps.nqpt;
39
40 const int sdim = geom.mesh->SpaceDimension();
41
42 const real_t *B = maps.B.Read();
43 const real_t *G = maps.G.Read();
44 const real_t *J = geom.J.Read();
45 const real_t *X = e_vec.Read();
46 real_t *Y = q_der.Write();
47
49 constexpr bool P = true; // GRAD_PHYS
50
51 const int id = (vdim<<8) | (D1D<<4) | Q1D;
52
53 if (dim == 1)
54 {
55 return Derivatives1D<L,P>(NE,G,J,X,Y,sdim,vdim,D1D,Q1D);
56 }
57 if (dim == 2)
58 {
59 switch (id)
60 {
61 case 0x133: return Derivatives2D<L,P,1,3,3,8>(NE,B,G,J,X,Y,sdim);
62 case 0x134: return Derivatives2D<L,P,1,3,4,8>(NE,B,G,J,X,Y,sdim);
63 case 0x143: return Derivatives2D<L,P,1,4,3,4>(NE,B,G,J,X,Y,sdim);
64 case 0x144: return Derivatives2D<L,P,1,4,4,4>(NE,B,G,J,X,Y,sdim);
65 case 0x146: return Derivatives2D<L,P,1,4,6,4>(NE,B,G,J,X,Y,sdim);
66 case 0x158: return Derivatives2D<L,P,1,5,8,2>(NE,B,G,J,X,Y,sdim);
67
68 case 0x233: return Derivatives2D<L,P,2,3,3,8>(NE,B,G,J,X,Y,sdim);
69 case 0x234: return Derivatives2D<L,P,2,3,4,8>(NE,B,G,J,X,Y,sdim);
70 case 0x243: return Derivatives2D<L,P,2,4,3,4>(NE,B,G,J,X,Y,sdim);
71 case 0x244: return Derivatives2D<L,P,2,4,4,4>(NE,B,G,J,X,Y,sdim);
72 case 0x246: return Derivatives2D<L,P,2,4,6,4>(NE,B,G,J,X,Y,sdim);
73 case 0x258: return Derivatives2D<L,P,2,5,8,2>(NE,B,G,J,X,Y,sdim);
74 default:
75 {
76 const int MD = DeviceDofQuadLimits::Get().MAX_D1D;
77 const int MQ = DeviceDofQuadLimits::Get().MAX_Q1D;
78 MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
79 << " are not supported!");
80 MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
81 << MQ << " 1D points are not supported!");
82 Derivatives2D<L,P>(NE,B,G,J,X,Y,sdim,vdim,D1D,Q1D);
83 return;
84 }
85 }
86 }
87 if (dim == 3)
88 {
89 switch (id)
90 {
91 case 0x133: return Derivatives3D<L,P,1,3,3>(NE,B,G,J,X,Y);
92 case 0x134: return Derivatives3D<L,P,1,3,4>(NE,B,G,J,X,Y);
93 case 0x144: return Derivatives3D<L,P,1,4,4>(NE,B,G,J,X,Y);
94 case 0x146: return Derivatives3D<L,P,1,4,6>(NE,B,G,J,X,Y);
95 case 0x158: return Derivatives3D<L,P,1,5,8>(NE,B,G,J,X,Y);
96
97 case 0x333: return Derivatives3D<L,P,3,3,3>(NE,B,G,J,X,Y);
98 case 0x334: return Derivatives3D<L,P,3,3,4>(NE,B,G,J,X,Y);
99 case 0x344: return Derivatives3D<L,P,3,4,4>(NE,B,G,J,X,Y);
100 case 0x346: return Derivatives3D<L,P,3,4,6>(NE,B,G,J,X,Y);
101 case 0x358: return Derivatives3D<L,P,3,5,8>(NE,B,G,J,X,Y);
102 default:
103 {
106 MFEM_VERIFY(D1D <= MD, "Orders higher than " << MD-1
107 << " are not supported!");
108 MFEM_VERIFY(Q1D <= MQ, "Quadrature rules with more than "
109 << MQ << " 1D points are not supported!");
110 Derivatives3D<L,P>(NE,B,G,J,X,Y,vdim,D1D,Q1D);
111 return;
112 }
113 }
114 }
115 mfem::out << "Unknown kernel 0x" << std::hex << id << std::endl;
116 MFEM_ABORT("Unknown kernel");
117}
118
119} // namespace quadrature_interpolator
120
121} // namespace internal
122
123} // namespace mfem
int dim
Definition ex24.cpp:53
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
QVectorLayout
Type describing possible layouts for Q-vectors.
Definition fespace.hpp:53
@ byNODES
NQPT x VDIM x NE (values) / NQPT x VDIM x DIM x NE (grads)
float real_t
Definition config.hpp:43
static const DeviceDofQuadLimits & Get()
Return a const reference to the DeviceDofQuadLimits singleton.
Definition forall.hpp:125
int MAX_INTERP_1D
Maximum number of points for use in QuadratureInterpolator.
Definition forall.hpp:121
int MAX_D1D
Maximum number of 1D nodal points.
Definition forall.hpp:115
int MAX_Q1D
Maximum number of 1D quadrature points.
Definition forall.hpp:116