test(cae): two-hole plate midsurface and shell area

This commit is contained in:
hm
2026-11-14 22:47:05 +08:00
parent 23436601a3
commit d88b8a751a
2 changed files with 60 additions and 0 deletions
@@ -2206,3 +2206,40 @@ CorpusProbe.ThinPlateMidsurfaceAndTetra
test_fea_mesh: 45 tests,44 passed,1 skipped
test_brep: 90/90 PASS
~~~
## 进展(2026-11-14 第四十七轮)
### 双孔薄板中面/壳网格
构造:
~~~text
100×100×10 板
两个 Ø10 通孔
~~~
验证:
~~~text
extract_midsurface:
1 个 Plane patch
thickness=10
loops=3(外环 + 2 孔)
shell_mesh:
面积 = 10000 − 2π·5²
误差 <=1%
~~~
新增回归:
~~~text
CorpusProbe.SyntheticPlateWithTwoHolesMidsurface
~~~
全部:
~~~text
test_fea_mesh: 46 tests,45 passed,1 skipped
~~~
+23
View File
@@ -876,3 +876,26 @@ TEST(CorpusProbe, PlateWithCylindricalFeaturesRejected) {
EXPECT_NE(tet.diagnostic.find("rejected"), std::string::npos)
<< tet.diagnostic;
}
TEST(CorpusProbe, SyntheticPlateWithTwoHolesMidsurface) {
auto plate = make_box(100, 100, 10);
auto h1 = make_cylinder_exact(5.0, 20.0, Point3D(-20, 0, 0));
auto h2 = make_cylinder_exact(5.0, 20.0, Point3D(20, 0, 0));
auto body = brep_difference(brep_difference(plate, h1), h2);
const auto mids = vde::cae::extract_midsurface(body, 0.2);
ASSERT_EQ(mids.size(), 1u);
EXPECT_NEAR(mids[0].thickness, 10.0, 1e-9);
EXPECT_EQ(mids[0].loops.size(), 3u);
const auto shell = vde::cae::shell_mesh(body);
ASSERT_FALSE(shell.triangles.empty()) << shell.diagnostic;
double shell_area = 0.0;
for (const auto& t : shell.triangles) {
const auto& a = shell.vertices[t[0]];
const auto& c = shell.vertices[t[1]];
const auto& d = shell.vertices[t[2]];
shell_area += 0.5 * (c - a).cross(d - a).norm();
}
const double expect = 10000.0 - 2.0 * 3.14159265358979323846 * 25.0;
EXPECT_NEAR(shell_area, expect, 0.01 * expect);
}