예제 #1
0
        private void CopyCFDPreprocessing()
        {
            META.AnalysisTool tool = META.AnalysisTool.GetByName("cfd_preprocessing");
            if (tool != null)
            {
                string cfdPreprocessDir = Path.Combine(tool.InstallLocation, tool.OutputDirectory);
                if (Directory.Exists(cfdPreprocessDir))
                {
                    UtilityHelpers.CopyFiles(cfdPreprocessDir,
                                             Path.Combine(OutputDirectory, "PreProcessing"));
                }
                else
                {
                    Logger.Instance.AddLogMessage(cfdPreprocessDir + " does not exist. META analysis tool did not install correctly.", Severity.Warning);
                }
            }
            else
            {
                Logger.Instance.AddLogMessage("Could not retrieve information about CFD Preprocessing tool from registry!", Severity.Warning);
            }

            using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "TestBench_PreProcess.cmd")))
            {
                Template.postprocess_cmd appendscript = new Template.postprocess_cmd()
                {
                    ScriptName = "main_pre_process.py"
                };

                writer.WriteLine(appendscript.TransformText());
            }

            List <string> ScriptPaths = new List <string>();

            ScriptPaths.Add("PreProcessing\\CFDPreprocess.py");
            using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "main_pre_process.py")))
            {
                Template.postprocess_py postpy = new Template.postprocess_py()
                {
                    ScriptNames = ScriptPaths,      //ScriptNames = scripts,
                    LogName     = "pre_process.log"
                };
                writer.WriteLine(postpy.TransformText());
            }
        }
예제 #2
0
        private void CopyCFDPreprocessing()
        {
            META.AnalysisTool tool = META.AnalysisTool.GetByName("cfd_preprocessing");
            if (tool != null)
            {
                string cfdPreprocessDir = Path.Combine(tool.InstallLocation, tool.OutputDirectory);
                if (Directory.Exists(cfdPreprocessDir))
                {
                    UtilityHelpers.CopyFiles(cfdPreprocessDir,
                                             Path.Combine(OutputDirectory, "PreProcessing"));

                }
                else
                    Logger.Instance.AddLogMessage(cfdPreprocessDir + " does not exist. META analysis tool did not install correctly.", Severity.Warning);
            }
            else
                Logger.Instance.AddLogMessage("Could not retrieve information about CFD Preprocessing tool from registry!", Severity.Warning);

            using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "TestBench_PreProcess.cmd")))
            {
                Template.postprocess_cmd appendscript = new Template.postprocess_cmd()
                {
                    ScriptName = "main_pre_process.py"
                };

                writer.WriteLine(appendscript.TransformText());
            }

            List<string> ScriptPaths = new List<string>();
            ScriptPaths.Add("PreProcessing\\CFDPreprocess.py");
            using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "main_pre_process.py")))
            {
                Template.postprocess_py postpy = new Template.postprocess_py()
                {
                    ScriptNames = ScriptPaths,      //ScriptNames = scripts,
                    LogName = "pre_process.log"
                };
                writer.WriteLine(postpy.TransformText());
            }

        }
