### P1.x 内核对齐(P1 遗留收口)
- 原生 .vde 序列化(serializer/vde_format/vde_text)迁入内核 vde_brep;C API 序列化回迁 vde_kernel_capi;
PMI/MBD 拆为内核数据模型(vde_brep)+ 3D-PDF 导出(vde_io/pmi_export.cpp),消除 kernel→io 反向依赖;
- make_geometry_host_services() 迁入内核 vde_brep,kernel-only 下 PluginManager+宿主服务可用;
- kernel-only 约 40 个测试 target + 4 个 examples 门控;六业务 OFF 的 2 个测试 target 门控;
- vde_version() 返回 0.5.0 既有缺陷修复;kernel SDK consumer 实测 1.0.47;
### P2-1 vde_cae 官方模块
- include/vde/cae/*、src/cae/*、tests/cae/*;旧路径转发头兼容;VDE_BUILD_CAE 开关;
- vde_io 移除 fea_mesh/fluid_domain;ctest 用例数保持(95 项 CAE 测试);CAE=OFF 构建 937/937;
### P2-2 插件 ABI 1.2:CAE solver / CAM strategy 扩展点
- VdeCaeSolverPlugin/VdeCamStrategyPlugin + Registration 尾部扩展(旧插件兼容);
- PluginManager cae_solvers()/cam_strategies()/solve_cae()/invoke_cam(),加载校验/失败隔离;
- plugins/sample_cae、sample_cam_post、abi11_compat、external/{runner,sample_stl_converter};
- docs/design/vde-service-protocol.md 进程外服务协议草案;test_plugin_extensions 9/9;
### VDE-1249 三阻塞修复
- fix1 共享边采样性能悬崖:sagitta 自适应段数 + 自由曲面证据触发 + fast planar loop 256 + IncrementalMesher 复用 mesh_face_diag;
box+16 孔 legacy 3.3-3.6s→69.5ms、rebuild 4095→103ms;box+25 孔 5.1s→190.9ms;n42 链 ≤222ms;open=0/面积体积正确;
- fix2 fillet/blend 破损体护栏(fillet_edges_checked:watertight/dangling 护栏 + heal 重试 + 显式失败/诊断;
静默 no-op success → 显式失败)+ delete_face_with_heal/fill_hole 边环重排(26 面盒 0/26→6/6,box 2/6→6/6);
- fix3 wireframe tight payload:WireframeOptions.include_segment_info + C API VdeWireframeOptions 尾扩展 +
vde_body_to_wireframe_opt2(旧 ABI 安全);tight≈49-61% full(与 1.0.12 旧风格差 4B/段);
### 工程
- 修复 .gitignore `*.txt` 误伤:`!CMakeLists.txt`,把 plugins/**、tools/、tests/plugin、tests/cae 等漏入库的
CMakeLists.txt 纳入版本库(保证干净 checkout 可构建);
- 版本 1.0.47(CMake/version.h/test_version/README/docs index/module-manual 同步);
验证:全量构建 0 error(334 targets);全量 ctest 7395 注册、7300/7300 PASS(0 failed,24 skipped,194.39s);
kernel-only(-DVDE_BUILD_IO=OFF + BUILD_TESTS=ON)全量构建 0 failed、plugin 30/12 + capi_split 7 全绿;
六业务 OFF 全量测试构建 0 failed;CAE 95/95;插件 ctest 61/61;VDE-1249 repro 前后数字见 CHANGELOG。
118 lines
4.6 KiB
C++
118 lines
4.6 KiB
C++
// ABI 1.1 旧插件兼容性验证插件(测试用;VDE 微内核 P2)。
|
||
//
|
||
// 用 VDE_PLUGIN_ABI_MINOR_OVERRIDE=1 以插件 ABI 1.1 编译(query 上报 1.1),
|
||
// 只用 ABI 1.0/1.1 的服务(host->body_create_box),不填 ABI 1.2 的扩展点字段,
|
||
// 用于验证新宿主(ABI 1.2)仍能发现/加载/调用旧插件。
|
||
#include <cstdio>
|
||
#include <cstdlib>
|
||
#include <cstring>
|
||
#include <string>
|
||
|
||
#define VDE_PLUGIN_ABI_MINOR_OVERRIDE 1
|
||
#include "vde/plugin/vde_plugin_api.h"
|
||
|
||
namespace {
|
||
|
||
int ab11_fail(const VdePluginHost* host, int code, const char* message) {
|
||
if (host && host->set_error) host->set_error(message);
|
||
return code;
|
||
}
|
||
|
||
int ab11_probe(const void* head, size_t head_size) {
|
||
if (!head || head_size < 5) return 0;
|
||
const char* data = static_cast<const char*>(head);
|
||
return std::strncmp(data, "ab11", 4) == 0 ? 100 : 0;
|
||
}
|
||
|
||
int ab11_read_memory(const VdePluginHost* host, const void* data, size_t size,
|
||
VdeBody** bodies, size_t* count) {
|
||
if (bodies) *bodies = nullptr;
|
||
if (count) *count = 0;
|
||
if (!bodies || !count) return ab11_fail(host, VDE_PLUGIN_ERR_INVALID_ARG, "ab11: 输出指针为空");
|
||
if (!host || !host->alloc || !host->set_error || !host->body_create_box)
|
||
return ab11_fail(host, VDE_PLUGIN_ERR_UNSUPPORTED, "ab11: 宿主缺少必需服务");
|
||
if (!data || size == 0) return ab11_fail(host, VDE_PLUGIN_ERR_INVALID_ARG, "ab11: 数据为空");
|
||
double w = 0.0, h = 0.0, d = 0.0;
|
||
if (std::sscanf(static_cast<const char*>(data), "ab11 1 %lf %lf %lf", &w, &h, &d) != 3)
|
||
return ab11_fail(host, VDE_PLUGIN_ERR_PARSE, "ab11: 期望 'ab11 1 <w> <h> <d>'");
|
||
if (!(w > 0.0 && h > 0.0 && d > 0.0))
|
||
return ab11_fail(host, VDE_PLUGIN_ERR_INVALID_ARG, "ab11: 尺寸必须为正");
|
||
VdeBody body = host->body_create_box(w, h, d);
|
||
if (!body) return ab11_fail(host, VDE_PLUGIN_ERR_INTERNAL, "ab11: body_create_box 失败");
|
||
VdeBody* array = static_cast<VdeBody*>(host->alloc(sizeof(VdeBody)));
|
||
if (!array) {
|
||
if (host->body_destroy) host->body_destroy(body);
|
||
return ab11_fail(host, VDE_PLUGIN_ERR_BUFFER, "ab11: 句柄数组分配失败");
|
||
}
|
||
array[0] = body;
|
||
*bodies = array;
|
||
*count = 1;
|
||
return VDE_PLUGIN_OK;
|
||
}
|
||
|
||
int ab11_read_file(const VdePluginHost* host, const char* path, VdeBody** bodies,
|
||
size_t* count) {
|
||
if (bodies) *bodies = nullptr;
|
||
if (count) *count = 0;
|
||
if (!path) return ab11_fail(host, VDE_PLUGIN_ERR_INVALID_ARG, "ab11: 路径为空");
|
||
std::FILE* file = std::fopen(path, "rb");
|
||
if (!file) return ab11_fail(host, VDE_PLUGIN_ERR_IO, "ab11: 无法打开文件");
|
||
char buffer[256] = {};
|
||
const size_t read = std::fread(buffer, 1, sizeof(buffer) - 1, file);
|
||
std::fclose(file);
|
||
return ab11_read_memory(host, buffer, read, bodies, count);
|
||
}
|
||
|
||
const char* ab11_describe() {
|
||
return "VDE ABI 1.1 compatibility probe plugin (test-only)";
|
||
}
|
||
|
||
const VdeFormatPlugin kFormat = [] {
|
||
VdeFormatPlugin format{};
|
||
format.struct_size = static_cast<uint32_t>(sizeof(VdeFormatPlugin));
|
||
format.format_id = "ab11";
|
||
format.extensions = ".ab11";
|
||
format.probe = &ab11_probe;
|
||
format.read_file = &ab11_read_file;
|
||
format.read_memory = &ab11_read_memory;
|
||
format.write_file = nullptr;
|
||
format.write_memory = nullptr;
|
||
format.describe = &ab11_describe;
|
||
return format;
|
||
}();
|
||
|
||
} // namespace
|
||
|
||
extern "C" {
|
||
|
||
VDE_PLUGIN_EXPORT int vde_plugin_query(uint32_t host_abi_major, VdePluginInfo* info) {
|
||
if (!info || info->struct_size < sizeof(VdePluginInfo)) return VDE_PLUGIN_ERR_ABI;
|
||
if (host_abi_major != VDE_PLUGIN_ABI_MAJOR) return VDE_PLUGIN_ERR_ABI;
|
||
info->id = "com.vde.test.abi11";
|
||
info->name = "VDE ABI 1.1 Compatibility Probe Plugin";
|
||
info->version = "1.0.0";
|
||
info->kind = VDE_PLUGIN_KIND_FORMAT;
|
||
info->abi_major = VDE_PLUGIN_ABI_MAJOR;
|
||
info->abi_minor = VDE_PLUGIN_ABI_MINOR; // = 1(override)
|
||
info->capabilities = "format:ab11.read";
|
||
info->license = "Apache-2.0";
|
||
return VDE_PLUGIN_OK;
|
||
}
|
||
|
||
VDE_PLUGIN_EXPORT int vde_plugin_init(const VdePluginHost* host,
|
||
VdePluginRegistration* reg) {
|
||
if (!reg || reg->struct_size < sizeof(VdePluginRegistration))
|
||
return VDE_PLUGIN_ERR_ABI;
|
||
if (!host || host->abi_major != VDE_PLUGIN_ABI_MAJOR)
|
||
return ab11_fail(host, VDE_PLUGIN_ERR_ABI, "ab11: 宿主 ABI 不兼容");
|
||
// 旧插件只填 ABI 1.0 的注册字段(不碰 1.2 尾部字段)
|
||
reg->kind = VDE_PLUGIN_KIND_FORMAT;
|
||
reg->format = &kFormat;
|
||
reg->generic = nullptr;
|
||
return VDE_PLUGIN_OK;
|
||
}
|
||
|
||
VDE_PLUGIN_EXPORT void vde_plugin_shutdown() {}
|
||
|
||
} // extern "C"
|