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;
        }
        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;
        }
        public override object Read(string path)
        {
            var obj = new RefineMeshDictData();
            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();
                string patch;
                switch ( identifier )
                {
                    case "set":
                        obj.setvalue = rootEntryNode.GetBasicValString();
                        break;
                    case "coordinateSystem":
                        obj.coordsys = rootEntryNode.GetBasicValEnum<CoordinateSystem>();
                        break;
                    case "globalCoeffs":
                        {
                            var dict = rootEntryNode.GetDictContent();
                            obj.globalCoeffs = GetCoeffs(ref dict, out patch);
                        }
                        break;
                    case "patchLocalCoeffs":
                        {
                            var dict = rootEntryNode.GetDictContent();
                            obj.patchLocalCoeffs = GetCoeffs(ref dict, out patch);
                            obj.patch = patch;
                        }
                        break;
                    case "directions":
                        {
                            obj.direction = new List<DirectionType>();
                            var s = rootEntryNode.ChildNodes[2].ChildNodes[1].GetArrayOfString();
                            foreach (string t in s)
                            {
                                obj.direction.Add(t.ToEnum<DirectionType>());
                            }
                        }
                        break;
                    case "useHexTopology":
                        obj.useHexTopology = rootEntryNode.GetBasicValBool();
                        break;
                    case "geometricCut":
                        obj.geometricCut = rootEntryNode.GetBasicValBool();
                        break;
                    case "writeMesh":
                        obj.writeMesh = rootEntryNode.GetBasicValBool();
                        break;
                }
            }
            return obj;
        }
        public override object Read(string path)
        {
            var obj = new RASPropertiesData();
            string text = Load(path);

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

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                switch (rootEntryNode.GetEntryIdentifier())
                {
                    case "RASModel":
                        obj.RasModelName = rootEntryNode.GetBasicValString();
                        break;
                    case "turbulence":
                        obj.Turbulence = rootEntryNode.GetBasicValEnum<OnOffValue>();
                        break;
                    case "printCoeffs":
                        obj.PrintCoeffs = rootEntryNode.GetBasicValEnum<OnOffValue>();
                        break;
                }
            }
            return obj;
        }
        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;
        }
        public override object Read(string path)
        {
            var obj = new DecomposeParDictData();
            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 "numberOfSubdomains":
                        obj.numberOfSubdomains = rootEntryNode.GetBasicValInt();
                        break;
                    case "method":
                        obj.method = rootEntryNode.GetBasicValEnum<DecompositionMethod>();
                        break;
                    case "hierarchicalCoeffs":
                        obj.hCoefs = GetHierarchicalCoeffs(rootEntryNode.GetDictContent());
                        break;
                }
            }
            return obj;
        }
