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/hdivmass_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 24 : void CurlCurlMassIntegrator::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 24 : info.assemble_q_data = assemble_q_data;
24 :
25 : // Set up QFunctions.
26 : CeedInt dim, space_dim, trial_num_comp, test_num_comp;
27 24 : PalaceCeedCall(ceed, CeedBasisGetDimension(trial_basis, &dim));
28 24 : PalaceCeedCall(ceed, CeedGeometryDataGetSpaceDimension(geom_data_restr, dim, &space_dim));
29 24 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
30 24 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
31 24 : MFEM_VERIFY(
32 : trial_num_comp == test_num_comp && trial_num_comp == 1,
33 : "CurlCurlMassIntegrator requires test and trial spaces with a single component!");
34 24 : switch (10 * space_dim + dim)
35 : {
36 0 : case 22:
37 0 : info.apply_qf = assemble_q_data ? f_build_hdivmass_22 : f_apply_hdivmass_22;
38 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
39 : assemble_q_data ? f_build_hdivmass_22_loc : f_apply_hdivmass_22_loc);
40 : break;
41 24 : case 33:
42 24 : info.apply_qf = assemble_q_data ? f_build_hdivmass_33 : f_apply_hdivmass_33;
43 24 : info.apply_qf_path = PalaceQFunctionRelativePath(
44 : assemble_q_data ? f_build_hdivmass_33_loc : f_apply_hdivmass_33_loc);
45 : break;
46 0 : case 32:
47 0 : info.apply_qf = assemble_q_data ? f_build_hdivmass_32 : f_apply_hdivmass_32;
48 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
49 : assemble_q_data ? f_build_hdivmass_32_loc : f_apply_hdivmass_32_loc);
50 : break;
51 0 : default:
52 0 : MFEM_ABORT("Invalid value of (dim, space_dim) = ("
53 : << dim << ", " << space_dim << ") for CurlCurlMassIntegrator!");
54 : }
55 24 : info.trial_ops = EvalMode::Curl | EvalMode::Interp;
56 24 : info.test_ops = EvalMode::Curl | EvalMode::Interp;
57 24 : if (dim < 3)
58 : {
59 0 : info.trial_ops |= EvalMode::Weight;
60 : }
61 :
62 : // Set up the coefficient and assemble. Mass goes first.
63 48 : auto ctx = PopulateCoefficientContext(space_dim, Q_mass, (dim < 3) ? 1 : dim, Q,
64 48 : transpose_mass, transpose);
65 24 : 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 24 : }
69 :
70 : } // namespace palace
|