1 /// @file
2 /// Test CeedVectorGetArrayRead state counter
3 /// \test Test CeedVectorGetArrayRead state counter
4
5 //TESTARGS(only="cpu") {ceed_resource}
6 #include <ceed.h>
7
main(int argc,char ** argv)8 int main(int argc, char **argv) {
9 Ceed ceed;
10 CeedVector x;
11 CeedInt len = 10;
12
13 CeedInit(argv[1], &ceed);
14
15 CeedVectorCreate(ceed, len, &x);
16 CeedVectorSetValue(x, 0.0);
17
18 // Two read accesses should not generate an error
19 {
20 const CeedScalar *a, *b;
21
22 CeedVectorGetArrayRead(x, CEED_MEM_HOST, &a);
23 CeedVectorGetArrayRead(x, CEED_MEM_HOST, &b);
24
25 CeedVectorRestoreArrayRead(x, &a);
26 CeedVectorRestoreArrayRead(x, &b);
27 }
28
29 CeedVectorDestroy(&x);
30 CeedDestroy(&ceed);
31 return 0;
32 }
33