Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #ifndef PALACE_LIBCEED_COEFF_QF_H
5 : #define PALACE_LIBCEED_COEFF_QF_H
6 :
7 : union CeedIntScalar
8 : {
9 : CeedInt first;
10 : CeedScalar second;
11 : };
12 :
13 : // The first entry of ctx is the number of (1-based) attributes, followed by the entries of
14 : // the attribute to material index array (these are 0-based).
15 : // The next entry is the number of material property coefficients, followed by the
16 : // coefficients.
17 : // Pair coefficients are two coefficient contexts arranged contiguously in memory.
18 :
19 : CEED_QFUNCTION_HELPER CeedInt NumAttr(const CeedIntScalar *ctx)
20 : {
21 81538992 : return ctx[0].first;
22 : }
23 :
24 : CEED_QFUNCTION_HELPER CeedInt NumMat(const CeedIntScalar *ctx)
25 : {
26 161056 : return ctx[1 + NumAttr(ctx)].first;
27 : }
28 :
29 : CEED_QFUNCTION_HELPER const CeedIntScalar *AttrMat(const CeedIntScalar *ctx)
30 : {
31 : return ctx + 1;
32 : }
33 :
34 : CEED_QFUNCTION_HELPER const CeedIntScalar *MatCoeff(const CeedIntScalar *ctx)
35 : {
36 81746064 : return ctx + 2 + NumAttr(ctx);
37 : }
38 :
39 : template <int DIM>
40 : CEED_QFUNCTION_HELPER const CeedIntScalar *CoeffPairSecond(const CeedIntScalar *ctx)
41 : {
42 161056 : return ctx + 2 + NumAttr(ctx) + (DIM * DIM) * NumMat(ctx);
43 : }
44 :
45 : #endif // PALACE_LIBCEED_COEFF_QF_H
|