public override object Read(string path)
        {
            var obj = new TurbulencePropertiesData();
            string text = Load(path);

            var grammar = new OpenFoamGrammar();
            var parser = new Parser(grammar);
            var tree = parser.Parse(text);

            _fileHandler = null;

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                if (rootEntryNode.GetEntryIdentifier() == "simulationType")
                {
                    obj.SimulationType = rootEntryNode.GetBasicValEnum<TurbulenceModel>();
                    if (obj.SimulationType == TurbulenceModel.RASModel)
                    {
                        _fileHandler = new RASPropertiesHandler();
                        obj.RasProperties = (RASPropertiesData) _fileHandler.Read(path);
                    }
                    else if (obj.SimulationType == TurbulenceModel.LESModel)
                    {
                        _fileHandler = new LESPropertiesHandler();
                        obj.LesProperties = (LESPropertiesData) _fileHandler.Read(path);
                    }
                    break;
                }
            }
            return obj;
        }
Ejemplo n.º 2
0
 public void SetFileHandler(FoamFileHandler handler)
 {
 }
 public void SetFileHandler(FoamFileHandler handler)
 {
     _fileHandler = handler;
 }