Example #1
0
        /// <summary>
        /// Solves the instance assuming linear behavior (both geometric and material) for specified cases.
        /// </summary>
        /// <param name="cases">The cases.</param>
        public void Solve(params LoadCase[] cases)
        {
            var cfg = new SolverConfiguration();

            cfg.SolverFactory = new CholeskySolverFactory();//if not defined, Cholesky by default

            cfg.LoadCases = new List <LoadCase>(cases);

            Solve(cfg);
        }
Example #2
0
        public void Solve_MPC(params LoadCase[] cases)
        {
            var fact = CalcUtil.CreateBuiltInSolverFactory(BuiltInSolverType.CholeskyDecomposition);

            var cfg = new SolverConfiguration();

            cfg.SolverFactory = fact;

            cfg.LoadCases.AddRange(cases);

            Solve_MPC(cfg);
        }
Example #3
0
        /// <summary>
        /// Solves the instance assuming linear behavior (both geometric and material) for specified configuration.
        /// </summary>
        /// <param name="config">The configuration.</param>
        public void Solve(SolverConfiguration config)
        {
            //new version
            lastResult                 = new StaticLinearAnalysisResult();
            lastResult.Parent          = this;
            lastResult.SolverGenerator = config.SolverGenerator;

            foreach (var loadCase in config.LoadCases)
            {
                lastResult.AddAnalysisResultIfNotExists(loadCase);
            }
        }
Example #4
0
        /*
         * /// <summary>
         * /// Solves the model using specified solver generator.
         * /// </summary>
         * /// <param name="solverGenerator">The solver generator.</param>
         * [Obsolete()]
         * public void Solve(Func<SparseMatrix, ISolver> solverGenerator)
         * {
         *  throw new NotImplementedException();
         * }
         */

        /// <summary>
        /// Solves the model using specified solver factory.
        /// </summary>
        /// <param name="factory">The factory.</param>
        public void Solve(ISolverFactory factory)
        {
            var cfg = new SolverConfiguration();

            cfg.SolverFactory = factory;

            cfg.LoadCases = new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            };

            Solve(cfg);
        }
Example #5
0
        /*
         * /// <summary>
         * /// Solves the instance with specified <see cref="solver" /> and assuming linear behavior (both geometric and material) and for default load case.
         * /// </summary>
         * /// <remarks>
         * /// This is not possible to use this, </remarks>
         * /// <param name="solver">The solver.</param>
         * [Obsolete("use Solve(Func<CompressedColumnStorage, ISolver> solverGenerator) instead")]
         * public void Solve(ISolver solver)
         * {
         *  PrecheckForErrors();
         *
         *  var cfg = new SolverConfiguration();
         *
         *  cfg.CustomSolver = solver;
         *
         *  cfg.LoadCases = new List<LoadCase>() { LoadCase.DefaultLoadCase };
         *
         *  Solve(cfg);
         * }*/

        /// <summary>
        /// Solves the model using specified solver generator.
        /// </summary>
        /// <param name="solverGenerator">The solver generator.</param>
        public void Solve(Func <CompressedColumnStorage, ISolver> solverGenerator)
        {
            var cfg = new SolverConfiguration();

            cfg.SolverGenerator = solverGenerator;

            cfg.LoadCases = new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            };

            Solve(cfg);
        }
Example #6
0
        public void Solve_MPC()
        {
            var fact = CalcUtil.CreateBuiltInSolverFactory(BuiltInSolverType.CholeskyDecomposition);

            var cfg = new SolverConfiguration();

            cfg.SolverFactory = fact;

            cfg.LoadCases = new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            };

            Solve_MPC(cfg);
        }
Example #7
0
        /// <summary>
        /// Solves the instance assuming linear behavior (both geometric and material) for specified cases.
        /// </summary>
        /// <param name="cases">The cases.</param>
        public void Solve(params LoadCase[] cases)
        {
            var cfg = new SolverConfiguration();

            cfg.SolverGenerator = i =>
            {
                var sl = CalcUtil.CreateBuiltInSolver(BuiltInSolverType.CholeskyDecomposition);
                sl.A = i;
                return(sl);
            };

            cfg.LoadCases = new List <LoadCase>(cases);

            Solve(cfg);
        }
Example #8
0
        public void Solve_MPC(SolverConfiguration config)
        {
            //new version
            lastResult        = new StaticLinearAnalysisResult();
            lastResult.Parent = this;

            lastResult.SolverFactory = config.SolverFactory;

            ReIndexNodes();

            foreach (var loadCase in config.LoadCases)
            {
                lastResult.AddAnalysisResultIfNotExists_MPC(loadCase);
            }
        }
Example #9
0
        public void Solve_MPC(SolverConfiguration config)
        {
            //new version
            lastResult        = new StaticLinearAnalysisResult();
            lastResult.Parent = this;

            lastResult.SolverFactory = config.SolverFactory;

            //if(elements.Any(i=>i is RigidElement))
            //    throw new Exception("Invalid solve for MPC element");// Model with RigidElement element should call Model.Solve()

            ReIndexNodes();

            foreach (var loadCase in config.LoadCases)
            {
                lastResult.AddAnalysisResultIfNotExists_MPC(loadCase);
            }
        }
Example #10
0
        /// <summary>
        /// Solves the instance assuming linear behavior (both geometric and material) for specified configuration.
        /// </summary>
        /// <param name="config">The configuration.</param>
        public void Solve(SolverConfiguration config)
        {
            //new version
            lastResult        = new StaticLinearAnalysisResult();
            lastResult.Parent = this;

            lastResult.SolverFactory = config.SolverFactory;

            ReIndexNodes();

            if (this.mpcElements.Count > 0)
            {
                throw new InvalidOperationException("Invalid solve for MPC element");// Model with MPC element should call Model.Solve_MPC()
            }
            foreach (var loadCase in config.LoadCases)
            {
                lastResult.AddAnalysisResultIfNotExists(loadCase);
            }
        }