예제 #1
0
        public override object Read(string path)
        {
            var    obj = new FvSolutionData();
            string txt = Load(path);

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

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                case "solvers":
                    obj.Solvers = GetSolvers(rootEntryNode.GetDictContent());
                    break;

                case "PISO":
                case "SIMPLE":
                case "PIMPLE":
                    obj.Solution = GetSolution(identifier, rootEntryNode.GetDictContent());
                    break;
                }
            }
            return(obj);
        }
예제 #2
0
        public override object Read(string path)
        {
            var obj = new FvSolutionData();
            string txt = Load(path);

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

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                    case "solvers":
                        obj.Solvers = GetSolvers(rootEntryNode.GetDictContent());
                        break;
                    case "PISO":
                    case "SIMPLE":
                    case "PIMPLE":
                        obj.Solution = GetSolution(identifier, rootEntryNode.GetDictContent());
                        break;
                }
            }
            return obj;
        }