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/l2_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 558 : void DivDivIntegrator::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, CeedOperator *op) const
20 : {
21 : CeedQFunctionInfo info;
22 558 : info.assemble_q_data = assemble_q_data;
23 :
24 : // Set up QFunctions.
25 : CeedInt trial_num_comp, test_num_comp;
26 558 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
27 558 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
28 558 : MFEM_VERIFY(
29 : trial_num_comp == test_num_comp,
30 : "DivDivIntegrator requires test and trial spaces with same number of components!");
31 558 : switch (trial_num_comp)
32 : {
33 558 : case 1:
34 558 : info.apply_qf = assemble_q_data ? f_build_l2_1 : f_apply_l2_1;
35 558 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_l2_1_loc
36 : : f_apply_l2_1_loc);
37 : break;
38 0 : case 2:
39 0 : info.apply_qf = assemble_q_data ? f_build_l2_2 : f_apply_l2_2;
40 0 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_l2_2_loc
41 : : f_apply_l2_2_loc);
42 : break;
43 0 : case 3:
44 0 : info.apply_qf = assemble_q_data ? f_build_l2_3 : f_apply_l2_3;
45 0 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_l2_3_loc
46 : : f_apply_l2_3_loc);
47 : break;
48 0 : default:
49 0 : MFEM_ABORT("Invalid value of num_comp = " << trial_num_comp
50 : << " for DivDivIntegrator!");
51 : }
52 558 : info.trial_ops = EvalMode::Div | EvalMode::Weight;
53 558 : info.test_ops = EvalMode::Div;
54 :
55 : // Set up the coefficient and assemble.
56 558 : auto ctx = PopulateCoefficientContext(trial_num_comp, Q, transpose);
57 558 : AssembleCeedOperator(info, (void *)ctx.data(), ctx.size() * sizeof(CeedIntScalar), ceed,
58 : trial_restr, test_restr, trial_basis, test_basis, geom_data,
59 : geom_data_restr, op);
60 558 : }
61 :
62 : } // namespace palace
|