feat(v10): tolerant modeling + Class-A deep + hex mesh + constraint solver + drawing standards
v10.1 — Tolerant Modeling (对标 Parasolid): - tolerant_modeling.h/.cpp: TolerantVertex/Edge, merge_within_tolerance (BFS) - gap_bridging (free edge detection → triangle filling) - overlap_resolution (normal+centroid+AABB detection) - tolerant_boolean (heal→degenerate detect→boolean→heal) + BooleanDiagnostic - import_heal_pipeline (STEP one-shot repair) - ssi_boolean enhanced: coplanar/collinear/tangent detection, GMP on all classify paths - step_import enhanced: broken file recovery, non-standard entity mapping, diagnostic report - 30 tests, 4112 total lines v10.2 — Class-A Deep + Hex Mesh (对标 CGM + ANSYS): - class_a_surfacing enhanced: g3_blend_with_constraints, surface_energy_minimization - curvature_continuity_optimization, reflection_line_discontinuity (+720 lines) - fea_mesh enhanced: mapped_hex, submapped_hex, multi_block_hex (TFI), hex_quality_optimization (+522 lines) - 22 tests v10.3 — Constraint Solver + Drawing Standards (对标 D-Cubed + AutoCAD): - constraint_solver enhanced: DOFAnalyzer, RedundancyDetector, ConstraintPropagator, KinematicChainSolver - drawing_standards.h/.cpp: IsoStandard (ISO 128/129), AnsiStandard (ASME Y14.5), JisStandard (JIS B 0001) - 12 tests 12 files, ~5000 lines, 64 tests. Target: 87% → 93%
This commit is contained in:
+136
-1
@@ -282,8 +282,143 @@ FEAMesh boundary_layer_mesh(const brep::BrepModel& body,
|
||||
FEAMesh hexahedral_mesh(const brep::BrepModel& body,
|
||||
const HexMeshParams& params = {});
|
||||
|
||||
// ════════════════════════════════════════════════════════
|
||||
// 高级六面体网格生成 API
|
||||
// ════════════════════════════════════════════════════════
|
||||
|
||||
/// 六面体质量优化选项
|
||||
struct HexOptimizationParams {
|
||||
double min_scaled_jacobian = 0.3; ///< 最小可接受雅可比
|
||||
double max_aspect_ratio = 10.0; ///< 最大长宽比
|
||||
int max_iterations = 50; ///< 最大优化迭代次数
|
||||
double convergence_tol = 1e-4; ///< 收敛容差
|
||||
bool untangle = true; ///< 是否翻转修复(untangle inverted elements)
|
||||
bool laplacian_smooth = true; ///< 是否 Laplacian 光顺
|
||||
bool optimization_based_smooth = true; ///< 是否基于优化的光顺
|
||||
};
|
||||
|
||||
/// 六面体质量优化结果
|
||||
struct HexOptimizationResult {
|
||||
FEAMesh optimized_mesh; ///< 优化后的网格
|
||||
FEAQualityReport initial_quality; ///< 初始质量报告
|
||||
FEAQualityReport final_quality; ///< 最终质量报告
|
||||
int iterations = 0; ///< 实际迭代次数
|
||||
int inverted_fixed = 0; ///< 修复的反转单元数
|
||||
int degenerate_fixed = 0; ///< 修复的退化单元数
|
||||
bool converged = false; ///< 是否收敛
|
||||
};
|
||||
|
||||
/// 面标识结构
|
||||
struct FaceRegion {
|
||||
std::vector<int> face_indices; ///< 面的顶点索引列表
|
||||
std::string name; ///< 面名称
|
||||
};
|
||||
|
||||
/// 多块分区定义
|
||||
struct BlockRegion {
|
||||
std::vector<Point3D> corner_vertices; ///< 8个角顶点(i,j,k 顺序)
|
||||
int n_i = 2; ///< i方向分段数
|
||||
int n_j = 2; ///< j方向分段数
|
||||
int n_k = 2; ///< k方向分段数
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 自适应网格细化
|
||||
* @brief 映射法六面体网格生成
|
||||
*
|
||||
* 给定 B-Rep 实体的源面和目标面,使用映射法生成结构化六面体网格。
|
||||
* 核心思路:将源面四边形网格通过坐标映射变换到目标面,
|
||||
* 并在中间层线性插值,形成规则的六面体网格。
|
||||
*
|
||||
* 算法:
|
||||
* 1. 在源面生成四边形网格(重心映射或栅格映射)
|
||||
* 2. 在目标面生成对应的四边形网格
|
||||
* 3. 沿 sweep 方向线性插值生成中间层
|
||||
* 4. 连接各层为六面体单元
|
||||
*
|
||||
* @param body B-Rep实体模型
|
||||
* @param source_face 源面标识
|
||||
* @param target_face 目标面标识
|
||||
* @param layers 层数(默认 4)
|
||||
* @return FEAMesh 六面体网格 (Hex8)
|
||||
*
|
||||
* @note 对标 Ansys ICEM CFD Blocking / Pointwise
|
||||
* @ingroup mesh
|
||||
*/
|
||||
[[nodiscard]] FEAMesh mapped_hex_mesh(
|
||||
const brep::BrepModel& body,
|
||||
const FaceRegion& source_face,
|
||||
const FaceRegion& target_face,
|
||||
int layers = 4);
|
||||
|
||||
/**
|
||||
* @brief 子映射法六面体网格生成
|
||||
*
|
||||
* 自动将复杂几何体分区为多个可映射子区域,
|
||||
* 然后在每个子区域内用映射法生成六面体网格,
|
||||
* 最后缝合各子区域网格。
|
||||
*
|
||||
* 算法:
|
||||
* 1. 分析几何体的拓扑特征(角点、棱边)
|
||||
* 2. 自动分区为可扫掠(sweepable)子区域
|
||||
* 3. 对每个子区域执行映射法六面体化
|
||||
* 4. 合并子区域网格,保证界面节点一致
|
||||
*
|
||||
* @param body B-Rep实体模型
|
||||
* @return FEAMesh 六面体网格 (Hex8)
|
||||
*
|
||||
* @note 对标 Ansys Workbench MultiZone / CUBIT Submap
|
||||
* @ingroup mesh
|
||||
*/
|
||||
[[nodiscard]] FEAMesh submapped_hex_mesh(
|
||||
const brep::BrepModel& body);
|
||||
|
||||
/**
|
||||
* @brief 多块结构化六面体网格生成
|
||||
*
|
||||
* 对几何体进行显式多块分解,每个块独立生成结构化六面体网格,
|
||||
* 确保块间界面节点一一对应。
|
||||
*
|
||||
* 算法:
|
||||
* 1. 根据用户定义或自动识别的块分区
|
||||
* 2. 每个块内使用 transfinite interpolation (TFI) 生成节点
|
||||
* 3. 块间共享面节点,保证 conformal 连接
|
||||
* 4. 组装块为整体网格
|
||||
*
|
||||
* @param body B-Rep实体模型
|
||||
* @param blocks 块分区定义列表
|
||||
* @return FEAMesh 六面体网格 (Hex8)
|
||||
*
|
||||
* @note 对标 Ansys ICEM CFD Hexa Blocking / TrueGrid
|
||||
* @ingroup mesh
|
||||
*/
|
||||
[[nodiscard]] FEAMesh multi_block_hex_mesh(
|
||||
const brep::BrepModel& body,
|
||||
const std::vector<BlockRegion>& blocks);
|
||||
|
||||
/**
|
||||
* @brief 六面体网格质量优化与翻转修复
|
||||
*
|
||||
* 对六面体网格进行质量优化,包括反转变形修复(untangling)、
|
||||
* Laplacian 光顺和基于优化的光顺。
|
||||
*
|
||||
* 算法:
|
||||
* - untangling: 检测负雅可比单元,通过解局部优化问题翻转节点
|
||||
* - Laplacian 光顺: 将内部节点移到邻域质心
|
||||
* - 优化光顺: 最小化目标函数(扭曲度+体积变化)
|
||||
*
|
||||
* @param mesh 输入 FEA 六面体网格
|
||||
* @param params 优化参数
|
||||
* @return HexOptimizationResult 优化结果(含优化前后质量报告)
|
||||
*
|
||||
* @note 对标 CUBIT MeshGems / Pointwise T-Rex Quality
|
||||
* @ingroup mesh
|
||||
*/
|
||||
[[nodiscard]] HexOptimizationResult hex_quality_optimization(
|
||||
const FEAMesh& mesh,
|
||||
const HexOptimizationParams& params = {});
|
||||
|
||||
// ════════════════════════════════════════════════════════
|
||||
// 自适应细化
|
||||
*
|
||||
* 基于误差估计函数对高误差区域进行局部细分。
|
||||
* 支持边中点分裂细化(适用于Tet4→4×Tet4子单元)。
|
||||
|
||||
Reference in New Issue
Block a user