예제 #3
0
        public void GenerateProcessingScripts(List <string> ScriptPaths, bool preProcess = false)
        {
            // generate + copy
            if (ScriptPaths.Count > 0)
            {
                string cmdName, pyName, dirName, logName;
                if (preProcess)
                {
                    cmdName = "TestBench_PreProcess.cmd";
                    pyName  = "main_pre_process.py";
                    dirName = "PreProcessing";
                    logName = "pre_process.log";
                }
                else
                {
                    cmdName = "TestBench_PostProcess.cmd";
                    pyName  = "main_post_process.py";
                    dirName = "PostProcessing";
                    logName = "post_process.log";
                }

                Template.postprocess_cmd appendscript = new Template.postprocess_cmd()
                {
                    ScriptName = pyName
                };
                //using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "TestBench_PostProcess.cmd")))
                using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, cmdName)))
                {
                    writer.WriteLine(appendscript.TransformText());
                }

                List <string> scripts = new List <string>();
                foreach (var item in ScriptPaths)
                {
                    //scripts.Add(Path.GetFileName(item));
                    //dirName = Path.GetDirectoryName(item);

                    string outputScriptDir = Path.Combine(OutputDirectory, Path.GetDirectoryName(item));
                    if (!Directory.Exists(outputScriptDir))
                    {
                        Directory.CreateDirectory(outputScriptDir);
                    }

                    if (File.Exists(Path.Combine(ProjectDirectory, item)))
                    {
                        File.Copy(Path.Combine(ProjectDirectory, item), Path.Combine(outputScriptDir, Path.GetFileName(item)), true);
                    }
                }

                Template.postprocess_py postpy = new Template.postprocess_py()
                {
                    ScriptNames = ScriptPaths,      //ScriptNames = scripts,
                    LogName     = logName
                };
                //using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "main_post_process.py")))
                using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, pyName)))
                {
                    writer.WriteLine(postpy.TransformText());
                }

                string commonscriptdir = Path.Combine(ProjectDirectory, dirName, "common");
                if (Directory.Exists(commonscriptdir))
                {
                    string destDirName = Path.Combine(OutputDirectory, dirName, "common");
                    if (!Directory.Exists(destDirName))
                    {
                        Directory.CreateDirectory(destDirName);
                    }

                    DirectoryInfo dir   = new DirectoryInfo(commonscriptdir);
                    FileInfo[]    files = dir.GetFiles();
                    foreach (FileInfo file in files)
                    {
                        string temppath = Path.Combine(destDirName, file.Name);
                        file.CopyTo(temppath, true);
                    }
                }
            }
        }
예제 #4
0
        public void GenerateProcessingScripts(List<string> ScriptPaths, bool preProcess = false)
        {
            // generate + copy
            if (ScriptPaths.Count > 0)
            {
                string cmdName, pyName, dirName, logName;
                if (preProcess)
                {
                    cmdName = "TestBench_PreProcess.cmd";
                    pyName = "main_pre_process.py";
                    dirName = "PreProcessing";
                    logName = "pre_process.log";
                }
                else
                {
                    cmdName = "TestBench_PostProcess.cmd";
                    pyName = "main_post_process.py";
                    dirName = "PostProcessing";
                    logName = "post_process.log";
                }

                Template.postprocess_cmd appendscript = new Template.postprocess_cmd()
                {
                    ScriptName = pyName
                };
                //using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "TestBench_PostProcess.cmd")))
                using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, cmdName)))
                {
                    writer.WriteLine(appendscript.TransformText());
                }

                List<string> scripts = new List<string>();
                foreach (var item in ScriptPaths)
                {
                    //scripts.Add(Path.GetFileName(item));
                    //dirName = Path.GetDirectoryName(item);

                    string outputScriptDir = Path.Combine(OutputDirectory, Path.GetDirectoryName(item));
                    if (!Directory.Exists(outputScriptDir))
                        Directory.CreateDirectory(outputScriptDir);

                    if (File.Exists(Path.Combine(ProjectDirectory, item)))
                        File.Copy(Path.Combine(ProjectDirectory, item), Path.Combine(outputScriptDir, Path.GetFileName(item)), true);
                }

                Template.postprocess_py postpy = new Template.postprocess_py()
                {
                    ScriptNames = ScriptPaths,      //ScriptNames = scripts,
                    LogName = logName
                };
                //using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, "main_post_process.py")))
                using (StreamWriter writer = new StreamWriter(Path.Combine(this.OutputDirectory, pyName)))
                {
                    writer.WriteLine(postpy.TransformText());
                }

                string commonscriptdir = Path.Combine(ProjectDirectory, dirName, "common");
                if (Directory.Exists(commonscriptdir))
                {
                    string destDirName = Path.Combine(OutputDirectory, dirName, "common");
                    if (!Directory.Exists(destDirName))
                        Directory.CreateDirectory(destDirName);

                    DirectoryInfo dir = new DirectoryInfo(commonscriptdir);
                    FileInfo[] files = dir.GetFiles();
                    foreach (FileInfo file in files)
                    {
                        string temppath = Path.Combine(destDirName, file.Name);
                        file.CopyTo(temppath, true);
                    }
                }
            }
        }