xref: /libCEED/tests/t214-elemrestriction.c (revision 4fee36f0a30516a0b5ad51bf7eb3b32d83efd623)
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 
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 restore them
22*4fee36f0SJeremy L Thompson   CeedElemRestrictionGetOffsets(elem_restriction, CEED_MEM_HOST, &offsets);
23*4fee36f0SJeremy L Thompson   CeedElemRestrictionRestoreOffsets(elem_restriction, &offsets);
24430758c8SJeremy L Thompson 
25*4fee36f0SJeremy L Thompson   CeedElemRestrictionDestroy(&elem_restriction);
26430758c8SJeremy L Thompson   // LCOV_EXCL_START
27430758c8SJeremy L Thompson   CeedDestroy(&ceed);
28430758c8SJeremy L Thompson   // LCOV_EXCL_STOP
29430758c8SJeremy L Thompson   return 0;
30430758c8SJeremy L Thompson }
31