xref: /libCEED/tests/t113-vector.c (revision caee03026e6576cbf7a399c2fc51bb918c77f451)
1 /// @file
2 /// Test CeedVector readers counter
3 /// \test Test CeedVector readers counter
4 #include <ceed.h>
5 
6 int main(int argc, char **argv) {
7   Ceed              ceed;
8   CeedVector        x;
9   CeedInt           n;
10   const CeedScalar *a;
11   CeedScalar       *b;
12 
13   CeedInit(argv[1], &ceed);
14 
15   n = 10;
16   CeedVectorCreate(ceed, n, &x);
17   CeedVectorSetValue(x, 0.0);
18   CeedVectorGetArrayRead(x, CEED_MEM_HOST, &a);
19 
20   // Write access with read access generate an error
21   CeedVectorGetArray(x, CEED_MEM_HOST, &b);
22 
23   // LCOV_EXCL_START
24   CeedVectorRestoreArrayRead(x, &a);
25   CeedVectorRestoreArray(x, &b);
26 
27   CeedVectorDestroy(&x);
28   CeedDestroy(&ceed);
29   return 0;
30   // LCOV_EXCL_STOP
31 }
32