/// @file /// Test assembly of non-symmetric mass matrix operator (multi-component) see t537 /// \test Test assembly of non-symmetric mass matrix operator (multi-component) #include #include #include #include "t566-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; CeedInt P = 3, Q = 3, dim = 2, num_comp = 2; CeedInt n_x = 1, n_y = 1; CeedInt num_elem = n_x * n_y; CeedInt num_dofs = (n_x*2+1)*(n_y*2+1), num_qpts = num_elem*Q*Q; CeedInt ind_x[num_elem*P*P]; CeedScalar assembled[num_comp*num_comp*num_dofs*num_dofs]; CeedScalar x[dim*num_dofs], assembled_true[num_comp*num_comp*num_dofs*num_dofs]; CeedScalar *u; const CeedScalar *v; CeedInit(argv[1], &ceed); // DoF Coordinates for (CeedInt i=0; i 0) u[indOld] = 0.0; indOld = ind; CeedVectorRestoreArray(U, &u); // Compute effect of DoF j CeedOperatorApply(op_mass, U, V, CEED_REQUEST_IMMEDIATE); CeedVectorGetArrayRead(V, CEED_MEM_HOST, &v); for (CeedInt k=0; k 100.*CEED_EPSILON) // LCOV_EXCL_START printf("[(%d, %d), (%d, %d)] Error in assembly: %f != %f\n", node_in, comp_in, node_out, comp_out, assembled_value, assembled_true_value); // LCOV_EXCL_STOP } } } } // Cleanup free(rows); free(cols); CeedVectorDestroy(&values); 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(&q_data); CeedVectorDestroy(&U); CeedVectorDestroy(&V); CeedDestroy(&ceed); return 0; }