xref: /libCEED/tests/t320-basis.h (revision 3091a1ca78f200bc31ad6896b5e7e73163ef6550)
1*3091a1caSvaleriabarra // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*3091a1caSvaleriabarra // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*3091a1caSvaleriabarra // All Rights reserved. See files LICENSE and NOTICE for details.
4*3091a1caSvaleriabarra //
5*3091a1caSvaleriabarra // This file is part of CEED, a collection of benchmarks, miniapps, software
6*3091a1caSvaleriabarra // libraries and APIs for efficient high-order finite element and spectral
7*3091a1caSvaleriabarra // element discretizations for exascale applications. For more information and
8*3091a1caSvaleriabarra // source code availability see http://github.com/ceed.
9*3091a1caSvaleriabarra //
10*3091a1caSvaleriabarra // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*3091a1caSvaleriabarra // a collaborative effort of two U.S. Department of Energy organizations (Office
12*3091a1caSvaleriabarra // of Science and the National Nuclear Security Administration) responsible for
13*3091a1caSvaleriabarra // the planning and preparation of a capable exascale ecosystem, including
14*3091a1caSvaleriabarra // software, applications, hardware, advanced system engineering and early
15*3091a1caSvaleriabarra // testbed platforms, in support of the nation's exascale computing imperative.
16*3091a1caSvaleriabarra 
1752bfb9bbSJeremy L Thompson static void buildmats(CeedScalar *qref, CeedScalar *qweight, CeedScalar *interp,
1852bfb9bbSJeremy L Thompson                       CeedScalar *grad) {
1952bfb9bbSJeremy L Thompson   CeedInt P = 6, Q = 4;
2052bfb9bbSJeremy L Thompson 
2152bfb9bbSJeremy L Thompson   qref[0] = 0.2;
2252bfb9bbSJeremy L Thompson   qref[1] = 0.6;
2352bfb9bbSJeremy L Thompson   qref[2] = 1./3.;
2452bfb9bbSJeremy L Thompson   qref[3] = 0.2;
2552bfb9bbSJeremy L Thompson   qref[4] = 0.2;
2652bfb9bbSJeremy L Thompson   qref[5] = 0.2;
2752bfb9bbSJeremy L Thompson   qref[6] = 1./3.;
2852bfb9bbSJeremy L Thompson   qref[7] = 0.6;
2952bfb9bbSJeremy L Thompson   qweight[0] = 25./96.;
3052bfb9bbSJeremy L Thompson   qweight[1] = 25./96.;
3152bfb9bbSJeremy L Thompson   qweight[2] = -27./96.;
3252bfb9bbSJeremy L Thompson   qweight[3] = 25./96.;
3352bfb9bbSJeremy L Thompson 
3452bfb9bbSJeremy L Thompson   // Loop over quadrature points
3552bfb9bbSJeremy L Thompson   for (int i=0; i<Q; i++) {
3652bfb9bbSJeremy L Thompson     CeedScalar x1 = qref[0*Q+i], x2 = qref[1*Q+i];
3752bfb9bbSJeremy L Thompson     // Interp
3852bfb9bbSJeremy L Thompson     interp[i*P+0] =  2.*(x1+x2-1.)*(x1+x2-1./2.);
3952bfb9bbSJeremy L Thompson     interp[i*P+1] = -4.*x1*(x1+x2-1.);
4052bfb9bbSJeremy L Thompson     interp[i*P+2] =  2.*x1*(x1-1./2.);
4152bfb9bbSJeremy L Thompson     interp[i*P+3] = -4.*x2*(x1+x2-1.);
4252bfb9bbSJeremy L Thompson     interp[i*P+4] =  4.*x1*x2;
4352bfb9bbSJeremy L Thompson     interp[i*P+5] =  2.*x2*(x2-1./2.);
4452bfb9bbSJeremy L Thompson     // Grad
4552bfb9bbSJeremy L Thompson     grad[(i+0)*P+0] =  2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
4652bfb9bbSJeremy L Thompson     grad[(i+Q)*P+0] =  2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
4752bfb9bbSJeremy L Thompson     grad[(i+0)*P+1] = -4.*(1.*(x1+x2-1.)+x1*1.);
4852bfb9bbSJeremy L Thompson     grad[(i+Q)*P+1] = -4.*(x1*1.);
4952bfb9bbSJeremy L Thompson     grad[(i+0)*P+2] =  2.*(1.*(x1-1./2.)+x1*1.);
5052bfb9bbSJeremy L Thompson     grad[(i+Q)*P+2] =  2.*0.;
5152bfb9bbSJeremy L Thompson     grad[(i+0)*P+3] = -4.*(x2*1.);
5252bfb9bbSJeremy L Thompson     grad[(i+Q)*P+3] = -4.*(1.*(x1+x2-1.)+x2*1.);
5352bfb9bbSJeremy L Thompson     grad[(i+0)*P+4] =  4.*(1.*x2);
5452bfb9bbSJeremy L Thompson     grad[(i+Q)*P+4] =  4.*(x1*1.);
5552bfb9bbSJeremy L Thompson     grad[(i+0)*P+5] =  2.*0.;
5652bfb9bbSJeremy L Thompson     grad[(i+Q)*P+5] =  2.*(1.*(x2-1./2.)+x2*1.);
5752bfb9bbSJeremy L Thompson   }
5852bfb9bbSJeremy L Thompson }
59