Example #7
0
        public override object Read(string path)
        {
            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);
            var d = new Vertice();

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                    case "value":
                        d.X = rootEntryNode.GetDictArrayBody().GetArrayOfDecimal()[0];
                        d.Y = rootEntryNode.GetDictArrayBody().GetArrayOfDecimal()[1];
                        d.Z = rootEntryNode.GetDictArrayBody().GetArrayOfDecimal()[2];
                        break;
                }
            }
            return d;
        }
        public override object Read(string path)
        {
            var obj = new AirfoilPropertiesData();
            string text;
            using (var reader = new StreamReader(path))
            {
                text = reader.ReadToEnd();
            }
            var grammar = new OpenFoamGrammar();
            var parser = new Parser(grammar);
            var tree = parser.Parse(text);
            obj.airfoilData = new List<Vertice>();

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var id = rootEntryNode.GetEntryIdentifier();
                if (id == "airfoilData")
                {
                    var dict = rootEntryNode.GetDictContent().ChildNodes[1];
                    for (int i = 0; i < dict.ChildNodes.Count; i++)
                    {
                        var array_head = dict.ChildNodes[i].ChildNodes[0].ChildNodes[1].ChildNodes;
                        var v = new Vertice();
                        v.X = Convert.ToDecimal(array_head[0].ChildNodes[0].Token.Value);
                        v.Y = Convert.ToDecimal(array_head[1].ChildNodes[0].Token.Value);
                        v.Z = Convert.ToDecimal(array_head[2].ChildNodes[0].Token.Value);
                        obj.airfoilData.Add( v );
                    }
                }
            }
            return obj;
        }
        public override object Read(string path)
        {
            var rawData = new DecomposeParDictData();
            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 "numberOfSubdomains":
                        rawData.numberOfSubdomains = rootEntryNode.GetBasicValInt();
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var obj = new AirfoilPropertiesInstance();
            string text = Load(path);

            var grammar = new OpenFoamGrammar();
            var parser = new Parser(grammar);
            var tree = parser.Parse(text);
            obj.row = new List<Vertice>();

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var id = rootEntryNode.GetEntryIdentifier();
                if (id == "airfoilData")
                {
                    var dict = rootEntryNode.GetDictContent().ChildNodes[1];
                    foreach (ParseTreeNode t in dict.ChildNodes)
                    {
                        var array_head = t.ChildNodes[0].ChildNodes[1].ChildNodes;
                        var v = new Vertice
                                    {
                                        X = Convert.ToDecimal(array_head[0].ChildNodes[0].Token.Value),
                                        Y = Convert.ToDecimal(array_head[1].ChildNodes[0].Token.Value),
                                        Z = Convert.ToDecimal(array_head[2].ChildNodes[0].Token.Value)
                                    };
                        obj.row.Add( v );
                    }
                }
            }
            obj.airfoilName = FileName;
            return obj;
        }
        public override object Read(string path)
        {
            var rawData = new AblPropertiesData();
            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 "turbineArrayOn":
                        rawData.turbineArrayOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "driveWindOn":
                        rawData.driveWindOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "UWindSpeed":
                        rawData.UWindSpeedDim = rootEntryNode.GetDimVal();
                        break;
                    case "UWindDir":
                        rawData.UWindDir = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "hWind":
                        rawData.HWindDim = rootEntryNode.GetDimVal();
                        break;
                    case "alpha":
                        rawData.alpha = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "lowerBoundaryName":
                        rawData.lowerBoundaryName = rootEntryNode.GetBasicValString();
                        break;
                    case "upperBoundaryName":
                        rawData.upperBoundaryName = rootEntryNode.GetBasicValString();
                        break;
                    case "statisticsOn":
                        rawData.statisticsOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "statisticsFrequency":
                        rawData.statisticsFrequency = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "meanAvgStartTime":
                        rawData.meanAvgStartTime = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "corrAvgStartTime":
                        rawData.corrAvgStartTime = rootEntryNode.GetBasicValDecimal();
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var rawData = new TransportPropertiesData();
            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 "transportModel":
                        rawData.transportModel = rootEntryNode.GetBasicValEnum<TransportModel>();
                        break;
                    case "nu":
                        rawData.MolecularViscosity = rootEntryNode.GetDimVal().ScalarValue;
                        break;
                    case "TRef":
                        rawData.TRef = rootEntryNode.GetDimVal().ScalarValue;
                        break;
                    case "LESModel":
                        rawData.LESModel = rootEntryNode.GetBasicValEnum<LesModel>();
                        break;
                    case "Cs":
                        rawData.Cs = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "deltaLESCoeff":
                        rawData.deltaLESCoeff = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "kappa":
                        rawData.kappa = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "betaM":
                        rawData.betaM = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "gammM":
                        rawData.gammM = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "z0":
                        rawData.z0 = rootEntryNode.GetDimVal().ScalarValue;
                        break;
                    case "q0":
                        rawData.q0 = rootEntryNode.GetDimVal().ScalarValue;
                        break;
                    case "surfaceStressModel":
                        rawData.surfaceStressModel = rootEntryNode.GetBasicValEnum<SurfaceStressModel>();
                        break;
                    case "betaSurfaceStress":
                        rawData.betaSurfaceStress = rootEntryNode.GetBasicValDecimal();
                        break;
                }
            }
            return rawData;
        }
