コード例 #1
0
        public void InnnerSourceTest()
        {
            Point3D x        = new Point3D(0, 0.25, 0);
            double  expected = 4;
            double  actual;

            actual = InnerSourcePlate.SourceFunction(x);
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void DoWork()
        {
            var sw = new Stopwatch();

            sw.Start();
            //  var bound = new ParallelepipedNearBound();
            var bound = new Parallelepiped();
            var boundWithCondition = ConditionSetter.SetKirghoffCondition(bound);
            var source             = new InnerSourcePlate();
            //  var innerSource = new List<InnerSourceWithFunction<Point3D>>(); //no innersors CollocationKirghoffMethod
            var innerSource = InnerSourceFactory.GetSourcesParalelepiped(source);

            var eps = 1;

            var    paperKirghoff = new PaperKirghoff1UmovaProgram(bound, innerSource);
            var    dPrevious     = paperKirghoff.GetSolutionVector();
            Vector dCurrent;

            while (true)
            {
                var method1 = MethodFactory.GetJakobiMethod(boundWithCondition, innerSource, dPrevious);
                method1.Solve();
                dCurrent  = dPrevious + method1.Solution;
                dPrevious = dCurrent;
                Console.WriteLine("d: " + method1.Solution.Norma());
                if (method1.Solution.Norma() < eps)
                {
                    break;
                }
            }
            var method = MethodFactory.GetCollocationKirghoffMethod(
                boundWithCondition,
                innerSource,
                KirghoffTransformation.Pow,
                KirghoffTransformation.ConversePow);

            method.Solution = dCurrent;

            var plotter = PlotterFactory.GetPlotter(bound, method.U);

            plotter.Plot();
            // Console.WriteLine("Total time: " + sw.ElapsedMilliseconds);

            /*f-1*f(d0)=x
             * d1=d0-x,
             * f-1*f(d1)=x
             * d2=d1-x*/
        }