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/hcurlmass_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 24 : void DiffusionMassIntegrator::Assemble(Ceed ceed, CeedElemRestriction trial_restr,
17 : CeedElemRestriction test_restr,
18 : CeedBasis trial_basis, CeedBasis test_basis,
19 : CeedVector geom_data,
20 : CeedElemRestriction geom_data_restr,
21 : CeedOperator *op) const
22 : {
23 : CeedQFunctionInfo info;
24 24 : info.assemble_q_data = assemble_q_data;
25 :
26 : // Set up QFunctions.
27 : CeedInt dim, space_dim, trial_num_comp, test_num_comp;
28 24 : PalaceCeedCall(ceed, CeedBasisGetDimension(trial_basis, &dim));
29 24 : PalaceCeedCall(ceed, CeedGeometryDataGetSpaceDimension(geom_data_restr, dim, &space_dim));
30 24 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
31 24 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
32 24 : MFEM_VERIFY(
33 : trial_num_comp == test_num_comp && trial_num_comp == 1,
34 : "DiffusionMassIntegrator requires test and trial spaces with a single component!");
35 24 : switch (10 * space_dim + dim)
36 : {
37 0 : case 22:
38 0 : info.apply_qf = assemble_q_data ? f_build_hcurlmass_22 : f_apply_hcurlmass_22;
39 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
40 : assemble_q_data ? f_build_hcurlmass_22_loc : f_apply_hcurlmass_22_loc);
41 : break;
42 24 : case 33:
43 24 : info.apply_qf = assemble_q_data ? f_build_hcurlmass_33 : f_apply_hcurlmass_33;
44 24 : info.apply_qf_path = PalaceQFunctionRelativePath(
45 : assemble_q_data ? f_build_hcurlmass_33_loc : f_apply_hcurlmass_33_loc);
46 : break;
47 0 : case 21:
48 0 : info.apply_qf = assemble_q_data ? f_build_hcurlmass_21 : f_apply_hcurlmass_21;
49 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
50 : assemble_q_data ? f_build_hcurlmass_21_loc : f_apply_hcurlmass_21_loc);
51 : break;
52 0 : case 32:
53 0 : info.apply_qf = assemble_q_data ? f_build_hcurlmass_32 : f_apply_hcurlmass_32;
54 0 : info.apply_qf_path = PalaceQFunctionRelativePath(
55 : assemble_q_data ? f_build_hcurlmass_32_loc : f_apply_hcurlmass_32_loc);
56 : break;
57 0 : default:
58 0 : MFEM_ABORT("Invalid value of (dim, space_dim) = ("
59 : << dim << ", " << space_dim << ") for DiffusionMassIntegrator!");
60 : }
61 24 : info.trial_ops = EvalMode::Grad | EvalMode::Interp;
62 24 : info.test_ops = EvalMode::Grad | EvalMode::Interp;
63 :
64 : // Set up the coefficient and assemble. Mass goes first.
65 24 : auto ctx = PopulateCoefficientContext(1, Q_mass, space_dim, Q, transpose_mass, transpose);
66 24 : AssembleCeedOperator(info, (void *)ctx.data(), ctx.size() * sizeof(CeedIntScalar), ceed,
67 : trial_restr, test_restr, trial_basis, test_basis, geom_data,
68 : geom_data_restr, op);
69 24 : }
70 :
71 : } // namespace palace
|