refactor: 引擎源码移至 src/,编译产物统一至 release/
- 源码: engines/c/ → engines/src/c/ - 源码: engines/cpp/ → engines/src/cpp/ - 源码: engines/fortran/ → engines/src/fortran/ - 编译产物: engines/release/ (静态编译) - dynamics_c.exe (516KB, C 引擎) - dynamics_cpp.exe (3.3MB, C++ 引擎) - dynamics_f90.exe (988KB, Fortran 引擎) - compute.py: engine_map 指向 release/ - compute.py: param.json 和校准缓存移至 release/ - engine_dll.py: DLL 搜索路径指向 release/ - release/ 目录纳入 git 版本管理,用户克隆后直接可用
This commit is contained in:
+9
-9
@@ -1134,11 +1134,11 @@ def run_engine(engine, input_dir, output_dir, config):
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
system = platform.system().lower()
|
||||
engine_map = {
|
||||
"c": "engines/c/build/dynamics_c",
|
||||
"cpp": "engines/cpp/build/dynamics_cpp",
|
||||
"c++": "engines/cpp/build/dynamics_cpp",
|
||||
"fortran": "engines/fortran/build/dynamics_f90",
|
||||
"f90": "engines/fortran/build/dynamics_f90",
|
||||
"c": "engines/release/dynamics_c",
|
||||
"cpp": "engines/release/dynamics_cpp",
|
||||
"c++": "engines/release/dynamics_cpp",
|
||||
"fortran": "engines/release/dynamics_f90",
|
||||
"f90": "engines/release/dynamics_f90",
|
||||
"python": None, # 特殊处理:用 sys.executable 调用 main.py
|
||||
}
|
||||
if engine not in engine_map:
|
||||
@@ -1208,7 +1208,7 @@ def run_engine(engine, input_dir, output_dir, config):
|
||||
"camera_center_y": float(config.get("camera_center_y", 0.0)),
|
||||
"camera_center_z": float(config.get("camera_center_z", 0.0)),
|
||||
}
|
||||
param_path = os.path.join(script_dir, "engines", engine, "param.json")
|
||||
param_path = os.path.join(script_dir, "engines", "release", f"{engine}.json")
|
||||
os.makedirs(os.path.dirname(param_path), exist_ok=True)
|
||||
with open(param_path, "w", encoding="utf-8") as f:
|
||||
json.dump(param_json, f, indent=2)
|
||||
@@ -1226,7 +1226,7 @@ def run_engine(engine, input_dir, output_dir, config):
|
||||
n_atoms_calib = len(ATOM_IDS) if ATOM_IDS is not None else 0
|
||||
|
||||
# 尝试读取缓存;当 n_atoms 相同且 NT 在 50% 范围内时视为有效
|
||||
_cache_path = os.path.join(script_dir, "engines", engine, "_calib_cache.json")
|
||||
_cache_path = os.path.join(script_dir, "engines", "release", f"_calib_{engine}.json")
|
||||
_step_time = None
|
||||
try:
|
||||
with open(_cache_path, encoding="utf-8") as _cf:
|
||||
@@ -1241,10 +1241,10 @@ def run_engine(engine, input_dir, output_dir, config):
|
||||
if _step_time is None:
|
||||
_calib_param = dict(param_json)
|
||||
_calib_param["NT"] = _calib_nt
|
||||
_calib_path = os.path.join(script_dir, "engines", engine, "_calib.json")
|
||||
_calib_path = os.path.join(script_dir, "engines", "release", f"_calib_{engine}.json")
|
||||
with open(_calib_path, "w", encoding="utf-8") as _cf:
|
||||
json.dump(_calib_param, _cf, indent=2)
|
||||
_calib_outdir = os.path.join(script_dir, "engines", engine, "_calib_out")
|
||||
_calib_outdir = os.path.join(script_dir, "engines", "release", f"_calib_{engine}_out")
|
||||
os.makedirs(_calib_outdir, exist_ok=True)
|
||||
_ct0 = time.time()
|
||||
subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user