Esempio n. 1
0
        private List<FvSolver> GetSolvers(ParseTreeNode dict)
        {
            var p = new List<FvSolver>();

            foreach (var node in dict.ChildNodes)
            {
                var solver = new FvSolver();
                var x = node.ChildNodes[0];
                solver.Name = x.GetEntryIdentifier();
                x = x.GetDictContent();
                foreach (var y in x.ChildNodes)
                {
                    var v = y.ChildNodes[0];
                    var id = v.GetEntryIdentifier();
                    switch (id)
                    {
                        case "solver":
                            solver.Solver = v.GetBasicValEnum<LinearSolver>();
                            break;
                        case "preconditioner":
                            solver.Preconditioner = v.GetBasicValEnum<Preconditioner>();
                            break;
                        case "tolerance":
                            solver.Tolerance = v.GetBasicValDecimal();
                            break;
                        case "relTol":
                            solver.RelTol = v.GetBasicValDecimal();
                            break;
                    }
                }
                p.Add(solver);
            }
            return p;
        }
Esempio n. 2
0
        private List <FvSolver> GetSolvers(ParseTreeNode dict)
        {
            var p = new List <FvSolver>();

            foreach (var node in dict.ChildNodes)
            {
                var solver = new FvSolver();
                var x      = node.ChildNodes[0];
                solver.Name = x.GetEntryIdentifier();
                x           = x.GetDictContent();
                foreach (var y in x.ChildNodes)
                {
                    var v  = y.ChildNodes[0];
                    var id = v.GetEntryIdentifier();
                    switch (id)
                    {
                    case "solver":
                        solver.Solver = v.GetBasicValEnum <LinearSolver>();
                        break;

                    case "preconditioner":
                        solver.Preconditioner = v.GetBasicValEnum <Preconditioner>();
                        break;

                    case "tolerance":
                        solver.Tolerance = v.GetBasicValDecimal();
                        break;

                    case "relTol":
                        solver.RelTol = v.GetBasicValDecimal();
                        break;
                    }
                }
                p.Add(solver);
            }
            return(p);
        }
        public JsonResult VFvSolutionSolverSave(List<string[]> modified)
        {
            var sd = GetSolverData();
            var l = sd.FvSolution.Solvers;

            l.Clear();
            foreach (var x in modified)
            {
                if ((x[0] != null) && (x[1] != null) && (x[2] != null))
                {
                    var s = new FvSolver();
                    s.Name = x[0];
                    s.Solver = (LinearSolver) Enum.Parse(typeof (LinearSolver), x[1]);
                    s.Preconditioner = (Preconditioner) Enum.Parse(typeof (Preconditioner), x[2]);
                    s.Tolerance = Convert.ToDecimal(x[3]);
                    s.RelTol = Convert.ToDecimal(x[4]);
                    l.Add(s);
                }
            }
            SetSolverData(sd);
            return Json("OK");
        }