1a8de75f0Sjeremylt /// @file 2*52bfb9bbSJeremy L Thompson /// Test square Gauss Lobatto interp1d is identity 3*52bfb9bbSJeremy L Thompson /// \test Test square Gauss Lobatto interp1d is identity 4a8de75f0Sjeremylt #include <ceed.h> 5*52bfb9bbSJeremy L Thompson #include <stdio.h> 6*52bfb9bbSJeremy L Thompson #include <math.h> 7a8de75f0Sjeremylt 8a8de75f0Sjeremylt int main(int argc, char **argv) { 9a8de75f0Sjeremylt Ceed ceed; 10a8de75f0Sjeremylt CeedBasis b; 11*52bfb9bbSJeremy L Thompson CeedVector U, V; 12*52bfb9bbSJeremy L Thompson int i, dim = 2, P1d = 4, Q1d = 4, len = (int)(pow((double)(Q1d), dim) + 0.4); 13*52bfb9bbSJeremy L Thompson CeedScalar u[len]; 14*52bfb9bbSJeremy L Thompson const CeedScalar *v; 15a8de75f0Sjeremylt 16a8de75f0Sjeremylt CeedInit(argv[1], &ceed); 17*52bfb9bbSJeremy L Thompson 18*52bfb9bbSJeremy L Thompson CeedVectorCreate(ceed, len, &U); 19*52bfb9bbSJeremy L Thompson CeedVectorCreate(ceed, len, &V); 20*52bfb9bbSJeremy L Thompson 21*52bfb9bbSJeremy L Thompson for (i = 0; i < len; i++) 22*52bfb9bbSJeremy L Thompson u[i] = 1.0; 23*52bfb9bbSJeremy L Thompson CeedVectorSetArray(U, CEED_MEM_HOST, CEED_USE_POINTER, u); 24*52bfb9bbSJeremy L Thompson 25*52bfb9bbSJeremy L Thompson CeedBasisCreateTensorH1Lagrange(ceed, dim, 1, P1d, Q1d, 26*52bfb9bbSJeremy L Thompson CEED_GAUSS_LOBATTO, &b); 27*52bfb9bbSJeremy L Thompson 28*52bfb9bbSJeremy L Thompson CeedBasisApply(b, 1, CEED_NOTRANSPOSE, CEED_EVAL_INTERP, U, V); 29*52bfb9bbSJeremy L Thompson 30*52bfb9bbSJeremy L Thompson CeedVectorGetArrayRead(V, CEED_MEM_HOST, &v); 31*52bfb9bbSJeremy L Thompson for (i = 0; i < len; i++) 32*52bfb9bbSJeremy L Thompson if (fabs(v[i] - 1.) > 1e-15) 33*52bfb9bbSJeremy L Thompson // LCOV_EXCL_START 34*52bfb9bbSJeremy L Thompson printf("v[%d] = %f != 1.\n", i, v[i]); 35*52bfb9bbSJeremy L Thompson // LCOV_EXCL_STOP 36*52bfb9bbSJeremy L Thompson CeedVectorRestoreArrayRead(V, &v); 37a8de75f0Sjeremylt 38a8de75f0Sjeremylt CeedBasisDestroy(&b); 39*52bfb9bbSJeremy L Thompson CeedVectorDestroy(&U); 40*52bfb9bbSJeremy L Thompson CeedVectorDestroy(&V); 41a8de75f0Sjeremylt CeedDestroy(&ceed); 42a8de75f0Sjeremylt return 0; 43a8de75f0Sjeremylt } 44