xref: /libCEED/tests/t110-vector.c (revision baf96a30fc83f1cce83f61e183e51df19381d4f1)
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     len = 10;
10   CeedScalar *a, *b;
11 
12   CeedInit(argv[1], &ceed);
13 
14   CeedVectorCreate(ceed, len, &x);
15   CeedVectorSetValue(x, 0.0);
16 
17   // Two write accesses should generate an error
18   CeedVectorGetArray(x, CEED_MEM_HOST, &a);
19   CeedVectorGetArray(x, CEED_MEM_HOST, &b);
20 
21   // LCOV_EXCL_START
22   CeedVectorRestoreArray(x, &a);
23   CeedVectorRestoreArray(x, &b);
24 
25   CeedVectorDestroy(&x);
26   CeedDestroy(&ceed);
27   return 0;
28   // LCOV_EXCL_STOP
29 }
30