-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_modular_system.py
More file actions
77 lines (61 loc) · 2.45 KB
/
Copy pathrun_modular_system.py
File metadata and controls
77 lines (61 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
"""
运行模块化网格重建系统或化学-物理耦合仿真的入口脚本
支持多种运行模式
"""
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QSurfaceFormat
def setup_opengl_format():
"""设置OpenGL格式"""
fmt = QSurfaceFormat()
fmt.setVersion(3, 3)
fmt.setDepthBufferSize(24)
QSurfaceFormat.setDefaultFormat(fmt)
def main():
"""主函数"""
import argparse
parser = argparse.ArgumentParser(description='化学-物理耦合仿真系统')
parser.add_argument('--mode', choices=['mesh', 'coupled'], default='coupled',
help='运行模式: mesh(纯网格系统) 或 coupled(化学-物理耦合)')
parser.add_argument('--scene', type=str, help='指定化学反应场景名称')
args = parser.parse_args()
print(f"启动{args.mode}模式...")
# 设置OpenGL格式
setup_opengl_format()
# 创建Qt应用程序
app = QApplication(sys.argv)
app.setStyle('Fusion')
try:
if args.mode == 'coupled':
# 运行化学-物理耦合仿真
from coupled_chemistry_physics_gui import CoupledSimulationMainWindow
window = CoupledSimulationMainWindow()
window.show()
# 如果指定了场景,自动选择
if args.scene and hasattr(window, 'scenario_combo'):
index = window.scenario_combo.findText(args.scene)
if index >= 0:
window.scenario_combo.setCurrentIndex(index)
print("化学-物理耦合仿真系统启动完成")
print("功能特性:")
print(" • 实时化学浓度可视化")
print(" • 物理SPH流体仿真")
print(" • 多种化学反应场景")
print(" • 参数调节和监控")
else:
# 运行原始模块化网格系统
from modular_mesh_system.gui.main_window import MainWindow
window = MainWindow()
window.show()
print("模块化网格重建系统启动完成")
print("请在GUI中测试各项功能")
# 运行应用程序
return app.exec()
except Exception as e:
print(f"程序运行出错: {e}")
import traceback
traceback.print_exc()
return 1
if __name__ == "__main__":
sys.exit(main())