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/h1_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 2658 : void MassIntegrator::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 2658 : info.assemble_q_data = assemble_q_data;
23 :
24 : // Set up QFunctions.
25 : CeedInt trial_num_comp, test_num_comp;
26 2658 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
27 2658 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
28 2658 : MFEM_VERIFY(
29 : trial_num_comp == test_num_comp,
30 : "MassIntegrator requires test and trial spaces with same number of components!");
31 2658 : switch (trial_num_comp)
32 : {
33 1084 : case 1:
34 1084 : info.apply_qf = assemble_q_data ? f_build_h1_1 : f_apply_h1_1;
35 1084 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_h1_1_loc
36 : : f_apply_h1_1_loc);
37 : break;
38 756 : case 2:
39 756 : info.apply_qf = assemble_q_data ? f_build_h1_2 : f_apply_h1_2;
40 756 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_h1_2_loc
41 : : f_apply_h1_2_loc);
42 : break;
43 818 : case 3:
44 818 : info.apply_qf = assemble_q_data ? f_build_h1_3 : f_apply_h1_3;
45 818 : info.apply_qf_path = PalaceQFunctionRelativePath(assemble_q_data ? f_build_h1_3_loc
46 : : f_apply_h1_3_loc);
47 : break;
48 0 : default:
49 0 : MFEM_ABORT("Invalid value of num_comp = " << trial_num_comp
50 : << " for MassIntegrator!");
51 : }
52 2658 : info.trial_ops = EvalMode::Interp;
53 2658 : info.test_ops = EvalMode::Interp;
54 :
55 : // Set up the coefficient and assemble.
56 2658 : auto ctx = PopulateCoefficientContext(trial_num_comp, Q, transpose);
57 2658 : 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 2658 : }
61 :
62 : } // namespace palace
|