Example #13
0
        public override object Read(string path)
        {
            var rawData = new FieldData();
            string txt;
            using (var reader = new StreamReader(path))
            {
                txt = reader.ReadToEnd();
            }

            var formatMatch = Regex.Match(txt, FieldFormatRegex);
            rawData.FieldFormat = (Format)Enum.Parse(typeof(Format), formatMatch.Groups[1].Value);

            var classMatch = Regex.Match(txt, FieldClassRegex);
            rawData.FieldClass = (FieldClass)Enum.Parse(typeof(FieldClass), classMatch.Groups[1].Value);

            var locationMatch = Regex.Match(txt, FieldLocationRegex);
            rawData.FieldLocation = locationMatch.Groups[1].Value;

            var objectMatch = Regex.Match(txt, FieldObjectRegex);
            rawData.FieldObject = objectMatch.Groups[1].Value;

            var dimMatch = Regex.Match(txt, DimRegex);
            rawData.Dimensions.Mass = decimal.Parse(dimMatch.Groups[1].Value);
            rawData.Dimensions.Length = decimal.Parse(dimMatch.Groups[2].Value);
            rawData.Dimensions.Time = decimal.Parse(dimMatch.Groups[3].Value);
            rawData.Dimensions.Temperature = decimal.Parse(dimMatch.Groups[4].Value);
            rawData.Dimensions.Quantity = decimal.Parse(dimMatch.Groups[5].Value);
            rawData.Dimensions.Current = decimal.Parse(dimMatch.Groups[6].Value);
            rawData.Dimensions.LuminousIntensity = decimal.Parse(dimMatch.Groups[7].Value);

            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 "boundaryField":
                        ParsePatches(rootEntryNode.ChildNodes[2], rawData);
                        break;
                    case "internalField":
                        rawData.InternalFieldType = GetFieldType(rootEntryNode);
                        rawData.InternalFieldValue = GetFieldValue(rootEntryNode.ChildNodes[2].ChildNodes[0]);
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var rawData = new BlockMeshDictData();
            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 "convertToMeters":
                        rawData.convertToMeters = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "vertices":
                        var vertices = rootEntryNode.GetDictArrayBody().GetVectorsArray();
                        rawData.vertices.AddRange(vertices);
                        break;
                    case "blocks":
                        var blocks = rootEntryNode.GetDictArrayBody().GetArray(n => n);
                        rawData.MeshBlocks.vertexNumbers.AddRange(blocks[1].ChildNodes[1].GetArrayOfInt32());
                        rawData.MeshBlocks.numberOfCells.AddRange(blocks[2].ChildNodes[1].GetArrayOfInt32());
                        rawData.MeshBlocks.gradingNumbers.AddRange(blocks[4].ChildNodes[1].GetArrayOfInt32());
                        
                        var gradingText = blocks[3].Token.Text;
                        rawData.MeshBlocks.grading = (Grading)Enum.Parse(typeof(Grading), gradingText);
                        break;
                    case "boundary":
                        var boundaries = rootEntryNode.GetDictArrayBody().GetArray(ParseBoundary);
                        rawData.boundaries.AddRange(boundaries);
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var rawData = new SetFieldsAblDictData();
            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 "xMax":
                        rawData.xMax = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "yMax":
                        rawData.yMax = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "zMax":
                        rawData.zMax = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "logInit":
                        rawData.logInit = rootEntryNode.GetBasicValBool();
                        break;
                    case "deltaU":
                        rawData.deltaU = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "deltaV":
                        rawData.deltaV = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Uperiods":
                        rawData.Uperiods = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Vperiods":
                        rawData.Vperiods = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "zPeak":
                        rawData.zPeak = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "zInversion":
                        rawData.zInversion = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "widthInversion":
                        rawData.widthInversion = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Tbottom":
                        rawData.Tbottom = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Ttop":
                        rawData.Ttop = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "dTdz":
                        rawData.dTdz = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Ug":
                        rawData.Ug = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "UgDir":
                        rawData.UgDir = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "z0":
                        rawData.z0 = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "kappa":
                        rawData.kappa = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "updateInternalFields":
                        rawData.updateInternalFields = rootEntryNode.GetBasicValBool();
                        break;
                    case "updateBoundaryFields":
                        rawData.updateBoundaryFields = rootEntryNode.GetBasicValBool();
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var obj = new TurbinePropertiesData();
            string text;

            if (!File.Exists(path))
            {
                if (!useDefault) return obj;
                WriteToFile(path, DefaultData);
            }

            using (var reader = new StreamReader(path))
            {
                text = reader.ReadToEnd();
            }
            var grammar = new OpenFoamGrammar();
            var parser = new Parser(grammar);
            var tree = parser.Parse(text);

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();

                switch ( identifier )
                {
                    case "NumBl":
                        obj.NumBl = rootEntryNode.GetBasicValInt();
                        break;
                    case "TipRad":
                        obj.TipRad = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "HubRad":
                        obj.HubRad = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "UndSling":
                        obj.UndSling = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "OverHang":
                        obj.OverHang = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "TowerHt":
                        obj.TowerHt = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "Twr2Shft":
                        obj.Twr2Shft = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "ShftTilt":
                        obj.ShftTilt = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "PreCone":
                        {
                            var dict = rootEntryNode.GetDictArrayBody();
                            var array = dict.GetArrayOfDecimal();
                            obj.PreCone = new Vertice( array[0], array[1], array[2]);
                        }
                        break;
                    case "GBRatio":
                        obj.GBRatio = rootEntryNode.GetBasicValDecimal();;
                        break;
                    case "GenIner":
                        obj.GenIner = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "HubIner":
                        obj.HubIner = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "BladeIner":
                        obj.BladeIner = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "TorqueControllerType":
                        obj.TorqueControllerType = rootEntryNode.GetBasicValEnum<ControllerType>();
                        break;
                    case "YawControllerType":
                        obj.YawControllerType = rootEntryNode.GetBasicValEnum<ControllerType>();
                        break;
                    case "PitchControllerType":
                        obj.PitchControllerType = rootEntryNode.GetBasicValEnum<ControllerType>();
                        break;
                    case "TorqueControllerParams":
                        obj.torqueControllerParams = TorqueControllerParamsHandler(rootEntryNode.GetDictContent());
                        break;
                    case "PitchControllerParams":
                        obj.pitchControllerParams = PitchControllerParamsHandler(rootEntryNode.GetDictContent());
                        break;
                    case "Airfoils":
                        {
                            var dict = rootEntryNode.GetDictArrayBody();
                            for (int i = 0; i < dict.ChildNodes.Count; i++)
                            {
                                var item = new AirfoilBlade();
                                item.AirfoilName = dict.ChildNodes[i].ChildNodes[0].Token.Text.Replace("\"", "");
                                item.Blade = new List<Vertice>();
                                obj.airfoilBlade.Add(item);
                            }
                        }
                        break;
                    case "BladeData":
                        {
                            var dict = rootEntryNode.GetDictArrayBody();
                            for (int i = 0; i < dict.ChildNodes.Count; i++)
                            {
                                var array_head = dict.ChildNodes[i].ChildNodes[0].ChildNodes[1].ChildNodes;
                                if (array_head.Count > 3)
                                {
                                    var airfoil_id = Convert.ToInt32(array_head[3].ChildNodes[0].Token.Value);
                                    if ((airfoil_id >= 0) && (airfoil_id < obj.airfoilBlade.Count))
                                    {
                                        var blade_prop = new Vertice();
                                        blade_prop.X = Convert.ToDecimal(array_head[0].ChildNodes[0].Token.Value);
                                        blade_prop.Y = Convert.ToDecimal(array_head[1].ChildNodes[0].Token.Value);
                                        blade_prop.Z = Convert.ToDecimal(array_head[2].ChildNodes[0].Token.Value);
                                        obj.airfoilBlade[airfoil_id].Blade.Add(blade_prop);
                                    }
                                }
                            }
                        }
                        break;
                }
            }

            return obj;
        }
        public override object Read(string path)
        {
            var rawData = new ControlDictData();
            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 "application":
                        rawData.application = rootEntryNode.GetBasicValEnum<ApplicationSolver>();
                        break;
                    case "startFrom":
                        rawData.startFrom = rootEntryNode.GetBasicValEnum<StartFrom>();
                        break;
                    case "startTime":
                        rawData.startTime = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "stopAt":
                        rawData.stopAt = rootEntryNode.GetBasicValEnum<StopAt>();
                        break;
                    case "endTime":
                        rawData.endTime = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "deltaT":
                        rawData.deltaT = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "writeControl":
                        rawData.writeControl = rootEntryNode.GetBasicValEnum<WriteControl>();
                        break;
                    case "writeInterval":
                        rawData.writeInterval = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "purgeWrite":
                        rawData.purgeWrite = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "writeFormat":
                        rawData.writeFormat = rootEntryNode.GetBasicValEnum<WriteFormat>();
                        break;
                    case "writePrecision":
                        rawData.writePrecision = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "writeCompression":
                        rawData.writeCompression = rootEntryNode.GetBasicValEnum<WriteCompression>();
                        break;
                    case "timeFormat":
                        rawData.timeFormat = rootEntryNode.GetBasicValEnum<TimeFormat>();
                        break;
                    case "timePrecision":
                        rawData.timePrecision = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "runTimeModifiable":
                        rawData.runTimeModifiable = rootEntryNode.GetBasicValEnum<FlagYesNo>();
                        break;
                    case "adjustTimeStep":
                        rawData.adjustTimeStep = rootEntryNode.GetBasicValEnum<FlagYesNo>();
                        break;
                    case "maxCo":
                        rawData.maxCo = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "maxDeltaT":
                        rawData.maxDeltaT = rootEntryNode.GetBasicValDecimal();
                        break;
                }
            }
            return rawData;
        }
        public override object Read(string path)
        {
            var turbine_prop = new TurbineArrayPropData();
            string text;
            using (var reader = new StreamReader(path))
            {
                text = reader.ReadToEnd();
            }

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

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();

                if ( identifier.Equals("globalProperties") )
                {
                    var dict = rootEntryNode.GetDictContent();
                    for (int i = 0; i < dict.ChildNodes.Count; i++)
                    {
                        var node = dict.ChildNodes[i].ChildNodes[0];
                        var id = node.GetEntryIdentifier();
                        if ( id.Equals("outputControl") )
                        {
                            turbine_prop.outputControl = node.GetBasicValEnum<OutputControl>();
                        }
                        else if ( id.Equals("outputInterval") )
                        {
                            turbine_prop.outputInterval = node.GetBasicValDecimal();
                        }
                    }
                }
                else if ( identifier.StartsWith("turbine") )
                {
                    var item = new TurbineInstance();
                    var dict = rootEntryNode.GetDictContent();
                    for (int i = 0; i < dict.ChildNodes.Count; i++)
                    {
                        var node = dict.ChildNodes[i].ChildNodes[0];
                        var id = node.GetEntryIdentifier();
                        switch ( id )
                        {
                            case "turbineType":
                                item.turbineType = node.GetBasicValString();
                                break;
                            case "baseLocation":
                                item.baseLocation = new Vertice();
                                item.baseLocation.X =node.GetDictArrayBody().GetArrayOfDecimal()[0];
                                item.baseLocation.Y =node.GetDictArrayBody().GetArrayOfDecimal()[1];
                                item.baseLocation.Z =node.GetDictArrayBody().GetArrayOfDecimal()[2];
                                break;
                            case "numBladePoints":
                                item.numBladePoints = node.GetBasicValDecimal();
                                break;
                            case "pointDistType":
                                item.pointDistType = node.GetBasicValString();
                                break;
                            case "pointInterpType":
                                item.pointInterpType = node.GetBasicValEnum<PointInterpType>();
                                break;
                            case "bladeUpdateType":
                                item.bladeUpdateType = node.GetBasicValEnum<BladeUpdateType>();
                                break;
                            case "epsilon":
                                item.epsilon = node.GetBasicValDecimal();
                                break;
                            case "tipRootLossCorrType":
                                item.tipRootLossCorrType = node.GetBasicValEnum<TipRootLossCorrType>();
                                break;
                            case "rotationDir":
                                item.rotationDir = node.GetBasicValString();
                                break;
                            case "Azimuth":
                                item.azimuth = node.GetBasicValDecimal();
                                break;
                            case "RotSpeed":
                                item.rotSpeed = node.GetBasicValDecimal();
                                break;
                            case "Pitch":
                                item.pitch = node.GetBasicValDecimal();
                                break;
                            case "NacYaw":
                                item.nacYaw = node.GetBasicValDecimal();
                                break;
                            case "fluidDensity":
                                item.fluidDensity = node.GetBasicValDecimal();
                                break;
                        }
                    }
                    turbine_prop.turbine.Add(item);
                }
            }
            return turbine_prop;
        }
        public override object Read(string path)
        {
            var obj = new TurbineArrayPropFASTData();
            string text;
            using (var reader = new StreamReader(path))
            {
                text = reader.ReadToEnd();
            }

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

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                if (identifier.Equals("general"))
                {
                    var dict = rootEntryNode.GetDictContent();
                    for (int i = 0; i < dict.ChildNodes.Count; i++)
                    {
                        var node = dict.ChildNodes[i].ChildNodes[0];
                        var id = node.GetEntryIdentifier();
                        switch (id)
                        {
                            case "yawAngle":
                                obj.general.yawAngle = node.GetBasicValDecimal();
                                break;
                            case "numberofBld":
                                obj.general.numberofBld = node.GetBasicValInt();
                                break;
                            case "numberofBldPts":
                                obj.general.numberofBldPts = node.GetBasicValInt();
                                break;
                            case "rotorDiameter":
                                obj.general.rotorDiameter = node.GetBasicValDecimal();
                                break;
                            case "epsilon":
                                obj.general.epsilon = node.GetBasicValDecimal();
                                break;
                            case "smearRadius":
                                obj.general.smearRadius = node.GetBasicValDecimal();
                                break;
                            case "effectiveRadiusFactor":
                                obj.general.effectiveRadiusFactor = node.GetBasicValDecimal();
                                break;
                            case "pointInterpType":
                                obj.general.pointInterpType = node.GetBasicValInt();
                                break;
                        }
                    }
                }
                else if (identifier.StartsWith("turbine"))
                {
                    var instance = new TurbineInstanceFAST();
                    var dict = rootEntryNode.GetDictContent();
                    for (int i = 0; i < dict.ChildNodes.Count; i++)
                    {
                        var node = dict.ChildNodes[i].ChildNodes[0];
                        var id = node.GetEntryIdentifier();
                        switch ( id )
                        {
                            case "refx":
                                instance.refx = node.GetBasicValDecimal();
                                break;
                            case "refy":
                                instance.refy = node.GetBasicValDecimal();
                                break;
                            case "refz":
                                instance.refz = node.GetBasicValDecimal();
                                break;
                            case "hubz":
                                instance.hubz = node.GetBasicValDecimal();
                                break;
                        }
                    }
                    obj.turbine.Add(instance);
                }
            }
            return obj;
        }