xref: /libCEED/tests/t319-basis.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
2706bf528SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3706bf528SJames Wright //
4706bf528SJames Wright // SPDX-License-Identifier: BSD-2-Clause
5706bf528SJames Wright //
6706bf528SJames Wright // This file is part of CEED:  http://github.com/ceed
7706bf528SJames Wright 
8706bf528SJames Wright #include <ceed.h>
9706bf528SJames Wright 
10706bf528SJames Wright // Interpolation matrices for cell-to-face of Q1 hexahedral element onto it's "5" face (in PETSc)
11706bf528SJames Wright // Nodes are at Gauss-Lobatto points and quadrature points are Gauss, all over [-1,1] domain range
12706bf528SJames Wright const CeedScalar Q1_interp_gauss[4][8] = {
13706bf528SJames Wright     {0.62200846792814612,  0, 0.16666666666666669,  0, 0.16666666666666669,  0, 0.044658198738520463, 0},
14706bf528SJames Wright     {0.16666666666666669,  0, 0.62200846792814612,  0, 0.044658198738520463, 0, 0.16666666666666669,  0},
15706bf528SJames Wright     {0.16666666666666669,  0, 0.044658198738520463, 0, 0.62200846792814612,  0, 0.16666666666666669,  0},
16706bf528SJames Wright     {0.044658198738520463, 0, 0.16666666666666669,  0, 0.16666666666666669,  0, 0.62200846792814612,  0}
17706bf528SJames Wright };
18706bf528SJames Wright const CeedScalar Q1_grad_gauss[3][4][8] = {
19706bf528SJames Wright     {{-0.31100423396407312, 0.31100423396407312, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
20706bf528SJames Wright       -0.022329099369260232, 0.022329099369260232},
21706bf528SJames Wright      {-0.083333333333333343, 0.083333333333333343, -0.31100423396407312, 0.31100423396407312, -0.022329099369260232, 0.022329099369260232,
22706bf528SJames Wright       -0.083333333333333343, 0.083333333333333343},
23706bf528SJames Wright      {-0.083333333333333343, 0.083333333333333343, -0.022329099369260232, 0.022329099369260232, -0.31100423396407312, 0.31100423396407312,
24706bf528SJames Wright       -0.083333333333333343, 0.083333333333333343},
25706bf528SJames Wright      {-0.022329099369260232, 0.022329099369260232, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
26706bf528SJames Wright       -0.31100423396407312, 0.31100423396407312}                                                       },
27706bf528SJames Wright     {{-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
28706bf528SJames Wright      {-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
29706bf528SJames Wright      {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0},
30706bf528SJames Wright      {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0}},
31706bf528SJames Wright     {{-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
32706bf528SJames Wright      {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0},
33706bf528SJames Wright      {-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
34706bf528SJames Wright      {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0}}
35706bf528SJames Wright };
36706bf528SJames Wright 
37706bf528SJames Wright const CeedScalar Q1_interp_gauss_lobatto[4][8] = {
38706bf528SJames Wright     {1, 0, 0, 0, 0, 0, 0, 0},
39706bf528SJames Wright     {0, 0, 1, 0, 0, 0, 0, 0},
40706bf528SJames Wright     {0, 0, 0, 0, 1, 0, 0, 0},
41706bf528SJames Wright     {0, 0, 0, 0, 0, 0, 1, 0}
42706bf528SJames Wright };
43706bf528SJames Wright /* clang-format off */
44706bf528SJames Wright const CeedScalar Q1_grad_gauss_lobatto[3][4][8] = {
45706bf528SJames Wright     {{-0.5,  0.5, 0,    0,   0,    0,   0,    0},
46706bf528SJames Wright       {0,    0,   -0.5, 0.5, 0,    0,   0,    0},
47706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0.5, 0,    0},
48706bf528SJames Wright       {0,    0,   0,    0,   0,    0,   -0.5, 0.5}},
49706bf528SJames Wright     {{-0.5,  0,   0.5,  0,   0,    0,   0,    0},
50706bf528SJames Wright       {-0.5, 0,   0.5,  0,   0,    0,   0,    0},
51706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0,   0.5,  0},
52706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0,   0.5,  0}},
53706bf528SJames Wright     {{-0.5,  0,   0,    0,   0.5,  0,   0,    0},
54706bf528SJames Wright       {0,    0,   -0.5, 0,   0,    0,   0.5,  0},
55706bf528SJames Wright       {-0.5, 0,   0,    0,   0.5,  0,   0,    0},
56706bf528SJames Wright       {0,    0,   -0.5, 0,   0,    0,   0.5,  0}}
57706bf528SJames Wright };
58706bf528SJames Wright /* clang-format on */
59706bf528SJames Wright 
GetCellToFaceTabulation(CeedQuadMode quad_mode,CeedInt * P,CeedInt * Q,const CeedScalar ** interp,const CeedScalar ** grad)60706bf528SJames Wright static void GetCellToFaceTabulation(CeedQuadMode quad_mode, CeedInt *P, CeedInt *Q, const CeedScalar **interp, const CeedScalar **grad) {
61706bf528SJames Wright   if (P) *P = 8;
62706bf528SJames Wright   if (Q) *Q = 4;
63706bf528SJames Wright 
64706bf528SJames Wright   if (quad_mode == CEED_GAUSS) {
65706bf528SJames Wright     *interp = (const CeedScalar *)Q1_interp_gauss;
66706bf528SJames Wright     *grad   = (const CeedScalar *)Q1_grad_gauss;
67706bf528SJames Wright   }
68706bf528SJames Wright   if (quad_mode == CEED_GAUSS_LOBATTO) {
69706bf528SJames Wright     *interp = (const CeedScalar *)Q1_interp_gauss_lobatto;
70706bf528SJames Wright     *grad   = (const CeedScalar *)Q1_grad_gauss_lobatto;
71706bf528SJames Wright   }
72706bf528SJames Wright }
73