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 const CeedScalar *b; 12 13 CeedInit(argv[1], &ceed); 14 15 n = 10; 16 CeedVectorCreate(ceed, n, &x); 17 CeedVectorSetValue(x, 0.0); 18 19 // Write access followed by read access should generate an error 20 CeedVectorGetArray(x, CEED_MEM_HOST, &a); 21 CeedVectorGetArrayRead(x, CEED_MEM_HOST, &b); 22 23 // LCOV_EXCL_START 24 CeedVectorRestoreArray(x, &a); 25 CeedVectorRestoreArrayRead(x, &b); 26 27 CeedVectorDestroy(&x); 28 CeedDestroy(&ceed); 29 return 0; 30 // LCOV_EXCL_STOP 31 } 32