xref: /libCEED/tests/t215-elemrestriction.c (revision 684f49355e356904c2a47c5a7e5ff618ae05b0a6)
1430758c8SJeremy L Thompson /// @file
2430758c8SJeremy L Thompson /// Test element restriction state counter
3430758c8SJeremy L Thompson /// \test Test element restriction state counter
4ec3da8bcSJed Brown #include <ceed/backend.h>
5430758c8SJeremy L Thompson 
main(int argc,char ** argv)6430758c8SJeremy L Thompson int main(int argc, char **argv) {
7430758c8SJeremy L Thompson   Ceed                ceed;
8d1d35e2fSjeremylt   CeedInt             num_elem = 3;
9d1d35e2fSjeremylt   CeedInt             ind[2 * num_elem];
10430758c8SJeremy L Thompson   const CeedInt      *offsets;
11*4fee36f0SJeremy L Thompson   CeedElemRestriction elem_restriction;
12430758c8SJeremy L Thompson 
13430758c8SJeremy L Thompson   CeedInit(argv[1], &ceed);
14430758c8SJeremy L Thompson 
15d1d35e2fSjeremylt   for (CeedInt i = 0; i < num_elem; i++) {
16430758c8SJeremy L Thompson     ind[2 * i + 0] = i;
17430758c8SJeremy L Thompson     ind[2 * i + 1] = i + 1;
18430758c8SJeremy L Thompson   }
19*4fee36f0SJeremy L Thompson   CeedElemRestrictionCreate(ceed, num_elem, 2, 1, 1, num_elem + 1, CEED_MEM_HOST, CEED_USE_POINTER, ind, &elem_restriction);
20430758c8SJeremy L Thompson 
21430758c8SJeremy L Thompson   // Get offsets and fail to restore them
22*4fee36f0SJeremy L Thompson   CeedElemRestrictionGetOffsets(elem_restriction, CEED_MEM_HOST, &offsets);
23430758c8SJeremy L Thompson 
24*4fee36f0SJeremy L Thompson   CeedElemRestrictionDestroy(&elem_restriction);
25430758c8SJeremy L Thompson   // LCOV_EXCL_START
26430758c8SJeremy L Thompson   CeedDestroy(&ceed);
27430758c8SJeremy L Thompson   return 0;
28777ff853SJeremy L Thompson   // LCOV_EXCL_STOP
29430758c8SJeremy L Thompson }
30