1 /// @file 2 /// Test calculation of dof multiplicity in element restriction 3 /// \test Test calculation of dof multiplicity in element restriction 4 #include <ceed.h> 5 6 int main(int argc, char **argv) { 7 Ceed ceed; 8 CeedVector mult; 9 CeedInt num_elem = 3; 10 CeedInt ind[4 * num_elem]; 11 CeedElemRestriction elem_restriction; 12 13 CeedInit(argv[1], &ceed); 14 15 CeedVectorCreate(ceed, 3 * num_elem + 1, &mult); 16 17 for (CeedInt i = 0; i < num_elem; i++) { 18 ind[4 * i + 0] = i * 3 + 0; 19 ind[4 * i + 1] = i * 3 + 1; 20 ind[4 * i + 2] = i * 3 + 2; 21 ind[4 * i + 3] = i * 3 + 3; 22 } 23 CeedElemRestrictionCreate(ceed, num_elem, 4, 1, 1, 3 * num_elem + 1, CEED_MEM_HOST, CEED_USE_POINTER, ind, &elem_restriction); 24 25 CeedElemRestrictionGetMultiplicity(elem_restriction, mult); 26 { 27 const CeedScalar *mult_array; 28 29 CeedVectorGetArrayRead(mult, CEED_MEM_HOST, &mult_array); 30 for (CeedInt i = 0; i < 3 * num_elem + 1; i++) { 31 if (mult_array[i] != (1 + (i > 0 && i < 3 * num_elem && (i % 3 == 0) ? 1 : 0))) { 32 // LCOV_EXCL_START 33 printf("Error in multiplicity vector: mult[%" CeedInt_FMT "] = %f\n", i, (CeedScalar)mult_array[i]); 34 // LCOV_EXCL_STOP 35 } 36 } 37 CeedVectorRestoreArrayRead(mult, &mult_array); 38 } 39 40 CeedVectorDestroy(&mult); 41 CeedElemRestrictionDestroy(&elem_restriction); 42 CeedDestroy(&ceed); 43 return 0; 44 } 45