1 /// @file 2 /// Test creation and view of an element restriction at points 3 /// \test Test creation and view of an element restriction at points 4 #include <ceed.h> 5 6 int main(int argc, char **argv) { 7 Ceed ceed; 8 CeedInt num_elem = 3, num_points = num_elem * 2; 9 CeedInt ind[(num_elem + 1) + num_points]; 10 CeedElemRestriction elem_restriction; 11 12 CeedInit(argv[1], &ceed); 13 14 { 15 CeedInt offset = num_elem + 1; 16 CeedInt point_index = num_elem; 17 18 for (CeedInt i = 0; i < num_elem; i++) { 19 CeedInt num_points_in_elem = (i + 1) % num_elem + 1; 20 21 ind[i] = offset; 22 for (CeedInt j = 0; j < num_points_in_elem; j++) { 23 ind[offset + j] = point_index; 24 point_index = (point_index + 1) % num_points; 25 } 26 offset += num_points_in_elem; 27 } 28 ind[num_elem] = offset; 29 } 30 CeedElemRestrictionCreateAtPoints(ceed, num_elem, num_points, 1, num_points, CEED_MEM_HOST, CEED_USE_POINTER, ind, &elem_restriction); 31 32 CeedElemRestrictionView(elem_restriction, stdout); 33 34 CeedElemRestrictionDestroy(&elem_restriction); 35 CeedDestroy(&ceed); 36 return 0; 37 } 38