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/hcurl_qf.h"
10 :
11 : namespace palace
12 : {
13 :
14 : using namespace ceed;
15 :
16 1589 : void DiffusionIntegrator::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 1589 : info.assemble_q_data = assemble_q_data;
24 :
25 : // Set up QFunctions.
26 : CeedInt dim, space_dim, trial_num_comp, test_num_comp;
27 1589 : PalaceCeedCall(ceed, CeedBasisGetDimension(trial_basis, &dim));
28 1589 : PalaceCeedCall(ceed, CeedGeometryDataGetSpaceDimension(geom_data_restr, dim, &space_dim));
29 1589 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(trial_basis, &trial_num_comp));
30 1589 : PalaceCeedCall(ceed, CeedBasisGetNumComponents(test_basis, &test_num_comp));
31 1589 : MFEM_VERIFY(
32 : trial_num_comp == test_num_comp && trial_num_comp == 1,
33 : "DiffusionIntegrator requires test and trial spaces with a single component!");
34 1589 : switch (10 * space_dim + dim)
35 : {
36 432 : case 22:
37 432 : info.apply_qf = assemble_q_data ? f_build_hcurl_22 : f_apply_hcurl_22;
38 432 : info.apply_qf_path = PalaceQFunctionRelativePath(
39 : assemble_q_data ? f_build_hcurl_22_loc : f_apply_hcurl_22_loc);
40 : break;
41 405 : case 33:
42 405 : info.apply_qf = assemble_q_data ? f_build_hcurl_33 : f_apply_hcurl_33;
43 405 : info.apply_qf_path = PalaceQFunctionRelativePath(
44 : assemble_q_data ? f_build_hcurl_33_loc : f_apply_hcurl_33_loc);
45 : break;
46 324 : case 21:
47 324 : info.apply_qf = assemble_q_data ? f_build_hcurl_21 : f_apply_hcurl_21;
48 324 : info.apply_qf_path = PalaceQFunctionRelativePath(
49 : assemble_q_data ? f_build_hcurl_21_loc : f_apply_hcurl_21_loc);
50 : break;
51 428 : case 32:
52 428 : info.apply_qf = assemble_q_data ? f_build_hcurl_32 : f_apply_hcurl_32;
53 428 : info.apply_qf_path = PalaceQFunctionRelativePath(
54 : assemble_q_data ? f_build_hcurl_32_loc : f_apply_hcurl_32_loc);
55 : break;
56 0 : default:
57 0 : MFEM_ABORT("Invalid value of (dim, space_dim) = (" << dim << ", " << space_dim
58 : << ") for DiffusionIntegrator!");
59 : }
60 1589 : info.trial_ops = EvalMode::Grad;
61 1589 : info.test_ops = EvalMode::Grad;
62 :
63 : // Set up the coefficient and assemble.
64 1589 : auto ctx = PopulateCoefficientContext(space_dim, Q, transpose);
65 1589 : 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 1589 : }
69 :
70 : } // namespace palace
|