92 fs::create_directories(path);
93 path /=
"TestBoundaryNormals.xml";
95 std::ofstream stream(path);
96 stream << sessionFile;
99 std::string pathString = path.string();
100 char executable[] =
"MultiRegionsUnitTests";
101 char *argv[] = {executable, pathString.data(),
nullptr};
108 field->GetBoundaryToElmtMap(elmtId, faceId);
112 bool exercisesMismatchedTrace =
false;
113 for (
int n = 0; n < field->GetBndCondExpansions()[0]->GetExpSize(); ++n)
115 auto elmt = field->GetExp(elmtId[n]);
116 auto localNormals = elmt->GetTraceNormal(faceId[n]);
117 int volume01 = elmt->GetBasis(0)->GetNumPoints() *
118 elmt->GetBasis(1)->GetNumPoints();
119 exercisesMismatchedTrace |= localNormals[0].size() != volume01;
121 BOOST_REQUIRE(exercisesMismatchedTrace);
124 field->GetBoundaryNormals(0, normals);
126 int npoints = field->GetBndCondExpansions()[0]->GetTotPoints();
128 for (
int d = 0; d < 3; ++d)
133 for (
int n = 0; n < field->GetBndCondExpansions()[0]->GetExpSize(); ++n)
135 auto elmt = field->GetExp(elmtId[n]);
136 auto localNormals = elmt->GetTraceNormal(faceId[n]);
139 auto localTrace = elmt->GetAlignedTraceExp(faceId[n]);
140 int offset = field->GetBndCondExpansions()[0]->GetPhys_Offset(n);
143 for (
int d = 0; d < 3; ++d)
145 field->GetBndCondExpansions()[0]->GetExp(n)->PhysInterp(
146 localTrace, localNormals[d], tmp = expected[d] + offset);
150 BOOST_REQUIRE_EQUAL(normals.size(), 3);
151 for (
int d = 0; d < 3; ++d)
153 BOOST_REQUIRE_EQUAL(normals[d].size(), npoints);
156 for (
int i = 0; i < npoints; ++i)
159 for (
int d = 0; d < 3; ++d)
161 BOOST_REQUIRE(std::isfinite(normals[d][i]));
162 BOOST_CHECK_SMALL(normals[d][i] - expected[d][i], 1.0e-12);
163 magnitude += normals[d][i] * normals[d][i];
165 BOOST_CHECK_SMALL(std::sqrt(magnitude) - 1.0, 1.0e-12);
168 fs::remove_all(path.parent_path());