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