Exemplo n.º 1
0
        public override IEnumerable <INumericalResult> Solve(int resultsCount)
        {
            List <INumericalResult> results = new List <INumericalResult>();

            if (_mesh.IsMeshGenerated)
            {
                List <int> indeciesToDelete;
                Matrix     GeneralMatrix = GetGeneralMatrix(out indeciesToDelete);


                Vector init = InitValue();

                CauchyProblemResult cauchyProblemResult = CauchyProblemSolver.HeunMethodSolve((t, v) => GeneralMatrix * v, init, _maxTime, _intervalsTime);
                //CauchyProblemResult cauchyProblemResult = CauchyProblemSolver.AdamsBashforthMethodsSolve((t, v) => GeneralMatrix*v, init, _maxTime, _intervalsTime);
                //CauchyProblemResult cauchyProblemResult = CauchyProblemSolver.GirMethodsSolve((t, v) => GeneralMatrix*v, init, _maxTime, _intervalsTime);

                SemidiscreteVibrationsNumericalResult result = new SemidiscreteVibrationsNumericalResult(_mesh.Elements, cauchyProblemResult.DeltaTime, _maxTime);
                foreach (Vector v in cauchyProblemResult.Results)
                {
                    AddToResult(result, v, indeciesToDelete);
                }

                results.Add(result);
            }
            return(results);
        }
        public void HeunMethodSolveTest()
        {
            Func <double, Vector, Vector> f = testF;

            Vector initValue = new Vector(2);

            initValue[0] = 0;
            initValue[1] = -3;

            double maxTime             = 20;
            int    intervals           = 200;
            CauchyProblemResult actual = CauchyProblemSolver.GirMethodsSolve(f, initValue, maxTime, intervals);

            Assert.AreEqual(actual, actual);
        }