xref: /libCEED/tests/t214-elemrestriction.c (revision 430758c82d46a36f0f94ae5e5cf52a5e5bc2b1e9)
1*430758c8SJeremy L Thompson /// @file
2*430758c8SJeremy L Thompson /// Test element restriction state counter
3*430758c8SJeremy L Thompson /// \test Test element restriction state counter
4*430758c8SJeremy L Thompson #include <ceed-backend.h>
5*430758c8SJeremy L Thompson 
6*430758c8SJeremy L Thompson int main(int argc, char **argv) {
7*430758c8SJeremy L Thompson   Ceed ceed;
8*430758c8SJeremy L Thompson   CeedInt ne = 3;
9*430758c8SJeremy L Thompson   CeedInt ind[2*ne];
10*430758c8SJeremy L Thompson   const CeedInt *offsets;
11*430758c8SJeremy L Thompson   CeedElemRestriction r;
12*430758c8SJeremy L Thompson 
13*430758c8SJeremy L Thompson   CeedInit(argv[1], &ceed);
14*430758c8SJeremy L Thompson 
15*430758c8SJeremy L Thompson   for (CeedInt i=0; i<ne; i++) {
16*430758c8SJeremy L Thompson     ind[2*i+0] = i;
17*430758c8SJeremy L Thompson     ind[2*i+1] = i+1;
18*430758c8SJeremy L Thompson   }
19*430758c8SJeremy L Thompson   CeedElemRestrictionCreate(ceed, ne, 2, 1, 1, ne+1, CEED_MEM_HOST,
20*430758c8SJeremy L Thompson                             CEED_USE_POINTER, ind, &r);
21*430758c8SJeremy L Thompson 
22*430758c8SJeremy L Thompson   // Get offsets and restore them
23*430758c8SJeremy L Thompson   CeedElemRestrictionGetOffsets(r, CEED_MEM_HOST, &offsets);
24*430758c8SJeremy L Thompson   CeedElemRestrictionRestoreOffsets(r, &offsets);
25*430758c8SJeremy L Thompson 
26*430758c8SJeremy L Thompson   CeedElemRestrictionDestroy(&r);
27*430758c8SJeremy L Thompson   // LCOV_EXCL_START
28*430758c8SJeremy L Thompson   CeedDestroy(&ceed);
29*430758c8SJeremy L Thompson   // LCOV_EXCL_STOP
30*430758c8SJeremy L Thompson   return 0;
31*430758c8SJeremy L Thompson }
32