xref: /libCEED/tests/t319-basis.h (revision 706bf528b2ed1928aa5b7f1351e7e0b12042c20e)
1*706bf528SJames Wright // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2*706bf528SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*706bf528SJames Wright //
4*706bf528SJames Wright // SPDX-License-Identifier: BSD-2-Clause
5*706bf528SJames Wright //
6*706bf528SJames Wright // This file is part of CEED:  http://github.com/ceed
7*706bf528SJames Wright 
8*706bf528SJames Wright #include <ceed.h>
9*706bf528SJames Wright 
10*706bf528SJames Wright // Interpolation matrices for cell-to-face of Q1 hexahedral element onto it's "5" face (in PETSc)
11*706bf528SJames Wright // Nodes are at Gauss-Lobatto points and quadrature points are Gauss, all over [-1,1] domain range
12*706bf528SJames Wright const CeedScalar Q1_interp_gauss[4][8] = {
13*706bf528SJames Wright     {0.62200846792814612,  0, 0.16666666666666669,  0, 0.16666666666666669,  0, 0.044658198738520463, 0},
14*706bf528SJames Wright     {0.16666666666666669,  0, 0.62200846792814612,  0, 0.044658198738520463, 0, 0.16666666666666669,  0},
15*706bf528SJames Wright     {0.16666666666666669,  0, 0.044658198738520463, 0, 0.62200846792814612,  0, 0.16666666666666669,  0},
16*706bf528SJames Wright     {0.044658198738520463, 0, 0.16666666666666669,  0, 0.16666666666666669,  0, 0.62200846792814612,  0}
17*706bf528SJames Wright };
18*706bf528SJames Wright const CeedScalar Q1_grad_gauss[3][4][8] = {
19*706bf528SJames Wright     {{-0.31100423396407312, 0.31100423396407312, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
20*706bf528SJames Wright       -0.022329099369260232, 0.022329099369260232},
21*706bf528SJames Wright      {-0.083333333333333343, 0.083333333333333343, -0.31100423396407312, 0.31100423396407312, -0.022329099369260232, 0.022329099369260232,
22*706bf528SJames Wright       -0.083333333333333343, 0.083333333333333343},
23*706bf528SJames Wright      {-0.083333333333333343, 0.083333333333333343, -0.022329099369260232, 0.022329099369260232, -0.31100423396407312, 0.31100423396407312,
24*706bf528SJames Wright       -0.083333333333333343, 0.083333333333333343},
25*706bf528SJames Wright      {-0.022329099369260232, 0.022329099369260232, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
26*706bf528SJames Wright       -0.31100423396407312, 0.31100423396407312}                                                       },
27*706bf528SJames Wright     {{-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
28*706bf528SJames Wright      {-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
29*706bf528SJames Wright      {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0},
30*706bf528SJames Wright      {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0}},
31*706bf528SJames Wright     {{-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
32*706bf528SJames Wright      {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0},
33*706bf528SJames Wright      {-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
34*706bf528SJames Wright      {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0}}
35*706bf528SJames Wright };
36*706bf528SJames Wright 
37*706bf528SJames Wright const CeedScalar Q1_interp_gauss_lobatto[4][8] = {
38*706bf528SJames Wright     {1, 0, 0, 0, 0, 0, 0, 0},
39*706bf528SJames Wright     {0, 0, 1, 0, 0, 0, 0, 0},
40*706bf528SJames Wright     {0, 0, 0, 0, 1, 0, 0, 0},
41*706bf528SJames Wright     {0, 0, 0, 0, 0, 0, 1, 0}
42*706bf528SJames Wright };
43*706bf528SJames Wright /* clang-format off */
44*706bf528SJames Wright const CeedScalar Q1_grad_gauss_lobatto[3][4][8] = {
45*706bf528SJames Wright     {{-0.5,  0.5, 0,    0,   0,    0,   0,    0},
46*706bf528SJames Wright       {0,    0,   -0.5, 0.5, 0,    0,   0,    0},
47*706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0.5, 0,    0},
48*706bf528SJames Wright       {0,    0,   0,    0,   0,    0,   -0.5, 0.5}},
49*706bf528SJames Wright     {{-0.5,  0,   0.5,  0,   0,    0,   0,    0},
50*706bf528SJames Wright       {-0.5, 0,   0.5,  0,   0,    0,   0,    0},
51*706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0,   0.5,  0},
52*706bf528SJames Wright       {0,    0,   0,    0,   -0.5, 0,   0.5,  0}},
53*706bf528SJames Wright     {{-0.5,  0,   0,    0,   0.5,  0,   0,    0},
54*706bf528SJames Wright       {0,    0,   -0.5, 0,   0,    0,   0.5,  0},
55*706bf528SJames Wright       {-0.5, 0,   0,    0,   0.5,  0,   0,    0},
56*706bf528SJames Wright       {0,    0,   -0.5, 0,   0,    0,   0.5,  0}}
57*706bf528SJames Wright };
58*706bf528SJames Wright /* clang-format on */
59*706bf528SJames Wright 
60*706bf528SJames Wright static void GetCellToFaceTabulation(CeedQuadMode quad_mode, CeedInt *P, CeedInt *Q, const CeedScalar **interp, const CeedScalar **grad) {
61*706bf528SJames Wright   if (P) *P = 8;
62*706bf528SJames Wright   if (Q) *Q = 4;
63*706bf528SJames Wright 
64*706bf528SJames Wright   if (quad_mode == CEED_GAUSS) {
65*706bf528SJames Wright     *interp = (const CeedScalar *)Q1_interp_gauss;
66*706bf528SJames Wright     *grad   = (const CeedScalar *)Q1_grad_gauss;
67*706bf528SJames Wright   }
68*706bf528SJames Wright   if (quad_mode == CEED_GAUSS_LOBATTO) {
69*706bf528SJames Wright     *interp = (const CeedScalar *)Q1_interp_gauss_lobatto;
70*706bf528SJames Wright     *grad   = (const CeedScalar *)Q1_grad_gauss_lobatto;
71*706bf528SJames Wright   }
72*706bf528SJames Wright }
73