xref: /libCEED/tests/t210-elemrestriction.c (revision be3958531954aa94a1b1db4aa6e1a06adbd54dac)
1 /// @file
2 /// Test creation and view of an element restriction
3 /// \test Test creation and view of an element restriction
4 #include <ceed.h>
5 
6 int main(int argc, char **argv) {
7   Ceed                ceed;
8   CeedInt             num_elem = 3;
9   CeedInt             ind[2 * num_elem];
10   CeedElemRestriction elem_restriction;
11 
12   CeedInit(argv[1], &ceed);
13 
14   for (CeedInt i = 0; i < num_elem; i++) {
15     ind[2 * i + 0] = i;
16     ind[2 * i + 1] = i + 1;
17   }
18   CeedElemRestrictionCreate(ceed, num_elem, 2, 1, 1, num_elem + 1, CEED_MEM_HOST, CEED_USE_POINTER, ind, &elem_restriction);
19 
20   CeedElemRestrictionView(elem_restriction, stdout);
21 
22   // Check tabs and CeedObject functionality
23   {
24     CeedElemRestriction elem_restriction_copy = NULL;
25 
26     CeedElemRestrictionReferenceCopy(elem_restriction, &elem_restriction_copy);
27     CeedElemRestrictionSetNumViewTabs(elem_restriction_copy, 1);
28     CeedObjectView((CeedObject)elem_restriction_copy, stdout);
29     CeedObjectDestroy((CeedObject *)&elem_restriction_copy);
30   }
31 
32   CeedElemRestrictionDestroy(&elem_restriction);
33   CeedDestroy(&ceed);
34   return 0;
35 }
36