Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #include "fem/integrator.hpp"
5 :
6 : #include "fem/libceed/coefficient.hpp"
7 : #include "fem/libceed/integrator.hpp"
8 :
9 : #include "fem/qfunctions/hcurlh1d_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 546 : void GradientIntegrator::Assemble(Ceed ceed, CeedElemRestriction trial_restr,
17 : CeedElemRestriction test_restr, CeedBasis trial_basis,
18 : CeedBasis test_basis, CeedVector geom_data,
19 : CeedElemRestriction geom_data_restr,
20 : CeedOperator *op) const
21 : {
22 : CeedQFunctionInfo info;
23 546 : info.assemble_q_data = assemble_q_data;
24 :
25 : // Set up QFunctions.
26 : CeedInt dim, space_dim, trial_num_comp, test_num_comp;
27 546 : PalaceCeedCall(ceed, CeedBasisGetDimension(trial_basis, &dim));
28 546 : PalaceCeedCall(ceed, CeedGeometryDataGetSpaceDimension(geom_data_restr, dim, &space_dim));
29 546 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
30 546 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
31 546 : MFEM_VERIFY(trial_num_comp == 1 && test_num_comp == space_dim,
32 : "GradientIntegrator requires trial space with a single component and test "
33 : "space with space_dim components!");
34 546 : switch (10 * space_dim + dim)
35 : {
36 288 : case 22:
37 288 : info.apply_qf = assemble_q_data ? f_build_hcurlh1d_22 : f_apply_hcurlh1d_22;
38 288 : info.apply_qf_path = PalaceQFunctionRelativePath(
39 : assemble_q_data ? f_build_hcurlh1d_22_loc : f_apply_hcurlh1d_22_loc);
40 : break;
41 258 : case 33:
42 258 : info.apply_qf = assemble_q_data ? f_build_hcurlh1d_33 : f_apply_hcurlh1d_33;
43 258 : info.apply_qf_path = PalaceQFunctionRelativePath(
44 : assemble_q_data ? f_build_hcurlh1d_33_loc : f_apply_hcurlh1d_33_loc);
45 : break;
46 0 : case 21:
47 0 : info.apply_qf = assemble_q_data ? f_build_hcurlh1d_21 : f_apply_hcurlh1d_21;
48 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
49 : assemble_q_data ? f_build_hcurlh1d_21_loc : f_apply_hcurlh1d_21_loc);
50 : break;
51 0 : case 32:
52 0 : info.apply_qf = assemble_q_data ? f_build_hcurlh1d_32 : f_apply_hcurlh1d_32;
53 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
54 : assemble_q_data ? f_build_hcurlh1d_32_loc : f_apply_hcurlh1d_32_loc);
55 : break;
56 0 : default:
57 0 : MFEM_ABORT("Invalid value of (dim, space_dim) = (" << dim << ", " << space_dim
58 : << ") for GradientIntegrator!");
59 : }
60 546 : info.trial_ops = EvalMode::Grad;
61 546 : info.test_ops = EvalMode::Interp;
62 :
63 : // Set up the coefficient and assemble.
64 546 : auto ctx = PopulateCoefficientContext(space_dim, Q, transpose);
65 546 : AssembleCeedOperator(info, (void *)ctx.data(), ctx.size() * sizeof(CeedIntScalar), ceed,
66 : trial_restr, test_restr, trial_basis, test_basis, geom_data,
67 : geom_data_restr, op);
68 546 : }
69 :
70 : } // namespace palace
|