t409-qfunction.c (ac415f7108a9c8d1de9a040977bf99fc30ead005) t409-qfunction.c (f85e4a7b5ace0077fded2faa470b8becfe6fbd4e)
1/// @file
2/// Test creation, evaluation, and destruction for QFunction
3/// \test Test creation, evaluation, and destruction for QFunction
4#include "t409-qfunction.h"
5
6#include <ceed.h>
7#include <math.h>
8#include <stdio.h>

--- 28 unchanged lines hidden (view full) ---

37 out[0] = v;
38 CeedQFunctionApply(qf, q, in, out);
39 }
40
41 {
42 const CeedScalar *v_array;
43
44 CeedVectorGetArrayRead(v, CEED_MEM_HOST, &v_array);
1/// @file
2/// Test creation, evaluation, and destruction for QFunction
3/// \test Test creation, evaluation, and destruction for QFunction
4#include "t409-qfunction.h"
5
6#include <ceed.h>
7#include <math.h>
8#include <stdio.h>

--- 28 unchanged lines hidden (view full) ---

37 out[0] = v;
38 CeedQFunctionApply(qf, q, in, out);
39 }
40
41 {
42 const CeedScalar *v_array;
43
44 CeedVectorGetArrayRead(v, CEED_MEM_HOST, &v_array);
45 for (CeedInt i = 0; i < q; i++)
46 if (fabs(v_array[i] - ctx_data[1]) > 100. * CEED_EPSILON)
45 for (CeedInt i = 0; i < q; i++) {
46 if (fabs(v_array[i] - ctx_data[1]) > 100. * CEED_EPSILON) {
47 // LCOV_EXCL_START
48 printf("v[%" CeedInt_FMT "] %f != 2.0\n", i, v_array[i]);
47 // LCOV_EXCL_START
48 printf("v[%" CeedInt_FMT "] %f != 2.0\n", i, v_array[i]);
49 // LCOV_EXCL_STOP
49 // LCOV_EXCL_STOP
50 }
51 }
50 CeedVectorRestoreArrayRead(v, &v_array);
51 }
52
53 // Check for written context data
54 CeedScalar *ctx_data_new;
55 CeedQFunctionContextGetDataRead(ctx, CEED_MEM_HOST, &ctx_data_new);
52 CeedVectorRestoreArrayRead(v, &v_array);
53 }
54
55 // Check for written context data
56 CeedScalar *ctx_data_new;
57 CeedQFunctionContextGetDataRead(ctx, CEED_MEM_HOST, &ctx_data_new);
56 if (ctx_data_new[0] != 42)
58 if (ctx_data_new[0] != 42) {
57 // LCOV_EXCL_START
58 printf("Context data not written: %f != 42\n", ctx_data_new[0]);
59 // LCOV_EXCL_START
60 printf("Context data not written: %f != 42\n", ctx_data_new[0]);
59 // LCOV_EXCL_STOP
61 // LCOV_EXCL_STOP
62 }
60 CeedQFunctionContextRestoreDataRead(ctx, &ctx_data_new);
61
62 // Assert that context will not be written
63 // Note: The interface cannot enforce this in user code
64 // so setting is_writable == false and then calling
65 // CeedQFunctionApply to mutate the context would lead
66 // to inconsistent data on the GPU.
67 // Only the `/cpu/self/memcheck/*` backends verify that

--- 20 unchanged lines hidden ---
63 CeedQFunctionContextRestoreDataRead(ctx, &ctx_data_new);
64
65 // Assert that context will not be written
66 // Note: The interface cannot enforce this in user code
67 // so setting is_writable == false and then calling
68 // CeedQFunctionApply to mutate the context would lead
69 // to inconsistent data on the GPU.
70 // Only the `/cpu/self/memcheck/*` backends verify that

--- 20 unchanged lines hidden ---