1*73501bfeSJeremy L Thompson /// @file 2*73501bfeSJeremy L Thompson /// Test getting and restoring work vectors 3*73501bfeSJeremy L Thompson /// \test Test getting and restoring work vectors 4*73501bfeSJeremy L Thompson 5*73501bfeSJeremy L Thompson #include <ceed.h> 6*73501bfeSJeremy L Thompson #include <ceed/backend.h> 7*73501bfeSJeremy L Thompson #include <stdio.h> 8*73501bfeSJeremy L Thompson 9*73501bfeSJeremy L Thompson int main(int argc, char **argv) { 10*73501bfeSJeremy L Thompson Ceed ceed; 11*73501bfeSJeremy L Thompson 12*73501bfeSJeremy L Thompson CeedInit(argv[1], &ceed); 13*73501bfeSJeremy L Thompson 14*73501bfeSJeremy L Thompson // Check for getting the same work vector back 15*73501bfeSJeremy L Thompson { 16*73501bfeSJeremy L Thompson CeedVector x, y; 17*73501bfeSJeremy L Thompson 18*73501bfeSJeremy L Thompson CeedGetWorkVector(ceed, 20, &x); 19*73501bfeSJeremy L Thompson // Do not do this! 20*73501bfeSJeremy L Thompson CeedVector x_copy = x; 21*73501bfeSJeremy L Thompson 22*73501bfeSJeremy L Thompson CeedRestoreWorkVector(ceed, &x); 23*73501bfeSJeremy L Thompson CeedGetWorkVector(ceed, 20, &y); 24*73501bfeSJeremy L Thompson if (y != x_copy) printf("failed to return same work vector"); 25*73501bfeSJeremy L Thompson CeedRestoreWorkVector(ceed, &y); 26*73501bfeSJeremy L Thompson } 27*73501bfeSJeremy L Thompson 28*73501bfeSJeremy L Thompson // Check for getting a new work vector back 29*73501bfeSJeremy L Thompson { 30*73501bfeSJeremy L Thompson CeedVector x, y; 31*73501bfeSJeremy L Thompson 32*73501bfeSJeremy L Thompson CeedGetWorkVector(ceed, 20, &x); 33*73501bfeSJeremy L Thompson // Do not do this! 34*73501bfeSJeremy L Thompson CeedVector x_copy = x; 35*73501bfeSJeremy L Thompson 36*73501bfeSJeremy L Thompson CeedRestoreWorkVector(ceed, &x); 37*73501bfeSJeremy L Thompson CeedGetWorkVector(ceed, 30, &y); 38*73501bfeSJeremy L Thompson if (y == x_copy) printf("failed to return new work vector"); 39*73501bfeSJeremy L Thompson CeedRestoreWorkVector(ceed, &y); 40*73501bfeSJeremy L Thompson } 41*73501bfeSJeremy L Thompson 42*73501bfeSJeremy L Thompson CeedDestroy(&ceed); 43*73501bfeSJeremy L Thompson return 0; 44*73501bfeSJeremy L Thompson } 45