Skip to content

fix(CellSize): 修复filter并补充测试用例与文档 - #116

Open
bia-bia wants to merge 2 commits into
dayuwan77:mainfrom
bia-bia:fix/cell_size_filter
Open

bia-bia wants to merge 2 commits into
dayuwan77:mainfrom
bia-bia:fix/cell_size_filter

Conversation

@bia-bia

@bia-bia bia-bia commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

概述

针对测试反馈对 CellSizeFilter(计算单元尺寸)进行三项改进:

  1. 独立输出节点:Filter 不再修改原模型,输出为输入网格的深拷贝副本(含原属性集),新尺寸属性附加在副本上,输出节点命名“<模型名>_CellSize”
  2. NaN 语义:非本维度的属性由 0 改为 NaN,区分"属性不适用"与"真实零尺寸"
  3. 执行反馈:新增 GetComputedCellCount(),UI 成功弹窗显示已计算单元数量;
  4. 测试与使用:新增 2 个手算可校验的内置测试模型,测试程序固定相对路径、运行即自动完成测试;新增使用说明文档

属性输出语义

对任何支持的网格统一输出三个 IG_CELL 标量属性:

属性 含义 适用维度
Length 线长度 1D
Area 面积 2D
Volume 体积 3D

每个 cell 只填本维度属性,其余两个维度为 NaN(不适用);0 仅表示真实计算结果(如退化单元)。

改动文件

iGameCore/Filters/CellSize/iGameCellSizeFilter.{h,cpp}
Examples/Filter/FeatureExtraction/CellSizeExtraction.cpp
新增Examples/Models/CellSize_TetraCube.vtk
新增Examples/Models/CellSize_MixedTypes.vtk
新增 doc/FilterUserNotice/CellSizeFilter使用说明.md
Qt/src/IQCore/igQtMainWindow.cpp

验证

测试程序与igamevis均编译成功

测试模型(体积均可手算校验)

模型 构成 预期
CellSize_TetraCube.vtk 单位立方体 6 四面体分解(VTK_TETRA) 每个体积 1/6,总和 = 1.0;Length/Area 全 NaN
CellSize_MixedTypes.vtk 四面体 + 六面体 + 金字塔 + 棱柱(均为体单元,类型不一) Volume = [1/6, 1.0, 1/3, 0.5],总和 = 2.0;Length/Area 全 NaN

两个模型均为 ASCII VTK,在 ParaView 中对比验证完全正确。

实际运行输出

===== ./Models/CellSize_TetraCube.vtk =====
[CellSize] attribute="Length" first 6 values: nan nan nan nan nan nan
[CellSize] attribute="Area"   first 6 values: nan nan nan nan nan nan
[CellSize] attribute="Volume" first 6 values: 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667

===== ./Models/CellSize_MixedTypes.vtk =====
[CellSize] attribute="Length" first 4 values: nan nan nan nan
[CellSize] attribute="Area"   first 4 values: nan nan nan nan
[CellSize] attribute="Volume" first 4 values: 0.166667 1 0.333333 0.5

[CellSize] all built-in tests PASSED

@bia-bia
bia-bia force-pushed the fix/cell_size_filter branch from 588f87f to e7a859a Compare September 17, 2026 04:34
@bia-bia
bia-bia force-pushed the fix/cell_size_filter branch from e7a859a to 668fcec Compare September 17, 2026 04:39
@bia-bia bia-bia closed this Sep 17, 2026
@bia-bia bia-bia reopened this Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant