xref: /libCEED/tests/t214-elemrestriction.c (revision ec3da8bcb94d9f0073544b37b5081a06981a86f7)
1430758c8SJeremy L Thompson /// @file
2430758c8SJeremy L Thompson /// Test element restriction state counter
3430758c8SJeremy L Thompson /// \test Test element restriction state counter
4*ec3da8bcSJed Brown #include <ceed/backend.h>
5430758c8SJeremy L Thompson 
6430758c8SJeremy L Thompson int main(int argc, char **argv) {
7430758c8SJeremy L Thompson   Ceed ceed;
8430758c8SJeremy L Thompson   CeedInt ne = 3;
9430758c8SJeremy L Thompson   CeedInt ind[2*ne];
10430758c8SJeremy L Thompson   const CeedInt *offsets;
11430758c8SJeremy L Thompson   CeedElemRestriction r;
12430758c8SJeremy L Thompson 
13430758c8SJeremy L Thompson   CeedInit(argv[1], &ceed);
14430758c8SJeremy L Thompson 
15430758c8SJeremy L Thompson   for (CeedInt i=0; i<ne; i++) {
16430758c8SJeremy L Thompson     ind[2*i+0] = i;
17430758c8SJeremy L Thompson     ind[2*i+1] = i+1;
18430758c8SJeremy L Thompson   }
19430758c8SJeremy L Thompson   CeedElemRestrictionCreate(ceed, ne, 2, 1, 1, ne+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