xref: /libCEED/tests/t214-elemrestriction.c (revision d1d35e2f02dc969aee8debf3fd943dd784aa847a)
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;
8*d1d35e2fSjeremylt   CeedInt num_elem = 3;
9*d1d35e2fSjeremylt   CeedInt ind[2*num_elem];
10430758c8SJeremy L Thompson   const CeedInt *offsets;
11430758c8SJeremy L Thompson   CeedElemRestriction r;
12430758c8SJeremy L Thompson 
13430758c8SJeremy L Thompson   CeedInit(argv[1], &ceed);
14430758c8SJeremy L Thompson 
15*d1d35e2fSjeremylt   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*d1d35e2fSjeremylt   CeedElemRestrictionCreate(ceed, num_elem, 2, 1, 1, num_elem+1, CEED_MEM_HOST,
20430758c8SJeremy L Thompson                             CEED_USE_POINTER, ind, &r);
21430758c8SJeremy L Thompson 
22430758c8SJeremy L Thompson   // Get offsets and restore them
23430758c8SJeremy L Thompson   CeedElemRestrictionGetOffsets(r, CEED_MEM_HOST, &offsets);
24430758c8SJeremy L Thompson   CeedElemRestrictionRestoreOffsets(r, &offsets);
25430758c8SJeremy L Thompson 
26430758c8SJeremy L Thompson   CeedElemRestrictionDestroy(&r);
27430758c8SJeremy L Thompson   // LCOV_EXCL_START
28430758c8SJeremy L Thompson   CeedDestroy(&ceed);
29430758c8SJeremy L Thompson   // LCOV_EXCL_STOP
30430758c8SJeremy L Thompson   return 0;
31430758c8SJeremy L Thompson }
32