xref: /libCEED/tests/t210-elemrestriction.c (revision f2989f2b3b8649d855bed22b6730ee0ecfa6b31b)
15a86f033Sjeremylt /// @file
25a86f033Sjeremylt /// Test creation and view of an element restriction
35a86f033Sjeremylt /// \test Test creation and view of an element restriction
45a86f033Sjeremylt #include <ceed.h>
55a86f033Sjeremylt 
main(int argc,char ** argv)65a86f033Sjeremylt int main(int argc, char **argv) {
75a86f033Sjeremylt   Ceed                ceed;
8d1d35e2fSjeremylt   CeedInt             num_elem = 3;
9d1d35e2fSjeremylt   CeedInt             ind[2 * num_elem];
104fee36f0SJeremy L Thompson   CeedElemRestriction elem_restriction;
115a86f033Sjeremylt 
125a86f033Sjeremylt   CeedInit(argv[1], &ceed);
135a86f033Sjeremylt 
14d1d35e2fSjeremylt   for (CeedInt i = 0; i < num_elem; i++) {
155a86f033Sjeremylt     ind[2 * i + 0] = i;
165a86f033Sjeremylt     ind[2 * i + 1] = i + 1;
175a86f033Sjeremylt   }
184fee36f0SJeremy L Thompson   CeedElemRestrictionCreate(ceed, num_elem, 2, 1, 1, num_elem + 1, CEED_MEM_HOST, CEED_USE_POINTER, ind, &elem_restriction);
195a86f033Sjeremylt 
204fee36f0SJeremy L Thompson   CeedElemRestrictionView(elem_restriction, stdout);
21*82a9f6a5SJeremy L Thompson 
22*82a9f6a5SJeremy L Thompson   // Check tabs and CeedObject functionality
23*82a9f6a5SJeremy L Thompson   {
24*82a9f6a5SJeremy L Thompson     CeedElemRestriction elem_restriction_copy = NULL;
25*82a9f6a5SJeremy L Thompson 
26*82a9f6a5SJeremy L Thompson     CeedElemRestrictionReferenceCopy(elem_restriction, &elem_restriction_copy);
27*82a9f6a5SJeremy L Thompson     CeedElemRestrictionSetNumViewTabs(elem_restriction_copy, 1);
28*82a9f6a5SJeremy L Thompson     CeedObjectView((CeedObject)elem_restriction_copy, stdout);
29*82a9f6a5SJeremy L Thompson     CeedObjectDestroy((CeedObject *)&elem_restriction_copy);
30*82a9f6a5SJeremy L Thompson   }
315a86f033Sjeremylt 
324fee36f0SJeremy L Thompson   CeedElemRestrictionDestroy(&elem_restriction);
335a86f033Sjeremylt   CeedDestroy(&ceed);
345a86f033Sjeremylt   return 0;
355a86f033Sjeremylt }
36