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 "coefficient.hpp"
5 :
6 : namespace palace
7 : {
8 :
9 1240262 : bool BdrGridFunctionCoefficient::GetBdrElementNeighborTransformations(
10 : int i, const mfem::ParMesh &mesh, mfem::FaceElementTransformations &FET,
11 : mfem::IsoparametricTransformation &T1, mfem::IsoparametricTransformation &T2,
12 : const mfem::IntegrationPoint *ip)
13 : {
14 : // Return transformations for elements attached to the given boundary element. FET.Elem1
15 : // always exists but FET.Elem2 may not if the element is truly a single-sided boundary.
16 : int f, o;
17 : int iel1, iel2, info1, info2;
18 1240262 : mesh.GetBdrElementFace(i, &f, &o);
19 1240262 : mesh.GetFaceElements(f, &iel1, &iel2);
20 1240262 : mesh.GetFaceInfos(f, &info1, &info2);
21 :
22 : // Master faces can never be boundary elements, thus only need to check for the state of
23 : // info2 and el2, and do not need to access the ncface numbering. See mfem::Mesh::FaceInfo
24 : // for details.
25 1240262 : if (info2 >= 0 && iel2 < 0)
26 : {
27 : // Face is shared with another subdomain.
28 0 : mesh.GetSharedFaceTransformationsByLocalIndex(f, FET, T1, T2);
29 : }
30 : else
31 : {
32 : // Face is either internal to the subdomain, or a true one-sided boundary.
33 1240262 : mesh.GetFaceElementTransformations(f, FET, T1, T2);
34 : }
35 :
36 : // Boundary elements and boundary faces may have different orientations so adjust the
37 : // integration point if necessary. See mfem::GridFunction::GetValue and GetVectorValue.
38 1240262 : if (ip)
39 : {
40 : mfem::IntegrationPoint fip =
41 53100 : mfem::Mesh::TransformBdrElementToFace(FET.GetGeometryType(), o, *ip);
42 : FET.SetAllIntPoints(&fip);
43 : }
44 :
45 : // Return whether or not the boundary element and face share the same orientations.
46 1240262 : return (o % 2 == 0);
47 : }
48 :
49 : } // namespace palace
|