private static string _SaveCase(Case cas, string meshVxtFilePath, string saveFilePath, IMonitor mon = null) { string root = Path.GetDirectoryName(meshVxtFilePath); string mesh = FoamConst.GetPolyMeshPath(root); string desc = FoamConst.GetDescFilePath(root); string res = CaseToBinFile(cas, desc, mon); if (res != "ok") { return(res); } return(Zip.CompressDirectory(mesh, saveFilePath)); }
private static string _ConvertCase(string caseFileName, string templeteFileName, string runDirName, IMonitor mon) { string res = Zip.UncomporessZip(templeteFileName, runDirName); if (res != "ok") { var err = string.Format("加载模板文件失败:\r\n 模板文件名:{0}\r\n 加载目标位置:{1}\r\n 错误描述:{2}", templeteFileName, runDirName, res); Err(mon, err); return(err); } else { Log(mon, string.Format("加载模板文件完成:\r\n 模板文件名:{0}", templeteFileName)); } string meshDir = FoamConst.GetPolyMeshPath(runDirName); if (!Directory.Exists(meshDir)) { Directory.CreateDirectory(meshDir); } res = Zip.UncomporessZip(caseFileName, meshDir); if (res != "ok") { var err = string.Format("加载工程文件失败:\r\n 工程文件名:{0}\r\n 错误描述:{1}", caseFileName, res); Err(mon, err); return(err); } else { Log(mon, string.Format("加载工程文件完成:\r\n 工程文件名:{0}\r\n", caseFileName)); } Case cas = null; res = CaseReader.BinFileToCase(ref cas, FoamConst.GetDescFilePath(runDirName), mon); if (cas == null) { var err = string.Format("非法工程文件格式:\r\n 工程文件名:{0}", caseFileName); Err(mon, err); return(err); } else { cas.Write(runDirName, mon); Log(mon, "工程结算环境配置完成"); return("ok"); } }
public static bool VerifyDirectory(string dir) { return(Directory.Exists(FoamConst.GetConstantPath(dir)) && Directory.Exists(FoamConst.GetPolyMeshPath(dir)) && File.Exists(Path.Combine(FoamConst.GetPolyMeshPath(dir), "points"))); }
public PatchReader(string vxtFileName, IMonitor mon = null) { this.boundaryFile = Path.Combine(FoamConst.GetPolyMeshPath(FoamConst.GetCaseRootFromVxt(vxtFileName)), "boundary"); monitor = mon; }