/// @file /// Test CeedOperatorApplyAdd /// \test Test CeedOperatorApplyAdd #include #include #include #include "t500-operator.h" int main(int argc, char **argv) { Ceed ceed; CeedElemRestriction elem_restr_x, elem_restr_u, elem_restr_qd_i; CeedBasis basis_x, basis_u; CeedQFunction qf_setup, qf_mass; CeedOperator op_setup, op_mass; CeedVector q_data, X, U, V; const CeedScalar *hv; CeedInt num_elem = 15, P = 5, Q = 8; CeedInt num_nodes_x = num_elem+1, num_nodes_u = num_elem*(P-1)+1; CeedInt ind_x[num_elem*2], ind_u[num_elem*P]; CeedScalar x[num_nodes_x]; CeedScalar sum; CeedInit(argv[1], &ceed); for (CeedInt i=0; i1000.*CEED_EPSILON) // LCOV_EXCL_START printf("Computed Area: %f != True Area: 1.0\n", sum); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(V, &hv); // Apply with V = 1 CeedVectorSetValue(V, 1.0); CeedOperatorApplyAdd(op_mass, U, V, CEED_REQUEST_IMMEDIATE); // Check output CeedVectorGetArrayRead(V, CEED_MEM_HOST, &hv); sum = -num_nodes_u; for (CeedInt i=0; i1000.*CEED_EPSILON) // LCOV_EXCL_START printf("Computed Area: %f != True Area: 1.0\n", sum); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(V, &hv); CeedQFunctionDestroy(&qf_setup); CeedQFunctionDestroy(&qf_mass); CeedOperatorDestroy(&op_setup); CeedOperatorDestroy(&op_mass); CeedElemRestrictionDestroy(&elem_restr_u); CeedElemRestrictionDestroy(&elem_restr_x); CeedElemRestrictionDestroy(&elem_restr_qd_i); CeedBasisDestroy(&basis_u); CeedBasisDestroy(&basis_x); CeedVectorDestroy(&X); CeedVectorDestroy(&U); CeedVectorDestroy(&V); CeedVectorDestroy(&q_data); CeedDestroy(&ceed); return 0; }