xref: /libCEED/tests/t118-vector.c (revision 44554ea01e90fce366fc2a203c44be15754a38d6)
1 /// @file
2 /// Test CeedVectorGetArray state counter
3 /// \test Test CeedVectorGetArray state counter
4 #include <ceed.h>
5 
6 int main(int argc, char **argv) {
7   Ceed ceed;
8   CeedVector x;
9   CeedInt n;
10   CeedScalar *a;
11 
12   CeedInit(argv[1], &ceed);
13 
14   n = 10;
15   CeedVectorCreate(ceed, n, &x);
16 
17   // Write access followed by sync array should generate an error
18   CeedVectorGetArray(x, CEED_MEM_HOST, &a);
19   CeedVectorSyncArray(x, CEED_MEM_HOST);
20 
21   // LCOV_EXCL_START
22   CeedVectorRestoreArray(x, &a);
23 
24   CeedVectorDestroy(&x);
25   CeedDestroy(&ceed);
26   return 0;
27   // LCOV_EXCL_STOP
28 }
29