xref: /libCEED/tests/t118-vector.c (revision 2eb0be0b68ebb7cb25cc038250732c3239325ad2)
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   CeedVectorSetValue(x, 0.0);
17 
18   // Write access followed by sync array should generate an error
19   CeedVectorGetArray(x, CEED_MEM_HOST, &a);
20   CeedVectorSyncArray(x, CEED_MEM_HOST);
21 
22   // LCOV_EXCL_START
23   CeedVectorRestoreArray(x, &a);
24 
25   CeedVectorDestroy(&x);
26   CeedDestroy(&ceed);
27   return 0;
28   // LCOV_EXCL_STOP
29 }
30