23std::pair<int,int> GetFaceNormal3D(
const int face_id)
27 case 0:
return std::make_pair(2, 0);
28 case 1:
return std::make_pair(1, 0);
29 case 2:
return std::make_pair(0, 1);
30 case 3:
return std::make_pair(1, 1);
31 case 4:
return std::make_pair(0, 0);
32 case 5:
return std::make_pair(2, 1);
33 default: MFEM_ABORT(
"Invalid face ID.")
35 return std::make_pair(-1, -1);
38void FillFaceMap(
const int n_face_dofs_per_component,
39 const std::vector<int> &offsets,
40 const std::vector<int> &strides,
41 const std::vector<int> &n_dofs_per_dim,
44 const int n_components = offsets.size();
45 const int face_dim = strides.size() / n_components;
46 for (
int comp = 0; comp < n_components; ++comp)
48 const int offset = offsets[comp];
49 for (
int i = 0; i < n_face_dofs_per_component; ++i)
53 for (
int d = 0; d < face_dim; ++d)
55 const int dof1d = n_dofs_per_dim[comp*(face_dim) + d];
56 idx += strides[comp*(face_dim) + d]*(j % dof1d);
59 face_map[comp*n_face_dofs_per_component + i] = idx;
64void GetTensorFaceMap(
const int dim,
const int order,
const int face_id,
67 const int dof1d = order + 1;
68 int n_face_dofs = int(std::pow(dof1d,
dim - 1));
69 std::vector<int> offsets, strides;
73 offsets = {(face_id == 0) ? 0 : dof1d - 1};
76 strides = {(face_id == 0 || face_id == 2) ? 1 : dof1d};
79 case 0: offsets = {0};
break;
80 case 1: offsets = {dof1d - 1};
break;
81 case 2: offsets = {(dof1d-1)*dof1d};
break;
82 case 3: offsets = {0};
break;
87 const auto f = GetFaceNormal3D(face_id);
88 const int face_normal =
f.first, level =
f.second;
91 offsets = {level ? dof1d-1 : 0};
92 strides = {dof1d, dof1d*dof1d};
94 else if (face_normal == 1)
96 offsets = {level ? (dof1d-1)*dof1d : 0};
97 strides = {1, dof1d*dof1d};
99 else if (face_normal == 2)
101 offsets = {level ? (dof1d-1)*dof1d*dof1d : 0};
102 strides = {1, dof1d};
109 std::vector<int> n_dofs(
dim - 1, dof1d);
110 FillFaceMap(n_face_dofs, offsets, strides, n_dofs, face_map);
std::function< real_t(const Vector &)> f(real_t mass_coeff)