private void ParseOptions(ParseTreeNode node, FvSolutionData rawData)
 {
     foreach (ParseTreeNode rootEntryNode in node.FindDictEntries(null))
     {
         var identifier = rootEntryNode.GetEntryIdentifier();
         switch (identifier)
         {
             case "nCorrectors":
                 rawData.Options.nCorrectors = rootEntryNode.GetBasicValInt();
                 break;
             case "nNonOrthogonalCorrectors":
                 rawData.Options.nNonOrthogonalCorrectors = rootEntryNode.GetBasicValInt();
                 break;
             case "pdRefOn":
                 rawData.Options.pdRefOn = rootEntryNode.GetBasicValBool();
                 break;
             case "pdRefCell":
                 rawData.Options.pdRefCell = rootEntryNode.GetBasicValInt();
                 break;
             case "pdRefValue":
                 rawData.Options.pdRefValue = rootEntryNode.GetBasicValInt();
                 break;
             case "tempEqnOn":
                 rawData.Options.tempEqnOn = rootEntryNode.GetBasicValBool();
                 break;
         }
     }
 }
        public override object Read(string path)
        {
            var rawData = new FvSolutionData();
            string txt;
            using (var reader = new StreamReader(path))
            {
                txt = reader.ReadToEnd();
            }

            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 "options":
                        ParseOptions(rootEntryNode.ChildNodes[2], rawData);
                        break;
                    case "solvers":
                        ParseSolvers(rootEntryNode.ChildNodes[2], rawData);
                        break;
                }
            }
            return rawData;
        }
Exemple #3
0
        private void ParseOptions(ParseTreeNode node, FvSolutionData rawData)
        {
            foreach (ParseTreeNode rootEntryNode in node.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                case "nCorrectors":
                    rawData.Options.nCorrectors = rootEntryNode.GetBasicValInt();
                    break;

                case "nNonOrthogonalCorrectors":
                    rawData.Options.nNonOrthogonalCorrectors = rootEntryNode.GetBasicValInt();
                    break;

                case "pdRefOn":
                    rawData.Options.pdRefOn = rootEntryNode.GetBasicValBool();
                    break;

                case "pdRefCell":
                    rawData.Options.pdRefCell = rootEntryNode.GetBasicValInt();
                    break;

                case "pdRefValue":
                    rawData.Options.pdRefValue = rootEntryNode.GetBasicValInt();
                    break;

                case "tempEqnOn":
                    rawData.Options.tempEqnOn = rootEntryNode.GetBasicValBool();
                    break;
                }
            }
        }
Exemple #4
0
        public override object Read(string path)
        {
            var    rawData = new FvSolutionData();
            string txt;

            using (var reader = new StreamReader(path))
            {
                txt = reader.ReadToEnd();
            }

            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 "options":
                    ParseOptions(rootEntryNode.ChildNodes[2], rawData);
                    break;

                case "solvers":
                    ParseSolvers(rootEntryNode.ChildNodes[2], rawData);
                    break;
                }
            }
            return(rawData);
        }
 private void ParseSolvers(ParseTreeNode node, FvSolutionData rawData)
 {
     foreach (ParseTreeNode rootEntryNode in node.FindDictEntries(null))
     {
         var s = new MLinearSolver();
         s.Name = rootEntryNode.GetEntryIdentifier();
         rawData.Solvers.Add(s);
         ParseSolver(rootEntryNode.ChildNodes[2], s);
     }
 }
Exemple #6
0
 private void ParseSolvers(ParseTreeNode node, FvSolutionData rawData)
 {
     foreach (ParseTreeNode rootEntryNode in node.FindDictEntries(null))
     {
         var s = new MLinearSolver();
         s.Name = rootEntryNode.GetEntryIdentifier();
         rawData.Solvers.Add(s);
         ParseSolver(rootEntryNode.ChildNodes[2], s);
     }
 }