コード例 #1
0
        public void Test_Speed_run()
        {
            Mock <ILogger> stubLogger = new Mock <ILogger>();
            Teplo          teplo      = new Teplo(stubLogger.Object);

            Stopwatch timer_posl  = new Stopwatch();
            Stopwatch timer_paral = new Stopwatch();
            int       n           = 100;
            double    time        = 1;
            double    tau         = 0.001;
            double    h           = 1;

            double[,] u = new double[n, n];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    u[i, j] = 10;
                }
            }

            for (int j = 0; j < n; j++)
            {
                u[0, j] = 500;
            }

            for (int i = 0; i < n; i++)
            {
                u[i, n - 1] = 500;
            }

            for (int j = 0; j < n; j++)
            {
                u[n - 1, j] = 500;
            }

            for (int i = 0; i < n; i++)
            {
                u[i, 0] = 500;
            }
            timer_posl.Start();
            teplo.PoslCulc(u, time, tau, h);
            timer_posl.Stop();

            timer_paral.Start();
            teplo.ParalCulc(u, time, tau, h);
            timer_paral.Stop();

            bool flag = true;

            if (timer_paral.ElapsedMilliseconds >= timer_posl.ElapsedMilliseconds)
            {
                flag = false;
            }
            Assert.IsFalse(flag, "Нет ускорения");
        }
コード例 #2
0
        public OutputDate3D CulcTeploParal3D(InputDate3D inputDate)
        {
            OutputDate3D mass_data = new OutputDate3D();
            ILogger      log       = new NLogAdapter();

            double[,,] array1 = ToMulti3D(inputDate.Mass_u);

            double h     = inputDate.H;
            double time  = inputDate.Time;
            double tau   = inputDate.Tau;
            Teplo  teplo = new Teplo(log);

            double[,,] array2    = teplo.ЗDParalCulc(array1, time, tau, h);
            mass_data.Culc_Teplo = ToJagged3D(array2);
            return(mass_data);
        }
コード例 #3
0
        public OutputDate3D CulcTeploPosl3D(InputDate3D inputDate)
        {
            OutputDate3D mass_data = new OutputDate3D();

            double[,,] array1 = ToMulti3D(inputDate.Mass_u);

            double h     = inputDate.H;
            double time  = inputDate.Time;
            double tau   = inputDate.Tau;
            Teplo  teplo = new Teplo();

            double[,,] array2 = teplo.PoslCulс3D(array1, time, tau, h);

            mass_data.Culc_Teplo = ToJagged3D(array2);
            return(mass_data);
        }
コード例 #4
0
        public void Test_Equality_Parallel_And_Posl_Metods()
        {
            Mock <ILogger> stubLogger = new Mock <ILogger>();
            Teplo          teplo      = new Teplo(stubLogger.Object);

            int    n    = 100;
            double time = 1;
            double tau  = 0.001;
            double h    = 1;

            double[,] u         = new double[n, n];
            double[,] uposl     = new double[n, n];
            double[,] uparallel = new double[n, n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    u[i, j] = 10;
                }
            }

            for (int j = 0; j < n; j++)
            {
                u[0, j] = 500;
            }

            for (int i = 0; i < n; i++)
            {
                u[i, n - 1] = 500;
            }

            for (int j = 0; j < n; j++)
            {
                u[n - 1, j] = 500;
            }

            for (int i = 0; i < n; i++)
            {
                u[i, 0] = 500;
            }

            uposl     = teplo.PoslCulc(u, time, tau, h);
            uparallel = teplo.ParalCulc(u, time, tau, h);

            Assert.AreEqual(uposl, uparallel);
        }
コード例 #5
0
        public OutputDate CulcTeploPosl(InputDate inputDate)
        {
            OutputDate mass_data = new OutputDate();

            double[,] array1 = ToMultiD(inputDate.Mass_u);

            double  h     = inputDate.H;
            double  time  = inputDate.Time;
            double  tau   = inputDate.Tau;
            ILogger log   = new NLogAdapter();
            Teplo   teplo = new Teplo(log);

            double [,] array2 = teplo.PoslCulc(array1, time, tau, h);

            mass_data.Culc_Teplo = ToJagged(array2);
            return(mass_data);
        }
コード例 #6
0
        public OutputDate CulcTeploParal(InputDate inputDate)
        {
            // inputMatrixes.Mass_a
            OutputDate mass_data = new OutputDate();
            int        a         = inputDate.Mass_u.GetLength(0);
            int        b         = inputDate.Mass_u.GetLength(1);
            double     h         = inputDate.H;
            double     time      = inputDate.Time;
            double     tau       = inputDate.Tau;

            mass_data.Culc_Teplo = new double[a, b];
            Teplo teplo = new Teplo();

            mass_data.Culc_Teplo = teplo.ParalCulc(inputDate.Mass_u, time, tau, h);

            return(mass_data);
        }
コード例 #7
0
        public void Test_Rigth_Work_3D()
        {
            Mock <ILogger> stubLogger = new Mock <ILogger>();
            Teplo          teplo      = new Teplo(stubLogger.Object);

            int    n    = 10;
            double time = 10;
            double tau  = 0.01;
            double h    = 1;

            double[,,] u    = new double[n, n, n];
            double[,,] unew = new double[n, n, n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        u[i, j, k] = unew[i, j, k] = 10;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    u[i, j, 0] = unew[i, j, 0] = 50;
                }
            }

            unew = teplo.PoslCulс3D(u, time, tau, h);

            bool flag = false;

            if (unew[1, 1, 1] < unew[n - 2, n - 2, n - 2])

            {
                flag = true;
            }
            Assert.IsFalse(flag, "Считает не правильно");
        }
コード例 #8
0
ファイル: Test_teplo.cs プロジェクト: SmirnovVM/Oxyplot_teplo
        public void Test_Rigth_Work_3D()
        {
            Teplo  teplo = new Teplo();
            int    n     = 5;
            double time  = 10;
            double tau   = 0.01;
            double h     = 1;

            double[,,] u    = new double[n, n, n];
            double[,,] unew = new double[n, n, n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        u[i, j, k] = unew[i, j, k] = 10;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    u[i, j, 0] = unew[i, j, 0] = 50;
                }
            }

            unew = teplo.PoslCulс3D(u, time, tau, h);

            bool flag = false;

            if (unew[0, 0, 0] < unew[n - 1, n - 1, n - 1])

            {
                flag = true;
            }
            Assert.IsFalse(flag, "Считает не правильно");
        }