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, "Нет ускорения"); }
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); }
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); }
public OutputDate CulcTeploPosl(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.PoslCulc(inputDate.Mass_u, time, tau, h); return(mass_data); }