xref: /libCEED/tests/t320-basis.h (revision 52bfb9bbf17f17edbcd45876cdc8689a879bc683)
1*52bfb9bbSJeremy L Thompson static void buildmats(CeedScalar *qref, CeedScalar *qweight, CeedScalar *interp,
2*52bfb9bbSJeremy L Thompson                       CeedScalar *grad) {
3*52bfb9bbSJeremy L Thompson   CeedInt P = 6, Q = 4;
4*52bfb9bbSJeremy L Thompson 
5*52bfb9bbSJeremy L Thompson   qref[0] = 0.2;
6*52bfb9bbSJeremy L Thompson   qref[1] = 0.6;
7*52bfb9bbSJeremy L Thompson   qref[2] = 1./3.;
8*52bfb9bbSJeremy L Thompson   qref[3] = 0.2;
9*52bfb9bbSJeremy L Thompson   qref[4] = 0.2;
10*52bfb9bbSJeremy L Thompson   qref[5] = 0.2;
11*52bfb9bbSJeremy L Thompson   qref[6] = 1./3.;
12*52bfb9bbSJeremy L Thompson   qref[7] = 0.6;
13*52bfb9bbSJeremy L Thompson   qweight[0] = 25./96.;
14*52bfb9bbSJeremy L Thompson   qweight[1] = 25./96.;
15*52bfb9bbSJeremy L Thompson   qweight[2] = -27./96.;
16*52bfb9bbSJeremy L Thompson   qweight[3] = 25./96.;
17*52bfb9bbSJeremy L Thompson 
18*52bfb9bbSJeremy L Thompson   // Loop over quadrature points
19*52bfb9bbSJeremy L Thompson   for (int i=0; i<Q; i++) {
20*52bfb9bbSJeremy L Thompson     CeedScalar x1 = qref[0*Q+i], x2 = qref[1*Q+i];
21*52bfb9bbSJeremy L Thompson     // Interp
22*52bfb9bbSJeremy L Thompson     interp[i*P+0] =  2.*(x1+x2-1.)*(x1+x2-1./2.);
23*52bfb9bbSJeremy L Thompson     interp[i*P+1] = -4.*x1*(x1+x2-1.);
24*52bfb9bbSJeremy L Thompson     interp[i*P+2] =  2.*x1*(x1-1./2.);
25*52bfb9bbSJeremy L Thompson     interp[i*P+3] = -4.*x2*(x1+x2-1.);
26*52bfb9bbSJeremy L Thompson     interp[i*P+4] =  4.*x1*x2;
27*52bfb9bbSJeremy L Thompson     interp[i*P+5] =  2.*x2*(x2-1./2.);
28*52bfb9bbSJeremy L Thompson     // Grad
29*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+0] =  2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
30*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+0] =  2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
31*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+1] = -4.*(1.*(x1+x2-1.)+x1*1.);
32*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+1] = -4.*(x1*1.);
33*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+2] =  2.*(1.*(x1-1./2.)+x1*1.);
34*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+2] =  2.*0.;
35*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+3] = -4.*(x2*1.);
36*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+3] = -4.*(1.*(x1+x2-1.)+x2*1.);
37*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+4] =  4.*(1.*x2);
38*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+4] =  4.*(x1*1.);
39*52bfb9bbSJeremy L Thompson     grad[(i+0)*P+5] =  2.*0.;
40*52bfb9bbSJeremy L Thompson     grad[(i+Q)*P+5] =  2.*(1.*(x2-1./2.)+x2*1.);
41*52bfb9bbSJeremy L Thompson   }
42*52bfb9bbSJeremy L Thompson }
43