Files
hm fef4ca22ab
pr-quality / static-gate (workflows + docs claims + coverage profile) (push) Canceled after 0s
pr-quality / fast-gate (build + core-pr tests + determinism) (push) Canceled after 0s
feat(brep/cae): face-level midsurface/offset and surface shell mesh; region table (VDE-1623/1618)
VDE-1623 (P1) - face-level midsurface and shell mesh:
  include/vde/brep/face_midsurface.h + src/brep/face_midsurface.cpp
    FaceTrimmedSurface (3D loops + per-segment source faces + thickness)
    offset_face_surface (plane/cylinder exact; sphere/cone/torus/spline reject)
    mid_surface_face (thickness min/mean/max, loop pairing, e_* diagnostics)
  include/vde/cae/surface_shell_mesh.h + src/cae/surface_shell_mesh.cpp
    surface_shell_mesh: quads/tris + thickness + element_source_face +
    boundary_nodes(node, source face)
  deviations documented: cae namespace (avoids brep<->mesh cycle), face-level
  3D loops instead of parametric brep::TrimmedSurface, new function name.
  test_vde1623_face_midsurface 15/15: plate thickness 2 / area 5000 / all quads /
  boundary sources; holed plate keeps 1 inner loop with hole-wall tags;
  wedge e_nonuniform_thickness; loop mismatch e_face_count_mismatch.

VDE-1618 (P2) - body region semantics:
  include/vde/cae/region_table.h + src/cae/region_table.cpp (namespace vde::mesh)
    RegionRole/MeshRegion/RegionTable + build_region_table
    connected-component regions by shared nodes; FNV-1a geometric-signature
    region_id independent of material/element count/order; boundary face tags.
  test_vde1618_region_table 13/13: single box 1 Solid region/6 tags; stable ids
  across remesh; material-independent ids; thin-wall shell 1 Solid/12 planes;
  shell+cavity merged mesh -> Solid+Cavity 2 regions.

Integration fixes:
  surface_shell_mesh.cpp undefined surface_index (blocked A7 builds) -> input_index
  loop_source_faces was all -1: BrepModel::edge_faces takes edge array index while
  sampling stored TopoEdge::id (vertex ids 0..7 shift edge ids 8..19 vs index 0..11)
  -> whole chain now stores indices; source-face tags verified.

Verification: full Release build OK; 20 integration suites all green
(test_vde1623 15/15, test_vde1618 13/13, test_vde1346 15/15, test_vde1360 12/12,
test_fea_mesh 68+1 skip, test_brep 96/96, test_trimmed_surface 34/34, ...);
PR gate 930/930 passed, 0 failed, 76.58 s.
2026-11-20 01:56:43 +08:00

81 lines
3.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
/**
* @file cae/surface_shell_mesh.h
* @brief 由面级裁剪曲面生成带来源面标记的壳网格(VDE-1623)。
*
* 与 VDE-1360 的体级壳网格(cae_preprocess.h 的 shell_mesh 重载)互补:
* 本接口直接消费 vde::brep 的面级裁剪曲面,不要求构造完整中面实体。
* 命名空间选 vde::cae(而非工单草图中的 vde::mesh),因为 brep 依赖 mesh,
* mesh 反向依赖 brep 会形成循环;该偏差记录在 docs/feedback/VDE-1623.md。
*
* 实现内部复用 cae::shell_mesh(MidsurfacePatch, ShellMeshParams) 的成熟平面
* 网格路径(矩形面走结构化全四边形网格,带孔环走 CDT + 四边形配对),
* 再把单元转换成数组形式并按坐标容差跨面焊接节点。
*
* 实现:src/cae/surface_shell_mesh.cpp。测试:tests/brep/test_vde1623_face_midsurface.cpp。
*
* @ingroup cae
*/
#include <array>
#include <string>
#include <utility>
#include <vector>
#include "vde/brep/face_midsurface.h"
#include "vde/core/point.h"
namespace vde::cae {
/// 面级壳网格参数(VDE-1623)。
struct SurfaceShellMeshParams {
/// 目标单元边长;<= 0 时按曲面包围盒自动取 5%(与 cae::shell_mesh 一致)。
double target_edge_length = 0.0;
/// 单元厚度;FaceTrimmedSurface::thickness > 0 时优先用曲面自带厚度,
/// 否则用本值(两者都 <= 0 时输出 0)。
double thickness = 0.0;
/// 四边形主导:true 时矩形面生成全四边形,带孔/非矩形面在无法配对时
/// 允许三角形回退;false 时全部生成三角形。
bool quad_dominant = true;
};
/// 面级壳网格结果(VDE-1623)。
struct SurfaceShellMeshResult {
/// 焊接后的节点坐标。
std::vector<core::Point3D> nodes;
/// 四边形单元(4 个有效节点)。所有四边形在前,三角形只出现在 tris。
std::vector<std::array<int, 4>> quads;
/// 三角形单元(3 个有效节点)。
std::vector<std::array<int, 3>> tris;
/// 每单元厚度;顺序 = 全部 quads 后接全部 tris。
std::vector<double> thickness;
/// 每单元来源 B-Rep 面 id;顺序同 thickness;未知为 -1。
std::vector<int> element_source_face;
/// 边界节点及其来源面 id(node, source_face)。同一节点可能因为相邻面
/// 各带一条(宿主取并集);来源优先取 FaceTrimmedSurface 的
/// loop_source_faces,缺失时回退 surface.source_face。
std::vector<std::pair<int, int>> boundary_nodes;
bool ok = false;
/// 失败码:"e_empty"(无曲面/无环)、"e_mesh_failure"(底层网格失败)。
std::string code;
std::string message;
};
/**
* @brief 由面级裁剪曲面生成带来源面标记的壳网格。
*
* 行为约定:
* - 相邻面共享边上的重合节点按坐标容差焊接(四边形主导下矩形面为全四边形);
* - 内环保留(不把孔填平);孔环节点按 loop_source_faces 标出孔壁面;
* - 边界节点全部带来源面(未知时 -1,正常输入不含未知);
* - 只读输入,无全局状态,可并发调用。
*
* @param surfaces 面级裁剪曲面列表(如 offset_face_surface / mid_surface_face 结果)
* @param params 网格参数
* @return 网格结果;失败时 ok=false 且 code/message 非空
*/
[[nodiscard]] SurfaceShellMeshResult surface_shell_mesh(
const std::vector<brep::FaceTrimmedSurface>& surfaces,
const SurfaceShellMeshParams& params = {});
} // namespace vde::cae